diff options
author | Lu Baolu <baolu.lu@linux.intel.com> | 2019-05-25 01:41:31 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2019-05-28 04:19:10 -0400 |
commit | fa212a97f3a366adcb2046c565e7c978ab067c73 (patch) | |
tree | bcd868e9d2fec6cc60686177ac4d10f8ab1b887a /drivers/iommu/intel-iommu.c | |
parent | 98b2fffb5e274d73e47d495da2caf213cfa28fc8 (diff) |
iommu/vt-d: Probe DMA-capable ACPI name space devices
Some platforms may support ACPI name-space enumerated devices
that are capable of generating DMA requests. Platforms which
support DMA remapping explicitly declares any such DMA-capable
ACPI name-space devices in the platform through ACPI Name-space
Device Declaration (ANDD) structure and enumerate them through
the Device Scope of the appropriate remapping hardware unit.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r-- | drivers/iommu/intel-iommu.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 87f9f2237238..0bae0b73076c 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -4796,6 +4796,48 @@ static int __init platform_optin_force_iommu(void) | |||
4796 | return 1; | 4796 | return 1; |
4797 | } | 4797 | } |
4798 | 4798 | ||
4799 | static int __init probe_acpi_namespace_devices(void) | ||
4800 | { | ||
4801 | struct dmar_drhd_unit *drhd; | ||
4802 | struct intel_iommu *iommu; | ||
4803 | struct device *dev; | ||
4804 | int i, ret = 0; | ||
4805 | |||
4806 | for_each_active_iommu(iommu, drhd) { | ||
4807 | for_each_active_dev_scope(drhd->devices, | ||
4808 | drhd->devices_cnt, i, dev) { | ||
4809 | struct acpi_device_physical_node *pn; | ||
4810 | struct iommu_group *group; | ||
4811 | struct acpi_device *adev; | ||
4812 | |||
4813 | if (dev->bus != &acpi_bus_type) | ||
4814 | continue; | ||
4815 | |||
4816 | adev = to_acpi_device(dev); | ||
4817 | mutex_lock(&adev->physical_node_lock); | ||
4818 | list_for_each_entry(pn, | ||
4819 | &adev->physical_node_list, node) { | ||
4820 | group = iommu_group_get(pn->dev); | ||
4821 | if (group) { | ||
4822 | iommu_group_put(group); | ||
4823 | continue; | ||
4824 | } | ||
4825 | |||
4826 | pn->dev->bus->iommu_ops = &intel_iommu_ops; | ||
4827 | ret = iommu_probe_device(pn->dev); | ||
4828 | if (ret) | ||
4829 | break; | ||
4830 | } | ||
4831 | mutex_unlock(&adev->physical_node_lock); | ||
4832 | |||
4833 | if (ret) | ||
4834 | return ret; | ||
4835 | } | ||
4836 | } | ||
4837 | |||
4838 | return 0; | ||
4839 | } | ||
4840 | |||
4799 | int __init intel_iommu_init(void) | 4841 | int __init intel_iommu_init(void) |
4800 | { | 4842 | { |
4801 | int ret = -ENODEV; | 4843 | int ret = -ENODEV; |
@@ -4908,6 +4950,9 @@ int __init intel_iommu_init(void) | |||
4908 | cpuhp_setup_state(CPUHP_IOMMU_INTEL_DEAD, "iommu/intel:dead", NULL, | 4950 | cpuhp_setup_state(CPUHP_IOMMU_INTEL_DEAD, "iommu/intel:dead", NULL, |
4909 | intel_iommu_cpu_dead); | 4951 | intel_iommu_cpu_dead); |
4910 | 4952 | ||
4953 | if (probe_acpi_namespace_devices()) | ||
4954 | pr_warn("ACPI name space devices didn't probe correctly\n"); | ||
4955 | |||
4911 | /* Finally, we enable the DMA remapping hardware. */ | 4956 | /* Finally, we enable the DMA remapping hardware. */ |
4912 | for_each_iommu(iommu, drhd) { | 4957 | for_each_iommu(iommu, drhd) { |
4913 | if (!translation_pre_enabled(iommu)) | 4958 | if (!translation_pre_enabled(iommu)) |