Skip to content

Commit 76fdd6c

Browse files
Jacob Panjoergroedel
authored andcommitted
iommu/vt-d: Report SVA feature with generic flag
Query Shared Virtual Address/Memory capability is a generic feature. SVA feature check is the required first step before calling iommu_sva_bind_device(). VT-d checks SVA feature enabling at per IOMMU level during this step, SVA bind device will check and enable PCI ATS, PRS, and PASID capabilities at device level. This patch reports Intel SVM as SVA feature such that generic code (e.g. Uacce [1]) can use it. [1] https://lkml.org/lkml/2020/1/15/604 Signed-off-by: Jacob Pan <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent e85bb99 commit 76fdd6c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5944,6 +5944,14 @@ intel_iommu_dev_has_feat(struct device *dev, enum iommu_dev_features feat)
59445944
return !!siov_find_pci_dvsec(to_pci_dev(dev));
59455945
}
59465946

5947+
if (feat == IOMMU_DEV_FEAT_SVA) {
5948+
struct device_domain_info *info = get_domain_info(dev);
5949+
5950+
return info && (info->iommu->flags & VTD_FLAG_SVM_CAPABLE) &&
5951+
info->pasid_supported && info->pri_supported &&
5952+
info->ats_supported;
5953+
}
5954+
59475955
return false;
59485956
}
59495957

@@ -5953,6 +5961,16 @@ intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat)
59535961
if (feat == IOMMU_DEV_FEAT_AUX)
59545962
return intel_iommu_enable_auxd(dev);
59555963

5964+
if (feat == IOMMU_DEV_FEAT_SVA) {
5965+
struct device_domain_info *info = get_domain_info(dev);
5966+
5967+
if (!info)
5968+
return -EINVAL;
5969+
5970+
if (info->iommu->flags & VTD_FLAG_SVM_CAPABLE)
5971+
return 0;
5972+
}
5973+
59565974
return -ENODEV;
59575975
}
59585976

0 commit comments

Comments
 (0)