Re: [PATCH rfcv1 6/8] iommu/arm-smmu-v3: Populate smmu_domain->invs when attaching masters

Nicolin Chen
2025-09-06T08:21:16Z

On Wed, Aug 27, 2025 at 03:21:23PM -0300, Jason Gunthorpe wrote:
> On Wed, Aug 13, 2025 at 06:25:37PM -0700, Nicolin Chen wrote:
> > +typedef struct arm_smmu_invs *(*invs_fn)(struct arm_smmu_invs *old_invs,
> > + struct arm_smmu_invs *invs);
>
> no reason to pass in fn, this always just calls it as the last thing
> so the caller can do it..

The only concern from letting callers to invoke separately is that
the master->build_invs is a shared memory. So, embedding it inside
this arm_smmu_build_invs() allows it to be used before overwritten.

Having said that, I think we should be fine, as I noted this down
in the kdocs.

Thanks
Nicolin

> > +static struct arm_smmu_invs *arm_smmu_build_invs(
> > + struct arm_smmu_invs *old_invs, struct arm_smmu_domain *smmu_domain,
> > + struct arm_smmu_master *master, bool ats, ioasid_t ssid, invs_fn fn)