Skip to content

Commit a86fb77

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Allow SVA with device-specific IOPF
Currently enabling SVA requires IOPF support from the IOMMU and device PCI PRI. However, some devices can handle IOPF by itself without ever sending PCI page requests nor advertising PRI capability. Allow SVA support with IOPF handled either by IOMMU (PCI PRI) or device driver (device-specific IOPF). As long as IOPF could be handled, SVA should continue to work. Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/20230324120234.313643-3-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 84c9ef7 commit a86fb77

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

drivers/iommu/intel/iommu.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4650,7 +4650,21 @@ static int intel_iommu_enable_sva(struct device *dev)
46504650
if (!(iommu->flags & VTD_FLAG_SVM_CAPABLE))
46514651
return -ENODEV;
46524652

4653-
if (!info->pasid_enabled || !info->pri_enabled || !info->ats_enabled)
4653+
if (!info->pasid_enabled || !info->ats_enabled)
4654+
return -EINVAL;
4655+
4656+
/*
4657+
* Devices having device-specific I/O fault handling should not
4658+
* support PCI/PRI. The IOMMU side has no means to check the
4659+
* capability of device-specific IOPF. Therefore, IOMMU can only
4660+
* default that if the device driver enables SVA on a non-PRI
4661+
* device, it will handle IOPF in its own way.
4662+
*/
4663+
if (!info->pri_supported)
4664+
return 0;
4665+
4666+
/* Devices supporting PRI should have it enabled. */
4667+
if (!info->pri_enabled)
46544668
return -EINVAL;
46554669

46564670
ret = iopf_queue_add_device(iommu->iopf_queue, dev);

0 commit comments

Comments
 (0)