Skip to content

Commit 6f881ab

Browse files
dmcraciunctmarinas
authored andcommitted
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 <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Rob Herring <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> # pci/msi.c Cc: Bjorn Helgaas <[email protected]> Cc: Rob Herring <[email protected]> Cc: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 5bda70c commit 6f881ab

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

drivers/of/irq.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,18 +613,20 @@ u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in)
613613
* of_msi_map_get_device_domain - Use msi-map to find the relevant MSI domain
614614
* @dev: device for which the mapping is to be done.
615615
* @rid: Requester ID for the device.
616+
* @bus_token: Bus token
616617
*
617618
* Walk up the device hierarchy looking for devices with a "msi-map"
618619
* property.
619620
*
620621
* Returns: the MSI domain for this device (or NULL on failure)
621622
*/
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)
623625
{
624626
struct device_node *np = NULL;
625627

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);
628630
}
629631

630632
/**

drivers/pci/msi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,7 +1556,7 @@ struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev)
15561556
u32 rid = pci_dev_id(pdev);
15571557

15581558
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);
15601560
if (!dom)
15611561
dom = iort_get_device_domain(&pdev->dev, rid,
15621562
DOMAIN_BUS_PCI_MSI);

include/linux/of_irq.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ extern struct irq_domain *of_msi_get_domain(struct device *dev,
5252
struct device_node *np,
5353
enum irq_domain_bus_token token);
5454
extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
55-
u32 rid);
55+
u32 id,
56+
u32 bus_token);
5657
extern void of_msi_configure(struct device *dev, struct device_node *np);
5758
u32 of_msi_map_rid(struct device *dev, struct device_node *msi_np, u32 rid_in);
5859
#else
@@ -85,7 +86,7 @@ static inline struct irq_domain *of_msi_get_domain(struct device *dev,
8586
return NULL;
8687
}
8788
static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
88-
u32 rid)
89+
u32 id, u32 bus_token)
8990
{
9091
return NULL;
9192
}

0 commit comments

Comments
 (0)