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

From: Michael Shavit
Date: Fri Jul 28 2023 - 07:12:26 EST


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(). 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)?

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).