Skip to content

Commit 19eb465

Browse files
lumagwilldeacon
authored andcommitted
iommu/arm-smmu-qcom: apply num_context_bank fixes for SDM630 / SDM660
The Qualcomm SDM630 / SDM660 platform requires the same kind of workaround as MSM8998: some IOMMUs have context banks reserved by firmware / TZ, touching those banks resets the board. Apply the num_context_bank workaround to those two SMMU devices in order to allow them to be used by Linux. Fixes: b812834 ("iommu: arm-smmu-qcom: Add sdm630/msm8998 compatibles for qcom quirks") Signed-off-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent a2bb820 commit 19eb465

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,15 @@ static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu)
286286
* MSM8998 LPASS SMMU reports 13 context banks, but accessing
287287
* the last context bank crashes the system.
288288
*/
289-
if (of_device_is_compatible(smmu->dev->of_node, "qcom,msm8998-smmu-v2") && smmu->num_context_banks == 13)
289+
if (of_device_is_compatible(smmu->dev->of_node, "qcom,msm8998-smmu-v2") &&
290+
smmu->num_context_banks == 13) {
290291
smmu->num_context_banks = 12;
292+
} else if (of_device_is_compatible(smmu->dev->of_node, "qcom,sdm630-smmu-v2")) {
293+
if (smmu->num_context_banks == 21) /* SDM630 / SDM660 A2NOC SMMU */
294+
smmu->num_context_banks = 7;
295+
else if (smmu->num_context_banks == 14) /* SDM630 / SDM660 LPASS SMMU */
296+
smmu->num_context_banks = 13;
297+
}
291298

292299
/*
293300
* Some platforms support more than the Arm SMMU architected maximum of
@@ -350,6 +357,11 @@ static int qcom_adreno_smmuv2_cfg_probe(struct arm_smmu_device *smmu)
350357
/* Support for 16K pages is advertised on some SoCs, but it doesn't seem to work */
351358
smmu->features &= ~ARM_SMMU_FEAT_FMT_AARCH64_16K;
352359

360+
/* TZ protects several last context banks, hide them from Linux */
361+
if (of_device_is_compatible(smmu->dev->of_node, "qcom,sdm630-smmu-v2") &&
362+
smmu->num_context_banks == 5)
363+
smmu->num_context_banks = 2;
364+
353365
return 0;
354366
}
355367

0 commit comments

Comments
 (0)