Lines Matching refs:nm

28 		struct ntb_msit_ctx *nm;  member
33 struct ntb_msit_ctx *nm; member
46 struct ntb_msit_ctx *nm = isr_ctx->nm; in ntb_msit_isr() local
48 dev_dbg(&nm->ntb->dev, "Interrupt Occurred: %d", in ntb_msit_isr()
58 struct ntb_msit_ctx *nm = container_of(work, struct ntb_msit_ctx, in ntb_msit_setup_work() local
65 ret = ntb_msi_setup_mws(nm->ntb); in ntb_msit_setup_work()
67 dev_err(&nm->ntb->dev, "Unable to setup MSI windows: %d\n", in ntb_msit_setup_work()
73 nm->isr_ctx[i].irq_idx = i; in ntb_msit_setup_work()
74 nm->isr_ctx[i].nm = nm; in ntb_msit_setup_work()
76 if (!nm->isr_ctx[i].irq_num) { in ntb_msit_setup_work()
77 irq = ntbm_msi_request_irq(nm->ntb, ntb_msit_isr, in ntb_msit_setup_work()
79 &nm->isr_ctx[i], in ntb_msit_setup_work()
80 &nm->isr_ctx[i].desc); in ntb_msit_setup_work()
84 nm->isr_ctx[i].irq_num = irq; in ntb_msit_setup_work()
87 ret = ntb_spad_write(nm->ntb, 2 * i + 1, in ntb_msit_setup_work()
88 nm->isr_ctx[i].desc.addr_offset); in ntb_msit_setup_work()
92 ret = ntb_spad_write(nm->ntb, 2 * i + 2, in ntb_msit_setup_work()
93 nm->isr_ctx[i].desc.data); in ntb_msit_setup_work()
100 ntb_spad_write(nm->ntb, 0, irq_count); in ntb_msit_setup_work()
101 ntb_peer_db_set(nm->ntb, BIT(ntb_port_number(nm->ntb))); in ntb_msit_setup_work()
106 struct ntb_msit_ctx *nm = ctx; in ntb_msit_desc_changed() local
109 dev_dbg(&nm->ntb->dev, "MSI Descriptors Changed\n"); in ntb_msit_desc_changed()
112 ntb_spad_write(nm->ntb, 2 * i + 1, in ntb_msit_desc_changed()
113 nm->isr_ctx[i].desc.addr_offset); in ntb_msit_desc_changed()
114 ntb_spad_write(nm->ntb, 2 * i + 2, in ntb_msit_desc_changed()
115 nm->isr_ctx[i].desc.data); in ntb_msit_desc_changed()
118 ntb_peer_db_set(nm->ntb, BIT(ntb_port_number(nm->ntb))); in ntb_msit_desc_changed()
123 struct ntb_msit_ctx *nm = ctx; in ntb_msit_link_event() local
125 if (!ntb_link_is_up(nm->ntb, NULL, NULL)) in ntb_msit_link_event()
128 schedule_work(&nm->setup_work); in ntb_msit_link_event()
131 static void ntb_msit_copy_peer_desc(struct ntb_msit_ctx *nm, int peer) in ntb_msit_copy_peer_desc() argument
134 struct ntb_msi_desc *desc = nm->peers[peer].msi_desc; in ntb_msit_copy_peer_desc()
135 int irq_count = nm->peers[peer].num_irqs; in ntb_msit_copy_peer_desc()
138 desc[i].addr_offset = ntb_peer_spad_read(nm->ntb, peer, in ntb_msit_copy_peer_desc()
140 desc[i].data = ntb_peer_spad_read(nm->ntb, peer, 2 * i + 2); in ntb_msit_copy_peer_desc()
143 dev_info(&nm->ntb->dev, "Found %d interrupts on peer %d\n", in ntb_msit_copy_peer_desc()
146 complete_all(&nm->peers[peer].init_comp); in ntb_msit_copy_peer_desc()
151 struct ntb_msit_ctx *nm = ctx; in ntb_msit_db_event() local
153 u64 peer_mask = ntb_db_read(nm->ntb); in ntb_msit_db_event()
157 ntb_db_clear(nm->ntb, peer_mask); in ntb_msit_db_event()
163 irq_count = ntb_peer_spad_read(nm->ntb, peer, 0); in ntb_msit_db_event()
171 kfree(nm->peers[peer].msi_desc); in ntb_msit_db_event()
172 nm->peers[peer].msi_desc = desc; in ntb_msit_db_event()
173 nm->peers[peer].num_irqs = irq_count; in ntb_msit_db_event()
175 ntb_msit_copy_peer_desc(nm, peer); in ntb_msit_db_event()
191 dev_dbg(&peer->nm->ntb->dev, "trigger irq %llu on peer %u\n", in ntb_msit_dbgfs_trigger()
194 return ntb_msi_peer_trigger(peer->nm->ntb, peer->pidx, in ntb_msit_dbgfs_trigger()
205 *port = ntb_peer_port_number(peer->nm->ntb, peer->pidx); in ntb_msit_dbgfs_port_get()
259 struct ntb_msit_ctx *nm = data; in ntb_msit_dbgfs_local_port_get() local
261 *port = ntb_port_number(nm->ntb); in ntb_msit_dbgfs_local_port_get()
270 static void ntb_msit_create_dbgfs(struct ntb_msit_ctx *nm) in ntb_msit_create_dbgfs() argument
272 struct pci_dev *pdev = nm->ntb->pdev; in ntb_msit_create_dbgfs()
277 nm->dbgfs_dir = debugfs_create_dir(pci_name(pdev), in ntb_msit_create_dbgfs()
279 debugfs_create_file("port", 0400, nm->dbgfs_dir, nm, in ntb_msit_create_dbgfs()
282 for (i = 0; i < ntb_peer_port_count(nm->ntb); i++) { in ntb_msit_create_dbgfs()
283 nm->peers[i].pidx = i; in ntb_msit_create_dbgfs()
284 nm->peers[i].nm = nm; in ntb_msit_create_dbgfs()
285 init_completion(&nm->peers[i].init_comp); in ntb_msit_create_dbgfs()
288 peer_dir = debugfs_create_dir(buf, nm->dbgfs_dir); in ntb_msit_create_dbgfs()
291 &nm->peers[i], in ntb_msit_create_dbgfs()
295 &nm->peers[i], &ntb_msit_port_fops); in ntb_msit_create_dbgfs()
298 &nm->peers[i], in ntb_msit_create_dbgfs()
302 &nm->peers[i], in ntb_msit_create_dbgfs()
308 debugfs_create_file_unsafe(buf, 0400, nm->dbgfs_dir, in ntb_msit_create_dbgfs()
309 &nm->isr_ctx[i], in ntb_msit_create_dbgfs()
314 static void ntb_msit_remove_dbgfs(struct ntb_msit_ctx *nm) in ntb_msit_remove_dbgfs() argument
316 debugfs_remove_recursive(nm->dbgfs_dir); in ntb_msit_remove_dbgfs()
321 struct ntb_msit_ctx *nm; in ntb_msit_probe() local
354 nm = devm_kzalloc(&ntb->dev, struct_size(nm, peers, peers), GFP_KERNEL); in ntb_msit_probe()
355 if (!nm) in ntb_msit_probe()
358 nm->isr_ctx = devm_kcalloc(&ntb->dev, num_irqs, sizeof(*nm->isr_ctx), in ntb_msit_probe()
360 if (!nm->isr_ctx) in ntb_msit_probe()
363 INIT_WORK(&nm->setup_work, ntb_msit_setup_work); in ntb_msit_probe()
364 nm->ntb = ntb; in ntb_msit_probe()
366 ntb_msit_create_dbgfs(nm); in ntb_msit_probe()
368 ret = ntb_set_ctx(ntb, nm, &ntb_msit_ops); in ntb_msit_probe()
372 if (!nm->isr_ctx) { in ntb_msit_probe()
382 ntb_msit_remove_dbgfs(nm); in ntb_msit_probe()
383 devm_kfree(&ntb->dev, nm->isr_ctx); in ntb_msit_probe()
384 devm_kfree(&ntb->dev, nm); in ntb_msit_probe()
390 struct ntb_msit_ctx *nm = ntb->ctx; in ntb_msit_remove() local
398 kfree(nm->peers[i].msi_desc); in ntb_msit_remove()
401 ntb_msit_remove_dbgfs(nm); in ntb_msit_remove()