[PATCH v2 3/8] iommu/arm-smmu-v3: Optimize range invalidation for latency

Nicolin Chen nicolinc at nvidia.com
Tue Jul 7 00:27:00 PDT 2026


On Mon, Jul 06, 2026 at 01:26:40PM -0300, Jason Gunthorpe wrote:
> +	/*
> +	 * There are at most 5 possible values for NUM based on SCALE. The

Mind elaborating the "at most 5 possible values for NUM"?

> +	 * highest NUM is at the lowest SCALE where:
> +	 *    ceil(num_tg / 2^SCALE) <= 32
> +	 *    scale >= ceil(log2(num_tg / 32))
> +	 * The lowest value is 1 where 2^SCALE covers the whole range. Pick the
> +	 * highest since it trivially also gives the tightest range.

The spec only mentions:
 Range = ((NUM+1) * 2^SCALE) * Translation_Granule_Size

Since CMDQ_TLBI_RANGE_NUM_MAX + 1 is 32, so we can get:
 num_tg <= 32 * 2^SCALE

.. and then get that "ceil(num_tg / 2^SCALE) <= 32".

Maybe worth adding the first two steps to help readability?

Nicolin



More information about the linux-arm-kernel mailing list