[PATCH v4 03/16] iommu/arm-smmu-v3: Move arm_smmu_rmr_install_bypass_ste()

Shameerali Kolothum Thodi shameerali.kolothum.thodi at huawei.com
Mon Jan 29 07:07:21 PST 2024



> -----Original Message-----
> From: Jason Gunthorpe <jgg at nvidia.com>
> Sent: Thursday, January 25, 2024 11:57 PM
> To: iommu at lists.linux.dev; Joerg Roedel <joro at 8bytes.org>; linux-arm-
> kernel at lists.infradead.org; Robin Murphy <robin.murphy at arm.com>; Will
> Deacon <will at kernel.org>
> Cc: Moritz Fischer <mdf at kernel.org>; Moritz Fischer <moritzf at google.com>;
> Michael Shavit <mshavit at google.com>; Nicolin Chen <nicolinc at nvidia.com>;
> patches at lists.linux.dev; Shameerali Kolothum Thodi
> <shameerali.kolothum.thodi at huawei.com>
> Subject: [PATCH v4 03/16] iommu/arm-smmu-v3: Move
> arm_smmu_rmr_install_bypass_ste()
> 
> Logically arm_smmu_init_strtab_linear() is the function that allocates and
> populates the stream table with the initial value of the STEs. After this
> function returns the stream table should be fully ready.
> 
> arm_smmu_rmr_install_bypass_ste() adjusts the initial stream table to force
> any SIDs that the FW says have IOMMU_RESV_DIRECT to use bypass. This
> ensures there is no disruption to the identity mapping during boot.
> 
> Put arm_smmu_rmr_install_bypass_ste() into arm_smmu_init_strtab_linear(),
> it already executes immediately after arm_smmu_init_strtab_linear().
> 
> No functional change intended.

I think this actually changes the behavior and will cause regression as we
now install rmr  sids only for linear stream table not for SMMUv3 with 
2-level stream table supported.

Please check.

Thanks,
Shameer

> 
> Reviewed-by: Michael Shavit <mshavit at google.com>
> Reviewed-by: Nicolin Chen <nicolinc at nvidia.com>
> Tested-by: Shameer Kolothum <shameerali.kolothum.thodi at huawei.com>
> Tested-by: Nicolin Chen <nicolinc at nvidia.com>
> Tested-by: Moritz Fischer <moritzf at google.com>
> Signed-off-by: Jason Gunthorpe <jgg at nvidia.com>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index 38bcb4ed1fccc1..df8fc7b87a7907 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -102,6 +102,8 @@ static struct arm_smmu_option_prop
> arm_smmu_options[] = {
>  	{ 0, NULL},
>  };
> 
> +static void arm_smmu_rmr_install_bypass_ste(struct arm_smmu_device
> *smmu);
> +
>  static void parse_driver_options(struct arm_smmu_device *smmu)
>  {
>  	int i = 0;
> @@ -3250,6 +3252,9 @@ static int arm_smmu_init_strtab_linear(struct
> arm_smmu_device *smmu)
>  	cfg->strtab_base_cfg = reg;
> 
>  	arm_smmu_init_bypass_stes(strtab, cfg->num_l1_ents);
> +
> +	/* Check for RMRs and install bypass STEs if any */
> +	arm_smmu_rmr_install_bypass_ste(smmu);
>  	return 0;
>  }
> 
> @@ -4063,9 +4068,6 @@ static int arm_smmu_device_probe(struct
> platform_device *pdev)
>  	/* Record our private device structure */
>  	platform_set_drvdata(pdev, smmu);
> 
> -	/* Check for RMRs and install bypass STEs if any */
> -	arm_smmu_rmr_install_bypass_ste(smmu);
> -
>  	/* Reset the device */
>  	ret = arm_smmu_device_reset(smmu, bypass);
>  	if (ret)
> --
> 2.43.0




More information about the linux-arm-kernel mailing list