提交 814b58e1 编写于 作者: J Jean-Philippe Brucker 提交者: Zheng Zengkai

PCI: Support ats-supported device-tree property

maillist inclusion
category: feature
bugzilla: 51855
CVE: NA

Reference: https://jpbrucker.net/git/linux/commit/?h=sva/2021-03-01&id=0e93ed439f6957d7ff821107c16f8dd8e7df0a2c

---------------------------------------------

Device-tree declare 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.
Signed-off-by: NJean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: NLijun Fang <fanglijun3@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 415ccda7
...@@ -175,6 +175,14 @@ static int of_iommu_configure_device(struct device_node *master_np, ...@@ -175,6 +175,14 @@ static int of_iommu_configure_device(struct device_node *master_np,
of_iommu_configure_dev(master_np, dev); 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;
}
const struct iommu_ops *of_iommu_configure(struct device *dev, const struct iommu_ops *of_iommu_configure(struct device *dev,
struct device_node *master_np, struct device_node *master_np,
const u32 *id) const u32 *id)
...@@ -208,6 +216,8 @@ const struct iommu_ops *of_iommu_configure(struct device *dev, ...@@ -208,6 +216,8 @@ const struct iommu_ops *of_iommu_configure(struct device *dev,
pci_request_acs(); pci_request_acs();
err = pci_for_each_dma_alias(to_pci_dev(dev), err = pci_for_each_dma_alias(to_pci_dev(dev),
of_pci_iommu_init, &info); of_pci_iommu_init, &info);
of_pci_check_device_ats(dev, master_np);
} else { } else {
err = of_iommu_configure_device(master_np, dev, id); err = of_iommu_configure_device(master_np, dev, id);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册