Re: [PATCH v1 7/7] iommu/arm-smmu-v3: Move CD table to arm_smmu_master

From: Jason Gunthorpe
Date: Fri Jul 28 2023 - 08:26:44 EST


On Fri, Jul 28, 2023 at 07:11:46PM +0800, Michael Shavit wrote:
> On Fri, Jul 28, 2023 at 2:43 AM Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:
>
> > Then you can put the free in a detach op once the CD table becomes
> > empty and it behaves much like it already does.
>
> This turns out to be a bit tricky; the SMMU driver detaches the
> currently attached domain whenever a new domain is attached with
> attach_dev().

Oh, yeah, it is a bit quirky that way

> More generally, do we really want to be de-allocating
> the table whenever we switch between an S1 domain and other domain
> types that don't make use of the table (such as IDENTITY or NESTED)?

Probably.

> One solution is to defer the allocation to the first attach_op, but
> only free when the master is freed (this patch's v1 behavior).

That seems reasonable, just don't allocate it at probe time since
PASID is very rarely used.

Jason