[PATCH v2 6/9] iommu/arm-smmu-v3: Directly encode simple commands

Nicolin Chen nicolinc at nvidia.com
Sun May 17 20:15:25 PDT 2026


On Wed, May 13, 2026 at 08:57:45PM -0300, Jason Gunthorpe wrote:
> Add make functions to build commands for
> 
>  CMDQ_OP_TLBI_EL2_ALL
>  CMDQ_OP_TLBI_NSNH_ALL
>  CMDQ_OP_CFGI_ALL
>  CMDQ_OP_PREFETCH_CFG
>  CMDQ_OP_CFGI_STE
>  CMDQ_OP_CFGI_CD
>  CMDQ_OP_RESUME
>  CMDQ_OP_PRI_RESP
> 
> Convert all of these call sites to use the make function instead of
> going through arm_smmu_cmdq_build_cmd(). Use a #define so the general
> pattern is always:
> 
>    arm_smmu_cmdq_issue_cmd(smmu, arm_smmu_make_cmd_XX(..));
> 
> Add arm_smmu_cmdq_batch_add_cmd() which takes struct arm_smmu_cmd
> directly to match the new flow.
> 
> Reviewed-by: Pranjal Shrivastava <praan at google.com>
> Reviewed-by: Mostafa Saleh <smostafa 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>

> +static inline struct arm_smmu_cmd arm_smmu_make_cmd_cfgi_all(void)
> +{
> +	struct arm_smmu_cmd cmd = arm_smmu_make_cmd_op(CMDQ_OP_CFGI_ALL);
> +
> +	cmd.data[1] |= FIELD_PREP(CMDQ_CFGI_1_RANGE, 31);

Optional, might retain the note:
	/* Cover the entire SID range */



More information about the linux-arm-kernel mailing list