[PATCH 03/42][SRU][U] UBUNTU: SAUCE: iommu/amd: Implement iommu_ops->def_domain_type call-back
You-Sheng Yang
vicamo.yang at canonical.com
Tue May 26 12:59:15 UTC 2020
From: Joerg Roedel <jroedel at suse.de>
BugLink: https://bugs.launchpad.net/bugs/1876707
Implement the new def_domain_type call-back for the AMD IOMMU driver.
Signed-off-by: Joerg Roedel <jroedel at suse.de>
Link: https://lore.kernel.org/r/20200429133712.31431-4-joro@8bytes.org
Signed-off-by: Joerg Roedel <jroedel at suse.de>
(cherry picked from commit bdf4a7c4c77dcb91bd64b53b70d9faf3184e88d8
iommu/next)
Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
---
drivers/iommu/amd_iommu.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 1dc3718560d0..ff862d524f79 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2757,6 +2757,20 @@ static void amd_iommu_iotlb_sync(struct iommu_domain *domain,
amd_iommu_flush_iotlb_all(domain);
}
+static int amd_iommu_def_domain_type(struct device *dev)
+{
+ struct iommu_dev_data *dev_data;
+
+ dev_data = get_dev_data(dev);
+ if (!dev_data)
+ return 0;
+
+ if (dev_data->iommu_v2)
+ return IOMMU_DOMAIN_IDENTITY;
+
+ return 0;
+}
+
const struct iommu_ops amd_iommu_ops = {
.capable = amd_iommu_capable,
.domain_alloc = amd_iommu_domain_alloc,
@@ -2776,6 +2790,7 @@ const struct iommu_ops amd_iommu_ops = {
.pgsize_bitmap = AMD_IOMMU_PGSIZES,
.flush_iotlb_all = amd_iommu_flush_iotlb_all,
.iotlb_sync = amd_iommu_iotlb_sync,
+ .def_domain_type = amd_iommu_def_domain_type,
};
/*****************************************************************************
--
2.25.1
More information about the kernel-team
mailing list