From: Jason Gunthorpe <jgg@nvidia.com>
To: Pranjal Shrivastava <praan@google.com>
Cc: Nicolin Chen <nicolinc@nvidia.com>, Will Deacon <will@kernel.org>,
Kevin Tian <kevin.tian@intel.com>,
Robin Murphy <robin.murphy@arm.com>,
joro@8bytes.org, David Woodhouse <dwmw2@infradead.org>,
Lu Baolu <baolu.lu@linux.intel.com>,
linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/6] iommu/arm-smmu-v3: Support IDR5.DS and widen the TLBI SCALE field
Date: Wed, 15 Jul 2026 17:00:41 -0300 [thread overview]
Message-ID: <20260715200041.GI3775915@nvidia.com> (raw)
In-Reply-To: <alfifgOM_YwTAP0y@google.com>
On Wed, Jul 15, 2026 at 07:41:50PM +0000, Pranjal Shrivastava wrote:
> > @@ -2446,9 +2446,10 @@ static void arm_smmu_cmdq_batch_add_range(struct arm_smmu_device *smmu,
> > /* Determine how many chunks of 2^scale size we have */
> > num = (num_pages >> scale) & CMDQ_TLBI_RANGE_NUM_MAX;
> >
> > + /* Keep the pre-DS 5-bit truncation when scale > 31 */
> > cmd->data[0] = orig_data0 |
> > FIELD_PREP(CMDQ_TLBI_0_NUM, num - 1) |
> > - FIELD_PREP(CMDQ_TLBI_0_SCALE, scale);
> > + FIELD_PREP(CMDQ_TLBI_0_SCALE, scale & 0x1f);
>
> Nit: Not sure what the convention is for these things, but this cap for
> host is temporary as Jason's iommupt series expands the scale when DS=1.
> I'm not sure if we should note a TODO here or just leave it be for now?
That kind of looks like an existing bug.. Technically it looks like a
very large invalidation could be created that can overflow scale and
break this algorithm. Adding the 0x1f at least keeps this as 'no
change': broken under invalidation, but not broken malformed command..
Let's just leave it like above, my series fixes that little miss too:
scale = fls64((num_tg - 1) / 32);
if (scale > scale_max) {
/*
* Range too large for a single command, use full invalidation.
*/
tlbi->range.use_full_inv = true;
return;
}
Jason
next prev parent reply other threads:[~2026-07-15 20:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 18:48 [PATCH v4 0/6] iommufd: Iterate the cache invalidation array in the core Nicolin Chen
2026-07-14 18:48 ` [PATCH v4 1/6] iommu/arm-smmu-v3: Support IDR5.DS and widen the TLBI SCALE field Nicolin Chen
2026-07-15 18:58 ` Jason Gunthorpe
2026-07-15 19:41 ` Pranjal Shrivastava
2026-07-15 20:00 ` Jason Gunthorpe [this message]
2026-07-14 18:48 ` [PATCH v4 2/6] iommu/arm-smmu-v3-iommufd: Reject unsupported bits in invalidation commands Nicolin Chen
2026-07-15 19:00 ` Jason Gunthorpe
2026-07-15 19:54 ` Pranjal Shrivastava
2026-07-14 18:48 ` [PATCH v4 3/6] iommufd: Iterate the cache invalidation array in the core Nicolin Chen
2026-07-15 20:03 ` Jason Gunthorpe
2026-07-14 18:48 ` [PATCH v4 4/6] iommufd/selftest: Convert cache invalidation mocks to the core array loop Nicolin Chen
2026-07-14 18:48 ` [PATCH v4 5/6] iommu/arm-smmu-v3-iommufd: Convert cache invalidation " Nicolin Chen
2026-07-15 20:05 ` Jason Gunthorpe
2026-07-14 18:48 ` [PATCH v4 6/6] iommu/vt-d: Convert nested " Nicolin Chen
2026-07-15 20:15 ` [PATCH v4 0/6] iommufd: Iterate the cache invalidation array in the core Jason Gunthorpe
2026-07-15 20:30 ` Nicolin Chen
2026-07-16 15:18 ` Jason Gunthorpe
2026-07-16 16:20 ` 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=20260715200041.GI3775915@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolinc@nvidia.com \
--cc=praan@google.com \
--cc=robin.murphy@arm.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