Skip to content

Commit 9003351

Browse files
jpbruckerjoergroedel
authored andcommitted
iommu/vt-d: Support IOMMU_DEV_FEAT_IOPF
Allow drivers to query and enable IOMMU_DEV_FEAT_IOPF, which amounts to checking whether PRI is enabled. Reviewed-by: Lu Baolu <[email protected]> Signed-off-by: Jean-Philippe Brucker <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 34b48c7 commit 9003351

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5311,6 +5311,8 @@ static int siov_find_pci_dvsec(struct pci_dev *pdev)
53115311
static bool
53125312
intel_iommu_dev_has_feat(struct device *dev, enum iommu_dev_features feat)
53135313
{
5314+
struct device_domain_info *info = get_domain_info(dev);
5315+
53145316
if (feat == IOMMU_DEV_FEAT_AUX) {
53155317
int ret;
53165318

@@ -5325,13 +5327,13 @@ intel_iommu_dev_has_feat(struct device *dev, enum iommu_dev_features feat)
53255327
return !!siov_find_pci_dvsec(to_pci_dev(dev));
53265328
}
53275329

5328-
if (feat == IOMMU_DEV_FEAT_SVA) {
5329-
struct device_domain_info *info = get_domain_info(dev);
5330+
if (feat == IOMMU_DEV_FEAT_IOPF)
5331+
return info && info->pri_supported;
53305332

5333+
if (feat == IOMMU_DEV_FEAT_SVA)
53315334
return info && (info->iommu->flags & VTD_FLAG_SVM_CAPABLE) &&
53325335
info->pasid_supported && info->pri_supported &&
53335336
info->ats_supported;
5334-
}
53355337

53365338
return false;
53375339
}
@@ -5342,6 +5344,9 @@ intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat)
53425344
if (feat == IOMMU_DEV_FEAT_AUX)
53435345
return intel_iommu_enable_auxd(dev);
53445346

5347+
if (feat == IOMMU_DEV_FEAT_IOPF)
5348+
return intel_iommu_dev_has_feat(dev, feat) ? 0 : -ENODEV;
5349+
53455350
if (feat == IOMMU_DEV_FEAT_SVA) {
53465351
struct device_domain_info *info = get_domain_info(dev);
53475352

0 commit comments

Comments
 (0)