Lines Matching refs:spa
51 struct spa { struct
94 struct spa *spa; member
107 static void read_irq(struct spa *spa, u64 *dsisr, u64 *dar, u64 *pe) in read_irq() argument
111 *dsisr = in_be64(spa->reg_dsisr); in read_irq()
112 *dar = in_be64(spa->reg_dar); in read_irq()
113 reg = in_be64(spa->reg_pe_handle); in read_irq()
117 static void ack_irq(struct spa *spa, enum xsl_response r) in ack_irq() argument
130 trace_ocxl_fault_ack(spa->spa_mem, spa->xsl_fault.pe, in ack_irq()
131 spa->xsl_fault.dsisr, spa->xsl_fault.dar, reg); in ack_irq()
132 out_be64(spa->reg_tfc, reg); in ack_irq()
143 struct spa *spa = container_of(fault, struct spa, xsl_fault); in xsl_fault_handler_bh() local
185 ack_irq(spa, r); in xsl_fault_handler_bh()
191 struct spa *spa = link->spa; in xsl_fault_handler() local
198 read_irq(spa, &dsisr, &dar, &pe_handle); in xsl_fault_handler()
199 trace_ocxl_fault(spa->spa_mem, pe_handle, dsisr, dar, -1); in xsl_fault_handler()
202 pe = spa->spa_mem + pe_handle; in xsl_fault_handler()
213 ack_irq(spa, ADDRESS_ERROR); in xsl_fault_handler()
218 pe_data = radix_tree_lookup(&spa->pe_tree, pe_handle); in xsl_fault_handler()
232 ack_irq(spa, ADDRESS_ERROR); in xsl_fault_handler()
243 ack_irq(spa, ADDRESS_ERROR); in xsl_fault_handler()
249 spa->xsl_fault.pe = pe_handle; in xsl_fault_handler()
250 spa->xsl_fault.dar = dar; in xsl_fault_handler()
251 spa->xsl_fault.dsisr = dsisr; in xsl_fault_handler()
252 spa->xsl_fault.pe_data = *pe_data; in xsl_fault_handler()
258 schedule_work(&spa->xsl_fault.fault_work); in xsl_fault_handler()
260 ack_irq(spa, ADDRESS_ERROR); in xsl_fault_handler()
264 static void unmap_irq_registers(struct spa *spa) in unmap_irq_registers() argument
266 pnv_ocxl_unmap_xsl_regs(spa->reg_dsisr, spa->reg_dar, spa->reg_tfc, in unmap_irq_registers()
267 spa->reg_pe_handle); in unmap_irq_registers()
270 static int map_irq_registers(struct pci_dev *dev, struct spa *spa) in map_irq_registers() argument
272 return pnv_ocxl_map_xsl_regs(dev, &spa->reg_dsisr, &spa->reg_dar, in map_irq_registers()
273 &spa->reg_tfc, &spa->reg_pe_handle); in map_irq_registers()
278 struct spa *spa = link->spa; in setup_xsl_irq() local
286 rc = map_irq_registers(dev, spa); in setup_xsl_irq()
290 spa->irq_name = kasprintf(GFP_KERNEL, "ocxl-xsl-%x-%x-%x", in setup_xsl_irq()
292 if (!spa->irq_name) { in setup_xsl_irq()
301 spa->virq = irq_create_mapping(NULL, hwirq); in setup_xsl_irq()
302 if (!spa->virq) { in setup_xsl_irq()
309 dev_dbg(&dev->dev, "hwirq %d mapped to virq %d\n", hwirq, spa->virq); in setup_xsl_irq()
311 rc = request_irq(spa->virq, xsl_fault_handler, 0, spa->irq_name, in setup_xsl_irq()
323 irq_dispose_mapping(spa->virq); in setup_xsl_irq()
325 kfree(spa->irq_name); in setup_xsl_irq()
327 unmap_irq_registers(spa); in setup_xsl_irq()
333 struct spa *spa = link->spa; in release_xsl_irq() local
335 if (spa->virq) { in release_xsl_irq()
336 free_irq(spa->virq, link); in release_xsl_irq()
337 irq_dispose_mapping(spa->virq); in release_xsl_irq()
339 kfree(spa->irq_name); in release_xsl_irq()
340 unmap_irq_registers(spa); in release_xsl_irq()
345 struct spa *spa; in alloc_spa() local
347 spa = kzalloc(sizeof(struct spa), GFP_KERNEL); in alloc_spa()
348 if (!spa) in alloc_spa()
351 mutex_init(&spa->spa_lock); in alloc_spa()
352 INIT_RADIX_TREE(&spa->pe_tree, GFP_KERNEL); in alloc_spa()
353 INIT_WORK(&spa->xsl_fault.fault_work, xsl_fault_handler_bh); in alloc_spa()
355 spa->spa_order = SPA_SPA_SIZE_LOG - PAGE_SHIFT; in alloc_spa()
356 spa->spa_mem = (struct ocxl_process_element *) in alloc_spa()
357 __get_free_pages(GFP_KERNEL | __GFP_ZERO, spa->spa_order); in alloc_spa()
358 if (!spa->spa_mem) { in alloc_spa()
360 kfree(spa); in alloc_spa()
364 link->dev, spa->spa_mem); in alloc_spa()
366 link->spa = spa; in alloc_spa()
372 struct spa *spa = link->spa; in free_spa() local
377 if (spa && spa->spa_mem) { in free_spa()
378 free_pages((unsigned long) spa->spa_mem, spa->spa_order); in free_spa()
379 kfree(spa); in free_spa()
380 link->spa = NULL; in free_spa()
409 rc = pnv_ocxl_spa_setup(dev, link->spa->spa_mem, PE_mask, in alloc_link()
543 struct spa *spa = link->spa; in ocxl_link_add_pe() local
552 mutex_lock(&spa->spa_lock); in ocxl_link_add_pe()
554 pe = spa->spa_mem + pe_handle; in ocxl_link_add_pe()
605 radix_tree_insert(&spa->pe_tree, pe_handle, pe_data); in ocxl_link_add_pe()
623 trace_ocxl_context_add(current->pid, spa->spa_mem, pasid, pidr, tidr); in ocxl_link_add_pe()
625 mutex_unlock(&spa->spa_lock); in ocxl_link_add_pe()
633 struct spa *spa = link->spa; in ocxl_link_update_pe() local
641 pe = spa->spa_mem + pe_handle; in ocxl_link_update_pe()
643 mutex_lock(&spa->spa_lock); in ocxl_link_update_pe()
662 mutex_unlock(&spa->spa_lock); in ocxl_link_update_pe()
669 struct spa *spa = link->spa; in ocxl_link_remove_pe() local
696 pe = spa->spa_mem + pe_handle; in ocxl_link_remove_pe()
698 mutex_lock(&spa->spa_lock); in ocxl_link_remove_pe()
705 trace_ocxl_context_remove(current->pid, spa->spa_mem, pasid, in ocxl_link_remove_pe()
724 pe_data = radix_tree_delete(&spa->pe_tree, pe_handle); in ocxl_link_remove_pe()
747 mutex_unlock(&spa->spa_lock); in ocxl_link_remove_pe()