Skip to content

Commit

Permalink
iommu/of: Support ats-supported device-tree property
Browse files Browse the repository at this point in the history
Device-tree declares whether a PCI root-complex supports ATS by setting
the "ats-supported" property. Copy this flag into device fwspec to let
IOMMU drivers quickly check if they can enable ATS for a device.

Tested-by: Ketan Patil <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Liviu Dudau <[email protected]>
Reviewed-by: Robin Murphy <[email protected]>
Reviewed-by: Nicolin Chen <[email protected]>
Signed-off-by: Jean-Philippe Brucker <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Will Deacon <[email protected]>
  • Loading branch information
jpbrucker authored and willdeacon committed Jul 4, 2024
1 parent 40929e8 commit 86e02a8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/iommu/of_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ static int of_iommu_configure_device(struct device_node *master_np,
of_iommu_configure_dev(master_np, dev);
}

static void of_pci_check_device_ats(struct device *dev, struct device_node *np)
{
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);

if (fwspec && of_property_read_bool(np, "ats-supported"))
fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
}

/*
* Returns:
* 0 on success, an iommu was configured
Expand Down Expand Up @@ -147,6 +155,7 @@ int of_iommu_configure(struct device *dev, struct device_node *master_np,
pci_request_acs();
err = pci_for_each_dma_alias(to_pci_dev(dev),
of_pci_iommu_init, &info);
of_pci_check_device_ats(dev, master_np);
} else {
err = of_iommu_configure_device(master_np, dev, id);
}
Expand Down

0 comments on commit 86e02a8

Please sign in to comment.