[RFC,4/6] mm: Add iommu_mm field to mm_struct

Message ID 20230707013441.365583-5-tina.zhang@intel.com
State New
Headers
Series Share sva domain with all devices bound to a mm |

Commit Message

Zhang, Tina July 7, 2023, 1:34 a.m. UTC
  The iommu_mm field has all the information needed for managing sva domain
1:1 with mm pasid. Add it to the mm_struct as the sva-related field and
use default_iommu_mm to initialize init_mm pasid.

Signed-off-by: Tina Zhang <tina.zhang@intel.com>
---
 include/linux/mm_types.h | 2 ++
 mm/init-mm.c             | 1 +
 2 files changed, 3 insertions(+)
  

Patch

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 306a3d1a0fa65..bb00caa078335 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -581,6 +581,7 @@  struct mm_cid {
 #endif
 
 struct kioctx_table;
+struct iommu_mm_data;
 struct mm_struct {
 	struct {
 		struct maple_tree mm_mt;
@@ -773,6 +774,7 @@  struct mm_struct {
 
 #ifdef CONFIG_IOMMU_SVA
 		u32 pasid;
+		struct iommu_mm_data *iommu_mm;
 #endif
 #ifdef CONFIG_KSM
 		/*
diff --git a/mm/init-mm.c b/mm/init-mm.c
index efa97b57acfd8..c43b7d0347312 100644
--- a/mm/init-mm.c
+++ b/mm/init-mm.c
@@ -44,6 +44,7 @@  struct mm_struct init_mm = {
 	.cpu_bitmap	= CPU_BITS_NONE,
 #ifdef CONFIG_IOMMU_SVA
 	.pasid		= IOMMU_PASID_INVALID,
+	.iommu_mm       = &default_iommu_mm,
 #endif
 	INIT_MM_CONTEXT(init_mm)
 };