Introduce iommu_mm_data structure to keep sva information (pasid and the
related sva domains). Add iommu_mm pointer, pointing to an instance of
iommu_mm_data structure, to mm.
Signed-off-by: Tina Zhang <tina.zhang@intel.com>
---
include/linux/iommu.h | 5 +++++
include/linux/mm_types.h | 2 ++
2 files changed, 7 insertions(+)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index ab8784dfdbd98..937f3abc26f2e 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -670,6 +670,11 @@ struct iommu_sva {
struct iommu_domain *domain;
};
+struct iommu_mm_data {
+ u32 pasid;
+ struct list_head sva_domains;
+};
+
int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode,
const struct iommu_ops *ops);
void iommu_fwspec_free(struct device *dev);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 5e74ce4a28cd6..3fd65b7537f0e 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -595,6 +595,7 @@ struct mm_cid {
#endif
struct kioctx_table;
+struct iommu_mm_data;
struct mm_struct {
struct {
/*
@@ -808,6 +809,7 @@ struct mm_struct {
#ifdef CONFIG_IOMMU_SVA
u32 pasid;
+ struct iommu_mm_data *iommu_mm;
#endif
#ifdef CONFIG_KSM
/*
--
2.34.1
On 2023/8/27 16:43, Tina Zhang wrote: > Introduce iommu_mm_data structure to keep sva information (pasid and the > related sva domains). Add iommu_mm pointer, pointing to an instance of > iommu_mm_data structure, to mm. > > Signed-off-by: Tina Zhang<tina.zhang@intel.com> > --- > include/linux/iommu.h | 5 +++++ > include/linux/mm_types.h | 2 ++ > 2 files changed, 7 insertions(+) Nit: iommu also has a per-device private pointer, it's defined as struct dev_iommu and stored at dev->iommu. Is it valuable to align both? Best regards, baolu
Hi Baolu, > -----Original Message----- > From: Baolu Lu <baolu.lu@linux.intel.com> > Sent: Thursday, August 31, 2023 10:45 AM > To: Zhang, Tina <tina.zhang@intel.com>; Jason Gunthorpe <jgg@ziepe.ca>; > Tian, Kevin <kevin.tian@intel.com>; Michael Shavit <mshavit@google.com> > Cc: baolu.lu@linux.intel.com; iommu@lists.linux.dev; linux- > kernel@vger.kernel.org > Subject: Re: [PATCH v2 3/5] mm: Add structure to keep sva information > > On 2023/8/27 16:43, Tina Zhang wrote: > > Introduce iommu_mm_data structure to keep sva information (pasid and > > the related sva domains). Add iommu_mm pointer, pointing to an > > instance of iommu_mm_data structure, to mm. > > > > Signed-off-by: Tina Zhang<tina.zhang@intel.com> > > --- > > include/linux/iommu.h | 5 +++++ > > include/linux/mm_types.h | 2 ++ > > 2 files changed, 7 insertions(+) > > Nit: > > iommu also has a per-device private pointer, it's defined as struct dev_iommu > and stored at dev->iommu. Is it valuable to align both? I'm not sure if I understand the idea correctly. This struct dev_iommu is used to describe a collection per-device IOMMU data. Is the idea about migrating some bits from this struct dev_iommu to iommu_mm_data structure? Thanks, -Tina > > Best regards, > baolu
On 2023/9/1 11:36, Zhang, Tina wrote: >> -----Original Message----- >> From: Baolu Lu<baolu.lu@linux.intel.com> >> Sent: Thursday, August 31, 2023 10:45 AM >> To: Zhang, Tina<tina.zhang@intel.com>; Jason Gunthorpe<jgg@ziepe.ca>; >> Tian, Kevin<kevin.tian@intel.com>; Michael Shavit<mshavit@google.com> >> Cc:baolu.lu@linux.intel.com;iommu@lists.linux.dev; linux- >> kernel@vger.kernel.org >> Subject: Re: [PATCH v2 3/5] mm: Add structure to keep sva information >> >> On 2023/8/27 16:43, Tina Zhang wrote: >>> Introduce iommu_mm_data structure to keep sva information (pasid and >>> the related sva domains). Add iommu_mm pointer, pointing to an >>> instance of iommu_mm_data structure, to mm. >>> >>> Signed-off-by: Tina Zhang<tina.zhang@intel.com> >>> --- >>> include/linux/iommu.h | 5 +++++ >>> include/linux/mm_types.h | 2 ++ >>> 2 files changed, 7 insertions(+) >> Nit: >> >> iommu also has a per-device private pointer, it's defined as struct dev_iommu >> and stored at dev->iommu. Is it valuable to align both? > I'm not sure if I understand the idea correctly. This struct dev_iommu is used to describe a collection per-device IOMMU data. Is the idea about migrating some bits from this struct dev_iommu to iommu_mm_data structure? Never mind. I just thought about this when I was reading the patch. This does not constitute any suggestion. Best regards, baolu
© 2016 - 2025 Red Hat, Inc.