Commit 6f881aba authored by Diana Craciun's avatar Diana Craciun Committed by Catalin Marinas

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: default avatarDiana Craciun <diana.craciun@oss.nxp.com>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: default avatarRob 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.comSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 5bda70c6
...@@ -613,18 +613,20 @@ u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in) ...@@ -613,18 +613,20 @@ u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in)
* of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain * of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain
* @dev: device for which the mapping is to be done. * @dev: device for which the mapping is to be done.
* @rid: Requester ID for the device. * @rid: Requester ID for the device.
* @bus_token: Bus token
* *
* Walk up the device hierarchy looking for devices with a "msi-map" * Walk up the device hierarchy looking for devices with a "msi-map"
* property. * property.
* *
* Returns: the MSI domain for this device (or NULL on failure) * Returns: the MSI domain for this device (or NULL on failure)
*/ */
struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 rid) struct irq_domain *of_msi_map_get_device_domain(struct device *dev, u32 id,
u32 bus_token)
{ {
struct device_node *np = NULL; struct device_node *np = NULL;
__of_msi_map_rid(dev, &np, rid); __of_msi_map_rid(dev, &np, id);
return irq_find_matching_host(np, DOMAIN_BUS_PCI_MSI); return irq_find_matching_host(np, bus_token);
} }
/** /**
......
...@@ -1556,7 +1556,7 @@ struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev) ...@@ -1556,7 +1556,7 @@ struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev)
u32 rid = pci_dev_id(pdev); u32 rid = pci_dev_id(pdev);
pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid); pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid);
dom = of_msi_map_get_device_domain(&pdev->dev, rid); dom = of_msi_map_get_device_domain(&pdev->dev, rid, DOMAIN_BUS_PCI_MSI);
if (!dom) if (!dom)
dom = iort_get_device_domain(&pdev->dev, rid, dom = iort_get_device_domain(&pdev->dev, rid,
DOMAIN_BUS_PCI_MSI); DOMAIN_BUS_PCI_MSI);
......
...@@ -52,7 +52,8 @@ extern struct irq_domain *of_msi_get_domain(struct device *dev, ...@@ -52,7 +52,8 @@ extern struct irq_domain *of_msi_get_domain(struct device *dev,
struct device_node *np, struct device_node *np,
enum irq_domain_bus_token token); enum irq_domain_bus_token token);
extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev, extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
u32 rid); u32 id,
u32 bus_token);
extern void of_msi_configure(struct device *dev, struct device_node *np); extern void of_msi_configure(struct device *dev, struct device_node *np);
u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in); u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in);
#else #else
...@@ -85,7 +86,7 @@ static inline struct irq_domain *of_msi_get_domain(struct device *dev, ...@@ -85,7 +86,7 @@ static inline struct irq_domain *of_msi_get_domain(struct device *dev,
return NULL; return NULL;
} }
static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev, static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
u32 rid) u32 id, u32 bus_token)
{ {
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment