public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] iommu/vt-d: Only handle IOPF for SVA when PRI is supported
@ 2026-03-10  7:55 Lu Baolu
  2026-03-16  1:10 ` Tian, Kevin
  2026-03-17  1:08 ` Baolu Lu
  0 siblings, 2 replies; 3+ messages in thread
From: Lu Baolu @ 2026-03-10  7:55 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian,
	Jason Gunthorpe
  Cc: iommu, linux-kernel, Lu Baolu, stable

In intel_svm_set_dev_pasid(), the driver unconditionally manages the IOPF
handling during a domain transition. However, commit a86fb7717320
("iommu/vt-d: Allow SVA with device-specific IOPF") introduced support for
SVA on devices that handle page faults internally without utilizing the
PCI PRI. On such devices, the IOMMU-side IOPF infrastructure is not
required. Calling iopf_for_domain_replace() on these devices is incorrect
and can lead to unexpected failures during PASID attachment or unwinding.

Add a check for info->pri_supported to ensure that the IOPF queue logic
is only invoked for devices that actually rely on the IOMMU's PRI-based
fault handling.

Fixes: 17fce9d2336d ("iommu/vt-d: Put iopf enablement in domain attach path")
Cc: stable@vger.kernel.org
Suggested-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel/svm.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index fea10acd4f02..57cd1db7207a 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -164,9 +164,12 @@ static int intel_svm_set_dev_pasid(struct iommu_domain *domain,
 	if (IS_ERR(dev_pasid))
 		return PTR_ERR(dev_pasid);
 
-	ret = iopf_for_domain_replace(domain, old, dev);
-	if (ret)
-		goto out_remove_dev_pasid;
+	/* SVA with non-IOMMU/PRI IOPF handling is allowed. */
+	if (info->pri_supported) {
+		ret = iopf_for_domain_replace(domain, old, dev);
+		if (ret)
+			goto out_remove_dev_pasid;
+	}
 
 	/* Setup the pasid table: */
 	sflags = cpu_feature_enabled(X86_FEATURE_LA57) ? PASID_FLAG_FL5LP : 0;
@@ -181,7 +184,8 @@ static int intel_svm_set_dev_pasid(struct iommu_domain *domain,
 
 	return 0;
 out_unwind_iopf:
-	iopf_for_domain_replace(old, domain, dev);
+	if (info->pri_supported)
+		iopf_for_domain_replace(old, domain, dev);
 out_remove_dev_pasid:
 	domain_remove_dev_pasid(domain, dev, pasid);
 	return ret;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH 1/1] iommu/vt-d: Only handle IOPF for SVA when PRI is supported
  2026-03-10  7:55 [PATCH 1/1] iommu/vt-d: Only handle IOPF for SVA when PRI is supported Lu Baolu
@ 2026-03-16  1:10 ` Tian, Kevin
  2026-03-17  1:08 ` Baolu Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Tian, Kevin @ 2026-03-16  1:10 UTC (permalink / raw)
  To: Lu Baolu, Joerg Roedel, Will Deacon, Robin Murphy,
	Jason Gunthorpe
  Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org

> From: Lu Baolu <baolu.lu@linux.intel.com>
> Sent: Tuesday, March 10, 2026 3:55 PM
> 
> In intel_svm_set_dev_pasid(), the driver unconditionally manages the IOPF
> handling during a domain transition. However, commit a86fb7717320
> ("iommu/vt-d: Allow SVA with device-specific IOPF") introduced support for
> SVA on devices that handle page faults internally without utilizing the
> PCI PRI. On such devices, the IOMMU-side IOPF infrastructure is not
> required. Calling iopf_for_domain_replace() on these devices is incorrect
> and can lead to unexpected failures during PASID attachment or unwinding.
> 
> Add a check for info->pri_supported to ensure that the IOPF queue logic
> is only invoked for devices that actually rely on the IOMMU's PRI-based
> fault handling.
> 
> Fixes: 17fce9d2336d ("iommu/vt-d: Put iopf enablement in domain attach
> path")
> Cc: stable@vger.kernel.org
> Suggested-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] iommu/vt-d: Only handle IOPF for SVA when PRI is supported
  2026-03-10  7:55 [PATCH 1/1] iommu/vt-d: Only handle IOPF for SVA when PRI is supported Lu Baolu
  2026-03-16  1:10 ` Tian, Kevin
@ 2026-03-17  1:08 ` Baolu Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Baolu Lu @ 2026-03-17  1:08 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Robin Murphy, Kevin Tian,
	Jason Gunthorpe
  Cc: baolu.lu, iommu, linux-kernel, stable

On 3/10/2026 3:55 PM, Lu Baolu wrote:
> In intel_svm_set_dev_pasid(), the driver unconditionally manages the IOPF
> handling during a domain transition. However, commit a86fb7717320
> ("iommu/vt-d: Allow SVA with device-specific IOPF") introduced support for
> SVA on devices that handle page faults internally without utilizing the
> PCI PRI. On such devices, the IOMMU-side IOPF infrastructure is not
> required. Calling iopf_for_domain_replace() on these devices is incorrect
> and can lead to unexpected failures during PASID attachment or unwinding.
> 
> Add a check for info->pri_supported to ensure that the IOPF queue logic
> is only invoked for devices that actually rely on the IOMMU's PRI-based
> fault handling.
> 
> Fixes: 17fce9d2336d ("iommu/vt-d: Put iopf enablement in domain attach path")
> Cc:stable@vger.kernel.org
> Suggested-by: Kevin Tian<kevin.tian@intel.com>
> Signed-off-by: Lu Baolu<baolu.lu@linux.intel.com>
> ---
>   drivers/iommu/intel/svm.c | 12 ++++++++----
>   1 file changed, 8 insertions(+), 4 deletions(-)

Queued for v7.0-rc.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-17  1:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10  7:55 [PATCH 1/1] iommu/vt-d: Only handle IOPF for SVA when PRI is supported Lu Baolu
2026-03-16  1:10 ` Tian, Kevin
2026-03-17  1:08 ` Baolu Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox