Re: [PATCH v3 2/5] iommu/sva: Move PASID helpers to sva code

Jason Gunthorpe
2023-02-16T23:58:55Z

On Thu, Feb 16, 2023 at 03:59:48PM -0800, Jacob Pan wrote:
> Preparing to remove IOASID infrastructure, PASID management will be
> under SVA code.
>
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---
> drivers/iommu/iommu-sva.c | 19 +++++++++++++++++++
> include/linux/sched/mm.h | 22 +++-------------------
> 2 files changed, 22 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c
> index 24bf9b2b58aa..a3ee258936f0 100644
> --- a/drivers/iommu/iommu-sva.c
> +++ b/drivers/iommu/iommu-sva.c
> @@ -71,6 +71,25 @@ struct mm_struct *iommu_sva_find(ioasid_t pasid)
> }
> EXPORT_SYMBOL_GPL(iommu_sva_find);
>
> +void mm_pasid_init(struct mm_struct *mm)
> +{
> + mm->pasid = INVALID_IOASID;
> +}
> +
> +/* Associate a PASID with an mm_struct: */
> +void mm_pasid_set(struct mm_struct *mm, u32 pasid)
> +{
> + mm->pasid = pasid;
> +}

This is only called from this file, just get rid of it

It would be better if the other two could remain as inlines given
their impact on the fork path..

Jason