Lines Matching full:link

47 	struct ocxl_link *link;  member
78 * A opencapi link can be used be by several PCI functions. We have
79 * one link per device slot.
190 struct ocxl_link *link = (struct ocxl_link *) data; in xsl_fault_handler() local
191 struct spa *spa = link->spa; in xsl_fault_handler()
276 static int setup_xsl_irq(struct pci_dev *dev, struct ocxl_link *link) in setup_xsl_irq() argument
278 struct spa *spa = link->spa; in setup_xsl_irq()
291 link->domain, link->bus, link->dev); in setup_xsl_irq()
299 * number of interrupts. Could we have an IRQ domain per link? in setup_xsl_irq()
312 link); in setup_xsl_irq()
331 static void release_xsl_irq(struct ocxl_link *link) in release_xsl_irq() argument
333 struct spa *spa = link->spa; in release_xsl_irq()
336 free_irq(spa->virq, link); in release_xsl_irq()
343 static int alloc_spa(struct pci_dev *dev, struct ocxl_link *link) in alloc_spa() argument
363 pr_debug("Allocated SPA for %x:%x:%x at %p\n", link->domain, link->bus, in alloc_spa()
364 link->dev, spa->spa_mem); in alloc_spa()
366 link->spa = spa; in alloc_spa()
370 static void free_spa(struct ocxl_link *link) in free_spa() argument
372 struct spa *spa = link->spa; in free_spa()
374 pr_debug("Freeing SPA for %x:%x:%x\n", link->domain, link->bus, in free_spa()
375 link->dev); in free_spa()
380 link->spa = NULL; in free_spa()
386 struct ocxl_link *link; in alloc_link() local
389 link = kzalloc(sizeof(struct ocxl_link), GFP_KERNEL); in alloc_link()
390 if (!link) in alloc_link()
393 kref_init(&link->ref); in alloc_link()
394 link->domain = pci_domain_nr(dev->bus); in alloc_link()
395 link->bus = dev->bus->number; in alloc_link()
396 link->dev = PCI_SLOT(dev->devfn); in alloc_link()
397 atomic_set(&link->irq_available, MAX_IRQ_PER_LINK); in alloc_link()
398 spin_lock_init(&link->atsd_lock); in alloc_link()
400 rc = alloc_spa(dev, link); in alloc_link()
404 rc = setup_xsl_irq(dev, link); in alloc_link()
409 rc = pnv_ocxl_spa_setup(dev, link->spa->spa_mem, PE_mask, in alloc_link()
410 &link->platform_data); in alloc_link()
414 /* if link->arva is not defeined, MMIO registers are not used to in alloc_link()
419 pnv_ocxl_map_lpar(dev, mfspr(SPRN_LPID), 0, &link->arva); in alloc_link()
421 *out_link = link; in alloc_link()
425 release_xsl_irq(link); in alloc_link()
427 free_spa(link); in alloc_link()
429 kfree(link); in alloc_link()
433 static void free_link(struct ocxl_link *link) in free_link() argument
435 release_xsl_irq(link); in free_link()
436 free_spa(link); in free_link()
437 kfree(link); in free_link()
443 struct ocxl_link *link; in ocxl_link_setup() local
446 list_for_each_entry(link, &links_list, list) { in ocxl_link_setup()
447 /* The functions of a device all share the same link */ in ocxl_link_setup()
448 if (link->domain == pci_domain_nr(dev->bus) && in ocxl_link_setup()
449 link->bus == dev->bus->number && in ocxl_link_setup()
450 link->dev == PCI_SLOT(dev->devfn)) { in ocxl_link_setup()
451 kref_get(&link->ref); in ocxl_link_setup()
452 *link_handle = link; in ocxl_link_setup()
456 rc = alloc_link(dev, PE_mask, &link); in ocxl_link_setup()
460 list_add(&link->list, &links_list); in ocxl_link_setup()
461 *link_handle = link; in ocxl_link_setup()
470 struct ocxl_link *link = container_of(ref, struct ocxl_link, ref); in release_xsl() local
472 if (link->arva) { in release_xsl()
473 pnv_ocxl_unmap_lpar(link->arva); in release_xsl()
474 link->arva = NULL; in release_xsl()
477 list_del(&link->list); in release_xsl()
479 pnv_ocxl_spa_release(link->platform_data); in release_xsl()
480 free_link(link); in release_xsl()
485 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_release() local
488 kref_put(&link->ref, release_xsl); in ocxl_link_release()
498 struct ocxl_link *link = pe_data->link; in invalidate_range() local
504 spin_lock(&link->atsd_lock); in invalidate_range()
506 pnv_ocxl_tlb_invalidate(link->arva, pid, addr, page_size); in invalidate_range()
507 spin_unlock(&link->atsd_lock); in invalidate_range()
542 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_add_pe() local
543 struct spa *spa = link->spa; in ocxl_link_add_pe()
570 pe_data->link = link; in ocxl_link_add_pe()
590 if (link->arva) { in ocxl_link_add_pe()
632 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_update_pe() local
633 struct spa *spa = link->spa; in ocxl_link_update_pe()
659 rc = pnv_ocxl_spa_remove_pe_from_cache(link->platform_data, pe_handle); in ocxl_link_update_pe()
668 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_remove_pe() local
669 struct spa *spa = link->spa; in ocxl_link_remove_pe()
721 rc = pnv_ocxl_spa_remove_pe_from_cache(link->platform_data, pe_handle); in ocxl_link_remove_pe()
729 if (link->arva) { in ocxl_link_remove_pe()
734 spin_lock(&link->atsd_lock); in ocxl_link_remove_pe()
735 pnv_ocxl_tlb_invalidate(link->arva, in ocxl_link_remove_pe()
739 spin_unlock(&link->atsd_lock); in ocxl_link_remove_pe()
754 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_irq_alloc() local
757 if (atomic_dec_if_positive(&link->irq_available) < 0) in ocxl_link_irq_alloc()
762 atomic_inc(&link->irq_available); in ocxl_link_irq_alloc()
773 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_free_irq() local
776 atomic_inc(&link->irq_available); in ocxl_link_free_irq()