From: Vasant Hegde <vasant.hegde@amd.com>
To: <iommu@lists.linux.dev>, <joro@8bytes.org>
Cc: <will@kernel.org>, <robin.murphy@arm.com>,
<suravee.suthikulpanit@amd.com>, <jgg@nvidia.com>,
Santosh Shukla <santosh.shukla@amd.com>, <stable@vger.kernel.org>,
Vasant Hegde <vasant.hegde@amd.com>
Subject: [PATCH v2 04/12] iommu/amd: Restore an SVA PASID after PCI reset
Date: Fri, 27 Nov 2026 11:54:39 +0000 [thread overview]
Message-ID: <20261127115447.209792-5-vasant.hegde@amd.com> (raw)
In-Reply-To: <20261127115447.209792-1-vasant.hegde@amd.com>
From: Santosh Shukla <santosh.shukla@amd.com>
pci_dev_reset_iommu_done() re-attaches every PASID with old set to the
group's blocking domain. iommu_sva_set_dev_pasid() rejects any old
domain, so the core warns and the PASID stays unprogrammed until the
device is unbound.
prepare() has already cleared the GCR3 entry and dropped the SVA
tracking record. A blocking old domain is therefore a fresh attach.
Replacing one attached domain with another still returns -EOPNOTSUPP.
Fixes: c279e83953d9 ("iommu: Introduce pci_dev_reset_iommu_prepare/done()")
Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
Cc: stable@vger.kernel.org
[Updated description - Vasant]
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
---
drivers/iommu/amd/pasid.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/amd/pasid.c b/drivers/iommu/amd/pasid.c
index 40be5902087c..87fd2688574c 100644
--- a/drivers/iommu/amd/pasid.c
+++ b/drivers/iommu/amd/pasid.c
@@ -109,7 +109,12 @@ static int iommu_sva_set_dev_pasid(struct iommu_domain *domain,
unsigned long flags;
int ret = -EINVAL;
- if (old)
+ /*
+ * pci_dev_reset_iommu_done() passes the blocking domain. prepare()
+ * has already cleared this PASID, so program it again. Replacing
+ * one attached domain with another is not supported.
+ */
+ if (old && old->type != IOMMU_DOMAIN_BLOCKED)
return -EOPNOTSUPP;
/* PASID zero is used for requests from the I/O device without PASID */
--
2.31.1
next parent reply other threads:[~2026-11-27 11:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20261127115447.209792-1-vasant.hegde@amd.com>
2026-11-27 11:54 ` Vasant Hegde [this message]
2026-11-27 11:54 ` [PATCH v2 05/12] iommu/amd: Keep the GCR3 table while PASIDs are attached Vasant Hegde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127115447.209792-5-vasant.hegde@amd.com \
--to=vasant.hegde@amd.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=robin.murphy@arm.com \
--cc=santosh.shukla@amd.com \
--cc=stable@vger.kernel.org \
--cc=suravee.suthikulpanit@amd.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox