Re: [PATCH v5 3/6] iommu: Introduce mm_get_pasid() helper function

From: Jason Gunthorpe
Date: Thu Oct 05 2023 - 14:44:14 EST


On Mon, Sep 25, 2023 at 10:38:10AM +0800, Tina Zhang wrote:

> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index a4eab6697fe1..db2510da28c1 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -1189,10 +1189,14 @@ static inline bool mm_valid_pasid(struct mm_struct *mm)
> {
> return mm->pasid != IOMMU_PASID_INVALID;
> }
> -static inline u32 mm_get_enqcmd_pasid(struct mm_struct *mm)
> +static inline u32 mm_get_pasid(struct mm_struct *mm)

This should not be in a global header

Put the mm_get_pasid() in iommu-sva.c as a helper

Have SMMUv3 call mm_get_enqcmd_pasid() for now, it will be fixed

There is no "mm_pasid" that should leak outside of iommu-sva.c except
specifically to support enqcmd.

Jason