Skip to content

Commit 9e964dd

Browse files
committed
iommu/vt-d: Make intel_iommu_drain_pasid_prq() cover faults for RID
JIRA: https://issues.redhat.com/browse/RHEL-78704 Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit add43c4 Author: Lu Baolu <baolu.lu@linux.intel.com> Date: Tue Feb 11 08:55:12 2025 +0800 iommu/vt-d: Make intel_iommu_drain_pasid_prq() cover faults for RID This driver supports page faults on PCI RID since commit <9f831c16c69e> ("iommu/vt-d: Remove the pasid present check in prq_event_thread") by allowing the reporting of page faults with the pasid_present field cleared to the upper layer for further handling. The fundamental assumption here is that the detach or replace operations act as a fence for page faults. This implies that all pending page faults associated with a specific RID or PASID are flushed when a domain is detached or replaced from a device RID or PASID. However, the intel_iommu_drain_pasid_prq() helper does not correctly handle faults for RID. This leads to faults potentially remaining pending in the iommu hardware queue even after the domain is detached, thereby violating the aforementioned assumption. Fix this issue by extending intel_iommu_drain_pasid_prq() to cover faults for RID. Fixes: 9f831c1 ("iommu/vt-d: Remove the pasid present check in prq_event_thread") 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> Link: https://lore.kernel.org/r/20250121023150.815972-1-baolu.lu@linux.intel.com Reviewed-by: Yi Liu <yi.l.liu@intel.com> Link: https://lore.kernel.org/r/20250211005512.985563-2-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de> (cherry picked from commit add43c4) Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
1 parent 853784c commit 9e964dd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/iommu/intel/prq.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ void intel_iommu_drain_pasid_prq(struct device *dev, u32 pasid)
8787
struct page_req_dsc *req;
8888

8989
req = &iommu->prq[head / sizeof(*req)];
90-
if (!req->pasid_present || req->pasid != pasid) {
90+
if (req->rid != sid ||
91+
(req->pasid_present && pasid != req->pasid) ||
92+
(!req->pasid_present && pasid != IOMMU_NO_PASID)) {
9193
head = (head + sizeof(*req)) & PRQ_RING_MASK;
9294
continue;
9395
}

0 commit comments

Comments
 (0)