Re: [PATCH rc v1 1/4] iommu/arm-smmu-v3: Add arm_smmu_adopt_strtab() for kdump

Nicolin Chen
2026-04-15T20:58:20Z

On Thu, Apr 09, 2026 at 12:46:50PM -0700, Nicolin Chen wrote:
> + if (fmt == STRTAB_BASE_CFG_FMT_2LVL) {
> + /* Enforce 2-level feature flag to match the adopted table */
> + smmu->features |= ARM_SMMU_FEAT_2_LVL_STRTAB;
> + ret = arm_smmu_adopt_strtab_2lvl(smmu, cfg_reg, dma);
> + } else if (fmt == STRTAB_BASE_CFG_FMT_LINEAR) {
> + /* Force linear feature flag to match the adopted table */
> + smmu->features &= ~ARM_SMMU_FEAT_2_LVL_STRTAB;
> + ret = arm_smmu_adopt_strtab_linear(smmu, cfg_reg, dma);

Made a small fix here. Including it in v2.

@@ -4662,11 +4662,18 @@ static int arm_smmu_adopt_strtab(struct arm_smmu_device *smmu)
dev_info(smmu->dev, "kdump: adopting crashed kernel's stream table\n");

if (fmt == STRTAB_BASE_CFG_FMT_2LVL) {
- /* Enforce 2-level feature flag to match the adopted table */
- smmu->features |= ARM_SMMU_FEAT_2_LVL_STRTAB;
+ /*
+ * Both kernels run on the same hardware, so it's impossible for
+ * kdump kernel to see the support for linear stream table only.
+ */
+ if (WARN_ON(!(smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB)))
+ return -EINVAL;
ret = arm_smmu_adopt_strtab_2lvl(smmu, cfg_reg, dma);
} else if (fmt == STRTAB_BASE_CFG_FMT_LINEAR) {
- /* Force linear feature flag to match the adopted table */
+ /*
+ * In case that the old kernel for some reason used the linear
+ * format, enforce the same format to match the adopted table.
+ */
smmu->features &= ~ARM_SMMU_FEAT_2_LVL_STRTAB;
ret = arm_smmu_adopt_strtab_linear(smmu, cfg_reg, dma);
} else {

Nicolin