Re: [PATCH 2/5] iommu/amd: Pass last in through to build_inv_address()

Jason Gunthorpe
2026-04-01T19:55:05Z

On Mon, Mar 30, 2026 at 04:03:38PM +0800, Wei Wang wrote:
> On 3/27/26 11:23 PM, Jason Gunthorpe wrote:
> > This is the trivial call chain below amd_iommu_domain_flush_pages().
> >
> > Cases that are doing a full invalidate will pass a last of U64_MAX.
> >
> > This avoids converting between size and last, and type confusion with
> > size_t, unsigned long and u64 all being used in different places along
> > the driver's invalidation path. Consistently use u64 in the internals.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > ---
> > drivers/iommu/amd/amd_iommu.h | 2 +-
> > drivers/iommu/amd/iommu.c | 56 +++++++++++++++++------------------
> > drivers/iommu/amd/pasid.c | 2 +-
> > 3 files changed, 29 insertions(+), 31 deletions(-)
> >
> > diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h
> > index 1342e764a5486d..ef4ebecb003494 100644
> > --- a/drivers/iommu/amd/amd_iommu.h
> > +++ b/drivers/iommu/amd/amd_iommu.h
> > @@ -90,7 +90,7 @@ void amd_iommu_flush_all_caches(struct amd_iommu *iommu);
> > void amd_iommu_domain_flush_pages(struct protection_domain *domain,
> > u64 address, size_t size);
> > void amd_iommu_dev_flush_pasid_pages(struct iommu_dev_data *dev_data,
> > - ioasid_t pasid, u64 address, size_t size);
> > + ioasid_t pasid, u64 address, u64 last);
>
> Using “addr_start/addr_last” or “start/last” would be more symmetrical and
> intuitive.

Okay, it doesn't make the diff look to bad!

Jason