Re: [PATCH rc v6 7/7] iommu/arm-smmu-v3: Detect ARM_SMMU_OPT_KDUMP_ADOPT in probe()

From: Pranjal Shrivastava

Date: Mon Jun 29 2026 - 12:49:21 EST


On Wed, May 20, 2026 at 10:03:24AM -0700, Nicolin Chen wrote:
> arm_smmu_device_hw_probe() runs before arm_smmu_init_structures(), so it's
> natural to decide whether the kdump kernel must adopt the crashed kernel's
> stream table.
>
> Given that memremap is used to adopt the old stream table, set this option
> only on a coherent SMMU.
>
> And make sure SMMU isn't in Service Failure Mode.
>
> Fixes: b63b3439b856 ("iommu/arm-smmu-v3: Abort all transactions if SMMU is enabled in kdump kernel")
> Cc: stable@xxxxxxxxxxxxxxx # v6.12+
> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
> Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 31 +++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> 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 851bcebfdb3d4..fb34c3ffee9fe 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -5353,6 +5353,33 @@ static void arm_smmu_get_httu(struct arm_smmu_device *smmu, u32 reg)
> hw_features, fw_features);
> }
>
> +static void arm_smmu_device_hw_probe_kdump(struct arm_smmu_device *smmu)
> +{
> + u32 gerror, gerrorn, active;
> +
> + /* No adoption if SMMU is disabled (i.e., there is no in-flight DMA) */
> + if (!(readl_relaxed(smmu->base + ARM_SMMU_CR0) & CR0_SMMUEN))
> + return;
> +
> + /* For now, only support a coherent SMMU that works with MEMREMAP_WB */
> + if (!(smmu->features & ARM_SMMU_FEAT_COHERENCY)) {
> + dev_warn(smmu->dev,
> + "kdump: non-coherent SMMU unsupported; reset to block all DMAs\n");
> + return;
> + }

We seem to be checking it here right at the beginning, let's remove the
redundant checks downstream?

> +
> + gerror = readl_relaxed(smmu->base + ARM_SMMU_GERROR);
> + gerrorn = readl_relaxed(smmu->base + ARM_SMMU_GERRORN);
> + active = gerror ^ gerrorn;
> + if (active & GERROR_SFM_ERR) {
> + dev_warn(smmu->dev,
> + "kdump: SMMU in Service Failure Mode, must reset\n");
> + return;
> + }
> +
> + smmu->options |= ARM_SMMU_OPT_KDUMP_ADOPT;
> +}
> +
> static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
> {
> u32 reg;
> @@ -5567,6 +5594,10 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
>
> dev_info(smmu->dev, "oas %lu-bit (features 0x%08x)\n",
> smmu->oas, smmu->features);
> +
> + if (is_kdump_kernel())
> + arm_smmu_device_hw_probe_kdump(smmu);
> +
> return 0;
> }

Apart from that nit,

Reviewed-by: Pranjal Shrivastava <praan@xxxxxxxxxx>

Thanks,
Praan