[PATCH v11 01/11] iommu/arm-smmu-v3: Init the vmid_map ida before the stream table setup
Mostafa Saleh
smostafa at google.com
Tue Oct 20 04:13:43 PDT 2026
On Mon, Oct 05, 2026 at 12:30:44PM -0700, Nicolin Chen wrote:
> The vmid_map ida is initialized after the stream table setup, along with
> the devres action that destroys it.
>
> An upcoming change will reserve the crashed kernel's in-use VMIDs in this
> ida, from a kdump kernel's stream table adoption that runs in place of the
> regular setup and returns early.
>
> Move the ida_init() and its devres registration to the entry of the whole
> function, so that the ida is ready by the time the adoption path runs.
>
> Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>
> Tested-by: Breno Leitao <leitao at kernel.org>
> Tested-by: Cristian Prundeanu <cpru at amazon.com>
> Assisted-by: LLM
> Signed-off-by: Nicolin Chen <nicolinc at nvidia.com>
Reviewed-by: Mostafa Saleh <smostafa at google.com>
Thanks,
Mostafa
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 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 34e916ea339ff..792627e1c790e 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -4842,17 +4842,17 @@ static int arm_smmu_init_strtab(struct arm_smmu_device *smmu)
> {
> int ret;
>
> + ida_init(&smmu->vmid_map);
> + ret = devm_add_action_or_reset(smmu->dev, arm_smmu_destroy_vmid_map,
> + &smmu->vmid_map);
> + if (ret)
> + return ret;
> +
> if (smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB)
> ret = arm_smmu_init_strtab_2lvl(smmu);
> else
> ret = arm_smmu_init_strtab_linear(smmu);
> - if (ret)
> - return ret;
> -
> - ida_init(&smmu->vmid_map);
> -
> - return devm_add_action_or_reset(smmu->dev, arm_smmu_destroy_vmid_map,
> - &smmu->vmid_map);
> + return ret;
> }
>
> static int arm_smmu_init_structures(struct arm_smmu_device *smmu)
> --
> 2.43.0
>
More information about the linux-arm-kernel
mailing list