* [PATCH 1/1] iommu/vt-d: Block translation before removing IOPF in blocking attach
@ 2026-11-23 0:43 Lu Baolu
0 siblings, 0 replies; only message in thread
From: Lu Baolu @ 2026-11-23 0:43 UTC (permalink / raw)
To: iommu; +Cc: Kevin Tian, linux-kernel, Lu Baolu, stable
blocking_domain_attach_dev() drops the old domain's IOPF reference before
it calls device_block_translation(). When that is the last reference,
intel_iommu_disable_iopf() calls iopf_queue_remove_device() while the RID
still translates through the old domain and its page requests are still
being reported. This is wrong in two ways:
- iopf_queue_remove_device() requires that no iommu_report_device_fault()
is still running for the device. A report can have linked its group
into the pending list without having called the iopf_handler yet;
iopf_queue_remove_device() then responds to and frees that group, and
the reporter hands the freed group to the handler.
- With iopf_refcount already zero, the drain in
device_block_translation() -> intel_pasid_tear_down_entry() ->
intel_iommu_drain_pasid_prq() returns early, so the PRQ for the RID is
never drained on this path at all.
The removal was placed first by commit 17fce9d2336d ("iommu/vt-d: Put
iopf enablement in domain attach path") because the old domain was then
taken from info->domain, which device_block_translation() clears.
Commit 91b55eb171cb ("iommu/vt-d: Use old domain parameter when attaching
the blocking domain") switched to the @old parameter, so the order can now
be swapped. Backports need that commit as well.
Fixes: 17fce9d2336d ("iommu/vt-d: Put iopf enablement in domain attach path")
Cc: stable@vger.kernel.org
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/intel/iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 5a2e705a2f2e..a8c0ccae844e 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2897,8 +2897,8 @@ static int blocking_domain_attach_dev(struct iommu_domain *domain,
struct device *dev,
struct iommu_domain *old)
{
- iopf_for_domain_remove(old, dev);
device_block_translation(dev);
+ iopf_for_domain_remove(old, dev);
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-23 0:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 0:43 [PATCH 1/1] iommu/vt-d: Block translation before removing IOPF in blocking attach Lu Baolu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.