public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] iommu/vt-d: Fix RID2PASID setup failure
@ 2022-06-20  8:17 Lu Baolu
  2022-06-20  8:31 ` Yi Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Lu Baolu @ 2022-06-20  8:17 UTC (permalink / raw)
  To: Joerg Roedel, Kevin Tian, Ashok Raj
  Cc: Chenyi Qiang, Liu Yi L, Jacob jun Pan, iommu, linux-kernel,
	Lu Baolu, stable

The IOMMU driver shares the pasid table for PCI alias devices. When the
RID2PASID entry of the shared pasid table has been filled by the first
device, the subsequent devices will encounter the "DMAR: Setup RID2PASID
failed" failure as the pasid entry has already been marke as present. As
the result, the IOMMU probing process will be aborted.

This fixes it by skipping RID2PASID setting if the pasid entry has been
populated. This works because the IOMMU core ensures that only the same
IOMMU domain can be attached to all PCI alias devices at the same time.
Therefore the subsequent devices just try to setup the RID2PASID entry
with the same domain, which is negligible.

Fixes: ef848b7e5a6a0 ("iommu/vt-d: Setup pasid entry for RID2PASID support")
Reported-by: Chenyi Qiang <chenyi.qiang@intel.com>
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 44016594831d..b9966c01a2a2 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2564,7 +2564,7 @@ static int domain_add_dev_info(struct dmar_domain *domain, struct device *dev)
 			ret = intel_pasid_setup_second_level(iommu, domain,
 					dev, PASID_RID2PASID);
 		spin_unlock_irqrestore(&iommu->lock, flags);
-		if (ret) {
+		if (ret && ret != -EBUSY) {
 			dev_err(dev, "Setup RID2PASID failed\n");
 			dmar_remove_one_dev_info(dev);
 			return ret;
-- 
2.25.1


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

end of thread, other threads:[~2022-06-22  4:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-20  8:17 [PATCH 1/1] iommu/vt-d: Fix RID2PASID setup failure Lu Baolu
2022-06-20  8:31 ` Yi Liu
2022-06-20  8:57   ` Baolu Lu
2022-06-21  2:54 ` Tian, Kevin
2022-06-21  3:39   ` Baolu Lu
2022-06-21  3:46     ` Tian, Kevin
2022-06-21  4:28       ` Baolu Lu
2022-06-21  5:48         ` Tian, Kevin
2022-06-21  6:15           ` Baolu Lu
2022-06-21  9:03           ` Baolu Lu
2022-06-22  3:06             ` Tian, Kevin
2022-06-22  3:27               ` Baolu Lu
2022-06-22  3:31                 ` Tian, Kevin
2022-06-22  4:39                   ` Baolu Lu
     [not found] ` <30d27b02-0fec-d595-75a0-155eee1c84d6@linux.intel.com>
2022-06-22  3:22   ` Baolu Lu

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