summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJacob Pan <jacob.jun.pan@linux.intel.com>2023-03-22 21:07:58 +0100
committerJoerg Roedel <jroedel@suse.de>2023-03-31 10:03:23 +0200
commitcd3891158a77685aee6129f7374a018d13540b2c (patch)
treef2aa7d4ea3a426b77e4f21f56219728c0dbfd529 /drivers/iommu
parentiommu/vt-d: Remove virtual command interface (diff)
downloadlinux-cd3891158a77685aee6129f7374a018d13540b2c.tar.xz
linux-cd3891158a77685aee6129f7374a018d13540b2c.zip
iommu/sva: Move PASID helpers to sva code
Preparing to remove IOASID infrastructure, PASID management will be under SVA code. Decouple mm code from IOASID. Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Link: https://lore.kernel.org/r/20230322200803.869130-3-jacob.jun.pan@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/iommu-sva.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c
index 24bf9b2b58aa..fcfdc80a3939 100644
--- a/drivers/iommu/iommu-sva.c
+++ b/drivers/iommu/iommu-sva.c
@@ -44,7 +44,7 @@ int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min, ioasid_t max)
if (!pasid_valid(pasid))
ret = -ENOMEM;
else
- mm_pasid_set(mm, pasid);
+ mm->pasid = pasid;
out:
mutex_unlock(&iommu_sva_lock);
return ret;
@@ -238,3 +238,11 @@ out_put_mm:
return status;
}
+
+void mm_pasid_drop(struct mm_struct *mm)
+{
+ if (pasid_valid(mm->pasid)) {
+ ioasid_free(mm->pasid);
+ mm->pasid = INVALID_IOASID;
+ }
+}