Skip to content

Commit 6a79a5a

Browse files
nowicki-tomaszwilldeacon
authored andcommitted
iommu/arm-smmu: Call configuration impl hook before consuming features
'cfg_probe' hook is called at the very end of configuration probing procedure and therefore features override and workaround may become complex like for ID register fixups. In preparation for adding Marvell errata move 'cfg_probe' a bit earlier to have chance to adjust the detected features before we start consuming them. Since the Cavium quirk (the only user) does not alter features it is safe to do so. Suggested-by: Robin Murphy <[email protected]> Signed-off-by: Tomasz Nowicki <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 2c5c3cf commit 6a79a5a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/iommu/arm-smmu.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
17281728
unsigned int size;
17291729
u32 id;
17301730
bool cttw_reg, cttw_fw = smmu->features & ARM_SMMU_FEAT_COHERENT_WALK;
1731-
int i;
1731+
int i, ret;
17321732

17331733
dev_notice(smmu->dev, "probing hardware configuration...\n");
17341734
dev_notice(smmu->dev, "SMMUv%d with:\n",
@@ -1891,6 +1891,12 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
18911891
smmu->features |= ARM_SMMU_FEAT_FMT_AARCH64_64K;
18921892
}
18931893

1894+
if (smmu->impl && smmu->impl->cfg_probe) {
1895+
ret = smmu->impl->cfg_probe(smmu);
1896+
if (ret)
1897+
return ret;
1898+
}
1899+
18941900
/* Now we've corralled the various formats, what'll it do? */
18951901
if (smmu->features & ARM_SMMU_FEAT_FMT_AARCH32_S)
18961902
smmu->pgsize_bitmap |= SZ_4K | SZ_64K | SZ_1M | SZ_16M;
@@ -1918,9 +1924,6 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
19181924
dev_notice(smmu->dev, "\tStage-2: %lu-bit IPA -> %lu-bit PA\n",
19191925
smmu->ipa_size, smmu->pa_size);
19201926

1921-
if (smmu->impl && smmu->impl->cfg_probe)
1922-
return smmu->impl->cfg_probe(smmu);
1923-
19241927
return 0;
19251928
}
19261929

0 commit comments

Comments
 (0)