Re: [PATCHv10 10/15] x86/mm, iommu/sva: Make LAM and SVM mutually exclusive

From: Kirill A. Shutemov
Date: Tue Oct 18 2022 - 20:19:09 EST


On Tue, Oct 18, 2022 at 03:43:24PM -0700, Dave Hansen wrote:
> On 10/18/22 15:33, Kirill A. Shutemov wrote:
> >> Is this #ifdef really necessary? CONFIG_IOMMU_SVA selects IOASID,
> >> without which pasid_valid() is just stubbed out to 0.
> > mm->pasid is only defined for CONFIG_IOMMU_SVA=y.
> >
> > Do you want me to add mm_has_valid_pasid()?
>
> A quick grep makes it look like pasid_valid() could be *replaced* with
> mm_has_pasid_valid() since all the places doing pasid_valid() do it with
> mm->pasid.

Almost: the second pasid_valid() in iommu_sva_alloc_pasid() called for
just allocated pasid.

I guess we can just opencode this case.

--
Kiryl Shutsemau / Kirill A. Shutemov