Lines Matching full:link
72 * A opencapi link can be used be by several PCI functions. We have
73 * one link per device slot.
182 struct ocxl_link *link = (struct ocxl_link *) data; in xsl_fault_handler() local
183 struct spa *spa = link->spa; in xsl_fault_handler()
268 static int setup_xsl_irq(struct pci_dev *dev, struct ocxl_link *link) in setup_xsl_irq() argument
270 struct spa *spa = link->spa; in setup_xsl_irq()
283 link->domain, link->bus, link->dev); in setup_xsl_irq()
291 * number of interrupts. Could we have an IRQ domain per link? in setup_xsl_irq()
304 link); in setup_xsl_irq()
323 static void release_xsl_irq(struct ocxl_link *link) in release_xsl_irq() argument
325 struct spa *spa = link->spa; in release_xsl_irq()
328 free_irq(spa->virq, link); in release_xsl_irq()
335 static int alloc_spa(struct pci_dev *dev, struct ocxl_link *link) in alloc_spa() argument
355 pr_debug("Allocated SPA for %x:%x:%x at %p\n", link->domain, link->bus, in alloc_spa()
356 link->dev, spa->spa_mem); in alloc_spa()
358 link->spa = spa; in alloc_spa()
362 static void free_spa(struct ocxl_link *link) in free_spa() argument
364 struct spa *spa = link->spa; in free_spa()
366 pr_debug("Freeing SPA for %x:%x:%x\n", link->domain, link->bus, in free_spa()
367 link->dev); in free_spa()
372 link->spa = NULL; in free_spa()
378 struct ocxl_link *link; in alloc_link() local
381 link = kzalloc(sizeof(struct ocxl_link), GFP_KERNEL); in alloc_link()
382 if (!link) in alloc_link()
385 kref_init(&link->ref); in alloc_link()
386 link->domain = pci_domain_nr(dev->bus); in alloc_link()
387 link->bus = dev->bus->number; in alloc_link()
388 link->dev = PCI_SLOT(dev->devfn); in alloc_link()
389 atomic_set(&link->irq_available, MAX_IRQ_PER_LINK); in alloc_link()
391 rc = alloc_spa(dev, link); in alloc_link()
395 rc = setup_xsl_irq(dev, link); in alloc_link()
400 rc = pnv_ocxl_spa_setup(dev, link->spa->spa_mem, PE_mask, in alloc_link()
401 &link->platform_data); in alloc_link()
405 *out_link = link; in alloc_link()
409 release_xsl_irq(link); in alloc_link()
411 free_spa(link); in alloc_link()
413 kfree(link); in alloc_link()
417 static void free_link(struct ocxl_link *link) in free_link() argument
419 release_xsl_irq(link); in free_link()
420 free_spa(link); in free_link()
421 kfree(link); in free_link()
427 struct ocxl_link *link; in ocxl_link_setup() local
430 list_for_each_entry(link, &links_list, list) { in ocxl_link_setup()
431 /* The functions of a device all share the same link */ in ocxl_link_setup()
432 if (link->domain == pci_domain_nr(dev->bus) && in ocxl_link_setup()
433 link->bus == dev->bus->number && in ocxl_link_setup()
434 link->dev == PCI_SLOT(dev->devfn)) { in ocxl_link_setup()
435 kref_get(&link->ref); in ocxl_link_setup()
436 *link_handle = link; in ocxl_link_setup()
440 rc = alloc_link(dev, PE_mask, &link); in ocxl_link_setup()
444 list_add(&link->list, &links_list); in ocxl_link_setup()
445 *link_handle = link; in ocxl_link_setup()
454 struct ocxl_link *link = container_of(ref, struct ocxl_link, ref); in release_xsl() local
456 list_del(&link->list); in release_xsl()
458 pnv_ocxl_spa_release(link->platform_data); in release_xsl()
459 free_link(link); in release_xsl()
464 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_release() local
467 kref_put(&link->ref, release_xsl); in ocxl_link_release()
500 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_add_pe() local
501 struct spa *spa = link->spa; in ocxl_link_add_pe()
577 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_update_pe() local
578 struct spa *spa = link->spa; in ocxl_link_update_pe()
604 rc = pnv_ocxl_spa_remove_pe_from_cache(link->platform_data, pe_handle); in ocxl_link_update_pe()
613 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_remove_pe() local
614 struct spa *spa = link->spa; in ocxl_link_remove_pe()
666 rc = pnv_ocxl_spa_remove_pe_from_cache(link->platform_data, pe_handle); in ocxl_link_remove_pe()
687 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_irq_alloc() local
691 if (atomic_dec_if_positive(&link->irq_available) < 0) in ocxl_link_irq_alloc()
696 atomic_inc(&link->irq_available); in ocxl_link_irq_alloc()
708 struct ocxl_link *link = (struct ocxl_link *) link_handle; in ocxl_link_free_irq() local
711 atomic_inc(&link->irq_available); in ocxl_link_free_irq()