* [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain
@ 2025-12-08 9:19 Yi Liu
2025-12-08 15:50 ` kernel test robot
2025-12-12 7:57 ` Tian, Kevin
0 siblings, 2 replies; 5+ messages in thread
From: Yi Liu @ 2025-12-08 9:19 UTC (permalink / raw)
To: kevin.tian, baolu.lu; +Cc: joro, yi.l.liu, iommu, jgg
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain
2025-12-08 9:19 [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain Yi Liu
@ 2025-12-08 15:50 ` kernel test robot
2025-12-09 4:13 ` Yi Liu
2025-12-12 7:57 ` Tian, Kevin
1 sibling, 1 reply; 5+ messages in thread
From: kernel test robot @ 2025-12-08 15:50 UTC (permalink / raw)
To: Yi Liu, kevin.tian, baolu.lu; +Cc: oe-kbuild-all, joro, yi.l.liu, iommu, jgg
Hi Yi,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.18 next-20251208]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yi-Liu/iommu-vt-d-Flush-piotlb-for-SVM-and-Nested-domain/20251208-172359
base: linus/master
patch link: https://lore.kernel.org/r/20251208091907.74719-1-yi.l.liu%40intel.com
patch subject: [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20251208/202512082342.IdZjYepb-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251208/202512082342.IdZjYepb-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512082342.IdZjYepb-lkp@intel.com/
All errors (new ones prefixed by >>):
ld: vmlinux.o: in function `dmar_domain_attach_device':
>> iommu.c:(.text+0x70aa38): undefined reference to `intel_svm_domain_ops'
ld: vmlinux.o: in function `paging_domain_compatible':
>> (.text+0x70ab8f): undefined reference to `intel_svm_domain_ops'
ld: vmlinux.o: in function `intel_iommu_set_dev_pasid':
iommu.c:(.text+0x70b487): undefined reference to `intel_svm_domain_ops'
ld: vmlinux.o: in function `cache_tag_flush_iotlb':
>> cache.c:(.text+0x70e74a): undefined reference to `intel_svm_domain_ops'
ld: vmlinux.o: in function `cache_tag_flush_range_np':
(.text+0x70f2d3): undefined reference to `intel_svm_domain_ops'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain
2025-12-08 15:50 ` kernel test robot
@ 2025-12-09 4:13 ` Yi Liu
0 siblings, 0 replies; 5+ messages in thread
From: Yi Liu @ 2025-12-09 4:13 UTC (permalink / raw)
To: kernel test robot, kevin.tian, baolu.lu; +Cc: oe-kbuild-all, joro, iommu, jgg
On 2025/12/8 23:50, kernel test robot wrote:
> Hi Yi,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on linus/master]
> [also build test ERROR on v6.18 next-20251208]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Yi-Liu/iommu-vt-d-Flush-piotlb-for-SVM-and-Nested-domain/20251208-172359
> base: linus/master
> patch link: https://lore.kernel.org/r/20251208091907.74719-1-yi.l.liu%40intel.com
> patch subject: [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain
> config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20251208/202512082342.IdZjYepb-lkp@intel.com/config)
> compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251208/202512082342.IdZjYepb-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202512082342.IdZjYepb-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> ld: vmlinux.o: in function `dmar_domain_attach_device':
>>> iommu.c:(.text+0x70aa38): undefined reference to `intel_svm_domain_ops'
> ld: vmlinux.o: in function `paging_domain_compatible':
>>> (.text+0x70ab8f): undefined reference to `intel_svm_domain_ops'
> ld: vmlinux.o: in function `intel_iommu_set_dev_pasid':
> iommu.c:(.text+0x70b487): undefined reference to `intel_svm_domain_ops'
> ld: vmlinux.o: in function `cache_tag_flush_iotlb':
>>> cache.c:(.text+0x70e74a): undefined reference to `intel_svm_domain_ops'
> ld: vmlinux.o: in function `cache_tag_flush_range_np':
> (.text+0x70f2d3): undefined reference to `intel_svm_domain_ops'
>
hmmm. this happens when CONFIG_INTEL_IOMMU_SVM is not Y. will fix it
thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain
2025-12-08 9:19 [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain Yi Liu
2025-12-08 15:50 ` kernel test robot
@ 2025-12-12 7:57 ` Tian, Kevin
2025-12-12 10:49 ` Yi Liu
1 sibling, 1 reply; 5+ messages in thread
From: Tian, Kevin @ 2025-12-12 7:57 UTC (permalink / raw)
To: Liu, Yi L, baolu.lu@linux.intel.com
Cc: joro@8bytes.org, iommu@lists.linux.dev, jgg@nvidia.com
> From: Liu, Yi L <yi.l.liu@intel.com>
> Sent: Monday, December 8, 2025 5:19 PM
>
> 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);
> }
hmm it's confusing to have a _paging name covering svm/nesting type.
they are different types.
Instead it's clearer to introduce a new helper e.g. intel_domain_use_piotlb()
which covers both fs_paging, svm, and nesting types together.
and for svm/nesting just check their domain types instead of referencing
to the domain ops.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain
2025-12-12 7:57 ` Tian, Kevin
@ 2025-12-12 10:49 ` Yi Liu
0 siblings, 0 replies; 5+ messages in thread
From: Yi Liu @ 2025-12-12 10:49 UTC (permalink / raw)
To: Tian, Kevin, baolu.lu@linux.intel.com
Cc: joro@8bytes.org, iommu@lists.linux.dev, jgg@nvidia.com
On 2025/12/12 15:57, Tian, Kevin wrote:
>> From: Liu, Yi L <yi.l.liu@intel.com>
>> Sent: Monday, December 8, 2025 5:19 PM
>>
>> 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);
>> }
>
> hmm it's confusing to have a _paging name covering svm/nesting type.
got it. tbh. I had a long standing impression that paging==translation.
But I think it is incorrect.
> they are different types.
>
> Instead it's clearer to introduce a new helper e.g. intel_domain_use_piotlb()
> which covers both fs_paging, svm, and nesting types together.
>
> and for svm/nesting just check their domain types instead of referencing
> to the domain ops.
got it.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-12-12 10:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-08 9:19 [PATCH] iommu/vt-d: Flush piotlb for SVM and Nested domain Yi Liu
2025-12-08 15:50 ` kernel test robot
2025-12-09 4:13 ` Yi Liu
2025-12-12 7:57 ` Tian, Kevin
2025-12-12 10:49 ` Yi Liu
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).