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

of/irq: make of_msi_map_get_device_domain() bus agnostic

of_msi_map_get_device_domain() is PCI specific but it need not be and
can be easily changed to be bus agnostic in order to be used by other
busses by adding an IRQ domain bus token as an input parameter.

Signed-off-by: Diana Craciun <diana.craciun@oss.nxp.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> # pci/msi.c
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200619082013.13661-10-lorenzo.pieralisi@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Diana Craciun and committed by
Catalin Marinas
6f881aba 5bda70c6

+9 -6
+5 -3
drivers/of/irq.c
··· 613 613 * of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain 614 614 * @dev: device for which the mapping is to be done. 615 615 * @rid: Requester ID for the device. 616 + * @bus_token: Bus token 616 617 * 617 618 * Walk up the device hierarchy looking for devices with a "msi-map" 618 619 * property. 619 620 * 620 621 * Returns: the MSI domain for this device (or NULL on failure) 621 622 */ 622 - struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 rid) 623 + struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 id, 624 + u32 bus_token) 623 625 { 624 626 struct device_node *np = NULL; 625 627 626 - __of_msi_map_rid(dev, &np, rid); 627 - return irq_find_matching_host(np, DOMAIN_BUS_PCI_MSI); 628 + __of_msi_map_rid(dev, &np, id); 629 + return irq_find_matching_host(np, bus_token); 628 630 } 629 631 630 632 /**
+1 -1
drivers/pci/msi.c
··· 1556 1556 u32 rid = pci_dev_id(pdev); 1557 1557 1558 1558 pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); 1559 - dom = of_msi_map_get_device_domain(&pdev->dev, rid); 1559 + dom = of_msi_map_get_device_domain(&pdev->dev, rid, DOMAIN_BUS_PCI_MSI); 1560 1560 if (!dom) 1561 1561 dom = iort_get_device_domain(&pdev->dev, rid, 1562 1562 DOMAIN_BUS_PCI_MSI);
+3 -2
include/linux/of_irq.h
··· 52 52 struct device_node *np, 53 53 enum irq_domain_bus_token token); 54 54 extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev, 55 - u32 rid); 55 + u32 id, 56 + u32 bus_token); 56 57 extern void of_msi_configure(struct device *dev, struct device_node *np); 57 58 u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in); 58 59 #else ··· 86 85 return NULL; 87 86 } 88 87 static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev, 89 - u32 rid) 88 + u32 id, u32 bus_token) 90 89 { 91 90 return NULL; 92 91 }