Skip to content

Commit 86e02a8

Browse files
jpbruckerwilldeacon
authored andcommitted
iommu/of: Support ats-supported device-tree property
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 <ketanp@nvidia.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> Link: https://lore.kernel.org/r/20240607105415.2501934-4-jean-philippe@linaro.org Signed-off-by: Will Deacon <will@kernel.org>
1 parent 40929e8 commit 86e02a8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/iommu/of_iommu.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ static int of_iommu_configure_device(struct device_node *master_np,
105105
of_iommu_configure_dev(master_np, dev);
106106
}
107107

108+
static void of_pci_check_device_ats(struct device *dev, struct device_node *np)
109+
{
110+
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
111+
112+
if (fwspec && of_property_read_bool(np, "ats-supported"))
113+
fwspec->flags |= IOMMU_FWSPEC_PCI_RC_ATS;
114+
}
115+
108116
/*
109117
* Returns:
110118
* 0 on success, an iommu was configured
@@ -147,6 +155,7 @@ int of_iommu_configure(struct device *dev, struct device_node *master_np,
147155
pci_request_acs();
148156
err = pci_for_each_dma_alias(to_pci_dev(dev),
149157
of_pci_iommu_init, &info);
158+
of_pci_check_device_ats(dev, master_np);
150159
} else {
151160
err = of_iommu_configure_device(master_np, dev, id);
152161
}

0 commit comments

Comments
 (0)