Skip to content

Commit d1718a1

Browse files
Lorenzo Pieralisictmarinas
authored andcommitted
ACPI/IORT: Make iort_get_device_domain IRQ domain agnostic
iort_get_device_domain() is PCI specific but it need not be, since it can be used to retrieve IRQ domain nexus of any kind by adding an irq_domain_bus_token input to it. Make it PCI agnostic by also renaming the requestor ID input to a more generic ID name. Signed-off-by: Lorenzo Pieralisi <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> # pci/msi.c Cc: Will Deacon <[email protected]> Cc: Hanjun Guo <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Sudeep Holla <[email protected]> Cc: Robin Murphy <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 07d2e59 commit d1718a1

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

drivers/acpi/arm64/iort.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,6 @@ static struct acpi_iort_node *iort_find_dev_node(struct device *dev)
550550
node = iort_get_iort_node(dev->fwnode);
551551
if (node)
552552
return node;
553-
554553
/*
555554
* if not, then it should be a platform device defined in
556555
* DSDT/SSDT (with Named Component node in IORT)
@@ -641,13 +640,13 @@ static int __maybe_unused iort_find_its_base(u32 its_id, phys_addr_t *base)
641640
/**
642641
* iort_dev_find_its_id() - Find the ITS identifier for a device
643642
* @dev: The device.
644-
* @req_id: Device's requester ID
643+
* @id: Device's ID
645644
* @idx: Index of the ITS identifier list.
646645
* @its_id: ITS identifier.
647646
*
648647
* Returns: 0 on success, appropriate error value otherwise
649648
*/
650-
static int iort_dev_find_its_id(struct device *dev, u32 req_id,
649+
static int iort_dev_find_its_id(struct device *dev, u32 id,
651650
unsigned int idx, int *its_id)
652651
{
653652
struct acpi_iort_its_group *its;
@@ -657,7 +656,7 @@ static int iort_dev_find_its_id(struct device *dev, u32 req_id,
657656
if (!node)
658657
return -ENXIO;
659658

660-
node = iort_node_map_id(node, req_id, NULL, IORT_MSI_TYPE);
659+
node = iort_node_map_id(node, id, NULL, IORT_MSI_TYPE);
661660
if (!node)
662661
return -ENXIO;
663662

@@ -680,19 +679,20 @@ static int iort_dev_find_its_id(struct device *dev, u32 req_id,
680679
*
681680
* Returns: the MSI domain for this device, NULL otherwise
682681
*/
683-
struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id)
682+
struct irq_domain *iort_get_device_domain(struct device *dev, u32 id,
683+
enum irq_domain_bus_token bus_token)
684684
{
685685
struct fwnode_handle *handle;
686686
int its_id;
687687

688-
if (iort_dev_find_its_id(dev, req_id, 0, &its_id))
688+
if (iort_dev_find_its_id(dev, id, 0, &its_id))
689689
return NULL;
690690

691691
handle = iort_find_domain_token(its_id);
692692
if (!handle)
693693
return NULL;
694694

695-
return irq_find_matching_fwnode(handle, DOMAIN_BUS_PCI_MSI);
695+
return irq_find_matching_fwnode(handle, bus_token);
696696
}
697697

698698
static void iort_set_device_domain(struct device *dev,

drivers/pci/msi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,8 @@ struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev)
15581558
pci_for_each_dma_alias(pdev, get_msi_id_cb, &rid);
15591559
dom = of_msi_map_get_device_domain(&pdev->dev, rid);
15601560
if (!dom)
1561-
dom = iort_get_device_domain(&pdev->dev, rid);
1561+
dom = iort_get_device_domain(&pdev->dev, rid,
1562+
DOMAIN_BUS_PCI_MSI);
15621563
return dom;
15631564
}
15641565
#endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */

include/linux/acpi_iort.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ struct fwnode_handle *iort_find_domain_token(int trans_id);
2929
#ifdef CONFIG_ACPI_IORT
3030
void acpi_iort_init(void);
3131
u32 iort_msi_map_rid(struct device *dev, u32 req_id);
32-
struct irq_domain *iort_get_device_domain(struct device *dev, u32 req_id);
32+
struct irq_domain *iort_get_device_domain(struct device *dev, u32 id,
33+
enum irq_domain_bus_token bus_token);
3334
void acpi_configure_pmsi_domain(struct device *dev);
3435
int iort_pmsi_get_dev_id(struct device *dev, u32 *dev_id);
3536
/* IOMMU interface */
@@ -40,8 +41,8 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head);
4041
static inline void acpi_iort_init(void) { }
4142
static inline u32 iort_msi_map_rid(struct device *dev, u32 req_id)
4243
{ return req_id; }
43-
static inline struct irq_domain *iort_get_device_domain(struct device *dev,
44-
u32 req_id)
44+
static inline struct irq_domain *iort_get_device_domain(
45+
struct device *dev, u32 id, enum irq_domain_bus_token bus_token)
4546
{ return NULL; }
4647
static inline void acpi_configure_pmsi_domain(struct device *dev) { }
4748
/* IOMMU interface */

0 commit comments

Comments
 (0)