Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI/MSI: Add pci_msi_map_rid_ctlr_node() helper function

IRQchip drivers need a PCI/MSI function to map a RID to a MSI
controller deviceID namespace and at the same time retrieve the
struct device_node pointer of the MSI controller the RID is mapped
to.

Add pci_msi_map_rid_ctlr_node() to achieve this purpose.

Cc Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20250703-gicv5-host-v7-25-12e71f1b3528@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>

authored by

Lorenzo Pieralisi and committed by
Marc Zyngier
cd0ec59a 31fd3bec

+21
+20
drivers/pci/msi/irqdomain.c
··· 428 428 } 429 429 430 430 /** 431 + * pci_msi_map_rid_ctlr_node - Get the MSI controller node and MSI requester id (RID) 432 + * @pdev: The PCI device 433 + * @node: Pointer to store the MSI controller device node 434 + * 435 + * Use the firmware data to find the MSI controller node for @pdev. 436 + * If found map the RID and initialize @node with it. @node value must 437 + * be set to NULL on entry. 438 + * 439 + * Returns: The RID. 440 + */ 441 + u32 pci_msi_map_rid_ctlr_node(struct pci_dev *pdev, struct device_node **node) 442 + { 443 + u32 rid = pci_dev_id(pdev); 444 + 445 + pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); 446 + 447 + return of_msi_xlate(&pdev->dev, node, rid); 448 + } 449 + 450 + /** 431 451 * pci_msi_get_device_domain - Get the MSI domain for a given PCI device 432 452 * @pdev: The PCI device 433 453 *
+1
include/linux/msi.h
··· 705 705 struct msi_domain_info *info, 706 706 struct irq_domain *parent); 707 707 u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev); 708 + u32 pci_msi_map_rid_ctlr_node(struct pci_dev *pdev, struct device_node **node); 708 709 struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev); 709 710 #else /* CONFIG_PCI_MSI */ 710 711 static inline struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev)