[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231017032045.114868-4-tina.zhang@intel.com>
Date: Tue, 17 Oct 2023 11:20:35 +0800
From: Tina Zhang <tina.zhang@...el.com>
To: iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: David Woodhouse <dwmw2@...radead.org>,
Lu Baolu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>, Jason Gunthorpe <jgg@...pe.ca>,
Kevin Tian <kevin.tian@...el.com>,
Tina Zhang <tina.zhang@...el.com>
Subject: [RFC PATCH 03/12] iommu/vt-d: Retire intel_svm_bind_mm()
Refactor intel_svm_set_dev_pasid() by moving the logic from
intel_svm_bind_mm() into intel_svm_set_dev_pasid() and retire
intel_svm_bind_mm().
No functional change intended.
The motivation is to let intel_iommu_set_dev_pasid() serve for both sva
domain and default domain set_dev_pasid operation, instead of duplicating
code for them. In latter patches, we will first do some refactoring to
intel_svm_set_dev_pasid(), and then extend intel_iommu_set_dev_pasid()
to support sva domain. After that, intel_svm_set_dev_pasid() will call
intel_iommu_set_dev_pasid() for set_dev_pasid purpose.
Signed-off-by: Tina Zhang <tina.zhang@...el.com>
---
drivers/iommu/intel/svm.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index f9b1f13bd068..03406395ac5b 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -289,10 +289,11 @@ static int pasid_to_svm_sdev(struct device *dev, unsigned int pasid,
return 0;
}
-static int intel_svm_bind_mm(struct intel_iommu *iommu, struct device *dev,
- struct iommu_domain *domain, ioasid_t pasid)
+static int intel_svm_set_dev_pasid(struct iommu_domain *domain,
+ struct device *dev, ioasid_t pasid)
{
struct device_domain_info *info = dev_iommu_priv_get(dev);
+ struct intel_iommu *iommu = info->iommu;
struct mm_struct *mm = domain->mm;
struct intel_svm_dev *sdev;
struct intel_svm *svm;
@@ -784,15 +785,6 @@ int intel_svm_page_response(struct device *dev,
return ret;
}
-static int intel_svm_set_dev_pasid(struct iommu_domain *domain,
- struct device *dev, ioasid_t pasid)
-{
- struct device_domain_info *info = dev_iommu_priv_get(dev);
- struct intel_iommu *iommu = info->iommu;
-
- return intel_svm_bind_mm(iommu, dev, domain, pasid);
-}
-
static void intel_svm_domain_free(struct iommu_domain *domain)
{
kfree(to_dmar_domain(domain));
--
2.39.3
Powered by blists - more mailing lists