From: Yi Liu <yi.l.liu@intel.com>
To: kevin.tian@intel.com, baolu.lu@linux.intel.com
Cc: joro@8bytes.org, yi.l.liu@intel.com, iommu@lists.linux.dev,
jgg@nvidia.com
Subject: [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain
Date: Mon, 8 Dec 2025 01:19:07 -0800 [thread overview]
Message-ID: <20251208091907.74719-1-yi.l.liu@intel.com> (raw)
For SVM and Nested domain, needs to use piotlb invalidation descriptor.
Fixes: b33125296b50 ("iommu/vt-d: Create unique domain ops for each stage")
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
---
drivers/iommu/intel/cache.c | 3 ++-
drivers/iommu/intel/iommu.h | 10 +++++++++-
drivers/iommu/intel/nested.c | 2 +-
drivers/iommu/intel/svm.c | 2 +-
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/iommu/intel/cache.c b/drivers/iommu/intel/cache.c
index 265e7290256b..bf6ebf7c4ca5 100644
--- a/drivers/iommu/intel/cache.c
+++ b/drivers/iommu/intel/cache.c
@@ -370,7 +370,8 @@ static void cache_tag_flush_iotlb(struct dmar_domain *domain, struct cache_tag *
struct intel_iommu *iommu = tag->iommu;
u64 type = DMA_TLB_PSI_FLUSH;
- if (intel_domain_is_fs_paging(domain)) {
+ if (intel_domain_is_fs_paging(domain) ||
+ intel_domain_is_nested_paging(domain)) {
qi_batch_add_piotlb(iommu, tag->domain_id, tag->pasid, addr,
pages, ih, domain->qi_batch);
return;
diff --git a/drivers/iommu/intel/iommu.h b/drivers/iommu/intel/iommu.h
index 3056583d7f56..3b655af211a9 100644
--- a/drivers/iommu/intel/iommu.h
+++ b/drivers/iommu/intel/iommu.h
@@ -1379,10 +1379,18 @@ struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
extern const struct iommu_ops intel_iommu_ops;
extern const struct iommu_domain_ops intel_fs_paging_domain_ops;
extern const struct iommu_domain_ops intel_ss_paging_domain_ops;
+extern const struct iommu_domain_ops intel_svm_domain_ops;
+extern const struct iommu_domain_ops intel_nested_domain_ops;
static inline bool intel_domain_is_fs_paging(struct dmar_domain *domain)
{
- return domain->domain.ops == &intel_fs_paging_domain_ops;
+ return (domain->domain.ops == &intel_fs_paging_domain_ops) ||
+ (domain->domain.ops == &intel_svm_domain_ops);
+}
+
+static inline bool intel_domain_is_nested_paging(struct dmar_domain *domain)
+{
+ return (domain->domain.ops == &intel_nested_domain_ops);
}
static inline bool intel_domain_is_ss_paging(struct dmar_domain *domain)
diff --git a/drivers/iommu/intel/nested.c b/drivers/iommu/intel/nested.c
index 1b6ad9c900a5..cc755af1bd6b 100644
--- a/drivers/iommu/intel/nested.c
+++ b/drivers/iommu/intel/nested.c
@@ -191,7 +191,7 @@ static int intel_nested_set_dev_pasid(struct iommu_domain *domain,
return ret;
}
-static const struct iommu_domain_ops intel_nested_domain_ops = {
+const struct iommu_domain_ops intel_nested_domain_ops = {
.attach_dev = intel_nested_attach_dev,
.set_dev_pasid = intel_nested_set_dev_pasid,
.free = intel_nested_domain_free,
diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index e147f71f91b7..75b9475c33dd 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -194,7 +194,7 @@ static void intel_svm_domain_free(struct iommu_domain *domain)
mmu_notifier_put(&dmar_domain->notifier);
}
-static const struct iommu_domain_ops intel_svm_domain_ops = {
+const struct iommu_domain_ops intel_svm_domain_ops = {
.set_dev_pasid = intel_svm_set_dev_pasid,
.free = intel_svm_domain_free
};
--
2.34.1
next reply other threads:[~2025-12-08 9:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 9:19 Yi Liu [this message]
2025-12-08 15:50 ` [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain kernel test robot
2025-12-09 4:13 ` Yi Liu
2025-12-12 7:57 ` Tian, Kevin
2025-12-12 10:49 ` Yi Liu
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=20251208091907.74719-1-yi.l.liu@intel.com \
--to=yi.l.liu@intel.com \
--cc=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).