Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: iommu@lists.linux.dev, "Joerg Roedel (AMD)" <joro@8bytes.org>,
	Jean-Philippe Brucker <jpb@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will@kernel.org>,
	David Matlack <dmatlack@google.com>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	patches@lists.linux.dev, Pranjal Shrivastava <praan@google.com>,
	Samiullah Khawaja <skhawaja@google.com>,
	Mostafa Saleh <smostafa@google.com>
Subject: Re: [PATCH v3 7/8] iommu/arm-smmu-v3: Change how the tlbi describes the invalidation
Date: Wed, 15 Jul 2026 16:13:01 -0300	[thread overview]
Message-ID: <20260715191301.GB103013@nvidia.com> (raw)
In-Reply-To: <albBoVkI4KIh+spI@nvidia.com>

On Tue, Jul 14, 2026 at 04:09:21PM -0700, Nicolin Chen wrote:
> On Tue, Jul 14, 2026 at 03:46:07PM -0300, Jason Gunthorpe wrote:
> > +static unsigned int arm_smmu_compute_ttl(u8 leaf_bitmap, u8 table_bitmap,
> > +	} else {
> > +		/* Both bitmaps zero is not allowed */
> > +		return 0;
> > +	}
> 
> "not allowed" reads like we need a WARN_ON?

Yes

> 
> > +static u8 arm_smmu_tlbi_calc_stride(struct arm_smmu_tlbi *tlbi)
> > +{
> > +	u8 combined = tlbi->table_levels_bitmap | tlbi->leaf_levels_bitmap;
> > +	u8 tg_szlg2 = tlbi->tgsz_lg2;
> > +
> > +	if (!combined)
> > +		return U8_MAX;
> 
> As the code checks "combined", ...

This should be a WARN_ON too

> > +	 * If leaf_levels_bitmap is 0 then this is a walk cache only
> > +	 * invalidation. If table_levels_bitmap is 0 then this is a leaf only
> > +	 * invalidation.
> 
> ..., how about listing all combinations in this kdocs:
>        * The pair (table, leaf) below selects the invalidation scope:
>        *   table!=0, leaf==0 : walk cache only
>        *   table==0, leaf!=0 : leaves only
>        *   table!=0, leaf!=0 : walk cache + leaves
>        *   table==0, leaf==0 : a full invalidation
> ?

I did add this table below the above comment in the header

> Then, arm_smmu_compute_ttl() would read slightly better.

Yeah it is a bit tighter

Thanks,
Jason


  reply	other threads:[~2026-07-15 19:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 18:46 [PATCH v3 0/8] Organize the SMMUv3 invalidation flow so iommupt can use it Jason Gunthorpe
2026-07-14 18:46 ` [PATCH v3 1/8] iommu/arm-smmu-v3: Pass the parameters for the invalidation in a struct Jason Gunthorpe
2026-07-14 18:46 ` [PATCH v3 2/8] iommu/arm-smmu-v3: Move pgsize out of arm_smmu_inv Jason Gunthorpe
2026-07-14 18:46 ` [PATCH v3 3/8] iommu/arm-smmu-v3: Optimize range invalidation for latency Jason Gunthorpe
2026-07-14 18:46 ` [PATCH v3 4/8] iommu/arm-smmu-v3: Keep track in the arm_smmu_invs if RIL is used Jason Gunthorpe
2026-07-14 18:46 ` [PATCH v3 5/8] iommu/arm-smmu-v3: Precompute the invalidation commands Jason Gunthorpe
2026-07-14 21:42   ` Nicolin Chen
2026-07-14 18:46 ` [PATCH v3 6/8] iommu/arm-smmu-v3: Populate the tlbi at the top of the call chain Jason Gunthorpe
2026-07-14 21:29   ` Nicolin Chen
2026-07-15 14:54     ` Jason Gunthorpe
2026-07-14 18:46 ` [PATCH v3 7/8] iommu/arm-smmu-v3: Change how the tlbi describes the invalidation Jason Gunthorpe
2026-07-14 23:09   ` Nicolin Chen
2026-07-15 19:13     ` Jason Gunthorpe [this message]
2026-07-14 18:46 ` [PATCH v3 8/8] iommu/arm-smmu-v3: Support the DS expansion of RIL's SCALE Jason Gunthorpe
2026-07-15  1:45 ` [PATCH v3 0/8] Organize the SMMUv3 invalidation flow so iommupt can use it Nicolin Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260715191301.GB103013@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=dmatlack@google.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=jpb@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=nicolinc@nvidia.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=patches@lists.linux.dev \
    --cc=praan@google.com \
    --cc=robin.murphy@arm.com \
    --cc=skhawaja@google.com \
    --cc=smostafa@google.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox