RE: [PATCH] iommu: Add Kconfig help text for IOMMU_SVA

From: Tian, Kevin
Date: Mon May 08 2023 - 20:10:32 EST


> From: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, May 9, 2023 1:18 AM
>
> On Mon, May 8, 2023 at 9:55 AM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
> >
> > CONFIG_IOMMU_MM_PASID perhaps? Says what it does without a clue
> about
> > why it does it. x86 arch code could select it ideally?
>
> Maybe we don't even need the "IOMMU" part. It's a core x86
> architecture feature. Maybe it usually (always?) gets used within the
> framework of some IOMMU work, but I guess ENCQCMD could be used in
> some hardwired way even without that (ie is it possible to have just
> some "basic PASID set up by VMM environment" thing?)

This makes sense to me. At least that is one possible way in concept,
though we don't have such example now.

>
> I don't actually know who uses it and how, so I'm probably not the
> right person to name it, but just looking at the x86 code that sets
> it, the PASID code technically has no connection to any iommu code,
> it's literally a core CPU feature with an MSR and some magic faulting
> thing, and seems to be possibly usable as-is.
>
> That existing
>
> #ifdef CONFIG_IOMMU_SVA
>
> in the x86 traps.c code just looks odd, and making it be
> CONFIG_IOMMU_MM_PASID sounds better to me. I'm just not sure about
> the
> "IOMMU" part either. Just "MM_PASID"?
>
> That said, the arm-smmu-v3-sva.c code clearly *also* uses pasid,
> except it seems to really want to call it "ssid".
>
> So "having a per-mm ASID for IO" is clearly a common feature. But

Yes. Currently PASID for mm is globally allocated so each mm is
associated with a single unique pasid.

> naming seems hard, with x86 calling it PASID, arm64 seemingly calling
> it "SSID".
>
> Right now the only user *does* seem to be through the IOMMU SVA code,
> but that may or may not be fundamental.
>
> Now, "SSID" is a completely horrible name, as I immediately realized
> when I tried to google for it. So arm64 is just wrong, and we're most
> definitely continuing to call it PASID.

We have undergone this naming game when enabling SVA before.

At that point IOASID was considered as a generic term to cover both
PCI PASID and ARM specific SSID. But in the end PASID/IOASID are
still mixed in many common code.

IMHO sticking with PASID should be fine.

>
> I'd lean towards just "CONFIG_MM_PASID" or something, but at some
> point this is bikeshedding, and I don't know about any possible
> non-iommu direct uses?
>

I agree that CONFIG_MM_PASID is more accurate in definition.