[PATCH v7 7/9] iommu/arm-smmu-v3: Populate the tlbi at the top of the call chain

Jason Gunthorpe jgg at nvidia.com
Mon Sep 28 11:11:21 PDT 2026


On Mon, Sep 28, 2026 at 05:05:29PM +0000, Pranjal Shrivastava wrote:
> > -void arm_smmu_domain_inv_range(struct arm_smmu_domain *smmu_domain,
> > -			       unsigned long iova, size_t size,
> > -			       unsigned int granule, bool leaf)
> > +void arm_smmu_domain_tlbi(struct arm_smmu_tlbi *tlbi,
> > +			  struct arm_smmu_domain *smmu_domain)
> 
> A caller re-using the tlbi would overflow the 2-entry range.cmds[], since
> num_cmds is never reset or checked. Should we sanity check num_cmds here?

That isn't the API protocol, once the tlbi goes into
arm_smmu_domain_tlbi() it is consumed and must not be used
again. Everything follows this. It is sort of a micro optimization as
we end up with one pointer in the callchain under here that gets all
the information.

I can add a little comment:

/*
 * Perform the invalidation with the parameters described by tlbi on everything
 * caching for smmu_domain. tlbi is an on-stack structure that contains both the
 * input description and working memory for this function it must be discarded
 * after this returns.
 */
void arm_smmu_domain_tlbi(struct arm_smmu_tlbi *tlbi,
			  struct arm_smmu_domain *smmu_domain)
{

Thanks,
Jason



More information about the linux-arm-kernel mailing list