[PATCH v2 7/9] iommu/arm-smmu-v3: Directly encode CMDQ_OP_ATC_INV
Nicolin Chen
nicolinc at nvidia.com
Sun May 17 20:27:40 PDT 2026
On Wed, May 13, 2026 at 08:57:46PM -0300, Jason Gunthorpe wrote:
> Add a new command make function and convert all the places using
> ATC_INV.
>
> Split out full invalidation to directly make the cmd instead of
> overloading size=0 to mean full invalidation.
>
> In section "3.9.1 ATS Interface" of F.b the specification says:
>
> When the SMMU returns an ATS Translation Completion for a request that
> had a PASID, the Global bit of the Translation Completion Data Entry
> must be zero.
>
> Even though it faithfully forwards the G bit through to the ATS
> invalidation command there is no way to create G mappings so there is
> never any need to send a G invalidation. Thus don't expose global in the
> new helpers and leave CMDQ_ATC_0_GLOBAL unused.
>
> Reviewed-by: Mostafa Saleh <smostafa at google.com>
> Reviewed-by: Pranjal Shrivastava <praan at google.com>
> Tested-by: Pranjal Shrivastava <praan at google.com>
> Tested-by: Mostafa Saleh <smostafa at google.com>
> Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
Reviewed-by: Nicolin Chen <nicolinc at nvidia.com>
With a nit ..
> -static void
> -arm_smmu_atc_inv_to_cmd(int ssid, unsigned long iova, size_t size,
> - struct arm_smmu_cmdq_ent *cmd)
> +static struct arm_smmu_cmd
> +arm_smmu_atc_inv_to_cmd(u32 sid, int ssid, unsigned long iova, size_t size)
> {
> size_t log2_span;
> size_t span_mask;
> @@ -2395,17 +2386,6 @@ arm_smmu_atc_inv_to_cmd(int ssid, unsigned long iova, size_t size,
> * This has the unpleasant side-effect of invalidating all PASID-tagged
> * ATC entries within the address range.
> */
> - *cmd = (struct arm_smmu_cmdq_ent) {
> - .opcode = CMDQ_OP_ATC_INV,
> - .substream_valid = (ssid != IOMMU_NO_PASID),
> - .atc.ssid = ssid,
> - };
> -
> - if (!size) {
> - cmd->atc.size = ATC_INV_SIZE_ALL;
> - return;
> - }
.. should !size jump to arm_smmu_make_cmd_atc_inv_all()?
Or maybe add a note to disallow this function being used with !size
and WARN_ON? The function name itself doesn't sound very restricted
though.
Nicolin
More information about the linux-arm-kernel
mailing list