]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iommu/vt-d: Draining PRQ in sva unbind path when FPD bit set
authorLu Baolu <baolu.lu@linux.intel.com>
Tue, 7 Jan 2025 02:17:45 +0000 (10:17 +0800)
committerJoerg Roedel <jroedel@suse.de>
Tue, 7 Jan 2025 08:30:52 +0000 (09:30 +0100)
commitcf08ca81d08a04b3b304e8fb4e052f323a09783d
tree52d42ec1d8f3dbec1b1e6496414594076f53c1ff
parentc2206299401b23bed9ef87f561d6f85f9351aa84
iommu/vt-d: Draining PRQ in sva unbind path when FPD bit set

When a device uses a PASID for SVA (Shared Virtual Address), it's possible
that the PASID entry is marked as non-present and FPD bit set before the
device flushes all ongoing DMA requests and removes the SVA domain. This
can occur when an exception happens and the process terminates before the
device driver stops DMA and calls the iommu driver to unbind the PASID.

There's no need to drain the PRQ in the mm release path. Instead, the PRQ
will be drained in the SVA unbind path. But in such case,
intel_pasid_tear_down_entry() only checks the presence of the pasid entry
and returns directly.

Add the code to clear the FPD bit and drain the PRQ.

Fixes: c43e1ccdebf2 ("iommu/vt-d: Drain PRQs when domain removed from RID")
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>
Link: https://lore.kernel.org/r/20241217024240.139615-1-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel/pasid.c
drivers/iommu/intel/pasid.h