Skip to content

Commit ef4144b

Browse files
Bibek Kumar Patrowilldeacon
authored andcommitted
iommu/arm-smmu: Re-enable context caching in smmu reset operation
Default MMU-500 reset operation disables context caching in prefetch buffer. It is however expected for context banks using the ACTLR register to retain their prefetch value during reset and runtime suspend. Add config 'ARM_SMMU_MMU_500_CPRE_ERRATA' to gate this errata workaround in default MMU-500 reset operation which defaults to 'Y' and provide option to disable workaround for context caching in prefetch buffer as and when needed. Suggested-by: Will Deacon <[email protected]> Signed-off-by: Bibek Kumar Patro <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent e94dc6d commit ef4144b

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

Documentation/arch/arm64/silicon-errata.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ stable kernels.
198198
+----------------+-----------------+-----------------+-----------------------------+
199199
| ARM | Neoverse-V3 | #3312417 | ARM64_ERRATUM_3194386 |
200200
+----------------+-----------------+-----------------+-----------------------------+
201-
| ARM | MMU-500 | #841119,826419 | N/A |
201+
| ARM | MMU-500 | #841119,826419 | ARM_SMMU_MMU_500_CPRE_ERRATA|
202+
| | | #562869,1047329 | |
202203
+----------------+-----------------+-----------------+-----------------------------+
203204
| ARM | MMU-600 | #1076982,1209401| N/A |
204205
+----------------+-----------------+-----------------+-----------------------------+

drivers/iommu/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,18 @@ config ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT
367367
'arm-smmu.disable_bypass' will continue to override this
368368
config.
369369

370+
config ARM_SMMU_MMU_500_CPRE_ERRATA
371+
bool "Enable errata workaround for CPRE in SMMU reset path"
372+
depends on ARM_SMMU
373+
default y
374+
help
375+
Say Y here (by default) to apply workaround to disable
376+
MMU-500's next-page prefetcher for sake of 4 known errata.
377+
378+
Say N here only when it is sure that any errata related to
379+
prefetch enablement are not applicable on the platform.
380+
Refer silicon-errata.rst for info on errata IDs.
381+
370382
config ARM_SMMU_QCOM
371383
def_tristate y
372384
depends on ARM_SMMU && ARCH_QCOM

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ static struct arm_smmu_device *cavium_smmu_impl_init(struct arm_smmu_device *smm
110110
int arm_mmu500_reset(struct arm_smmu_device *smmu)
111111
{
112112
u32 reg, major;
113-
int i;
114113
/*
115114
* On MMU-500 r2p0 onwards we need to clear ACR.CACHE_LOCK before
116115
* writes to the context bank ACTLRs will stick. And we just hope that
@@ -128,18 +127,20 @@ int arm_mmu500_reset(struct arm_smmu_device *smmu)
128127
reg |= ARM_MMU500_ACR_SMTNMB_TLBEN | ARM_MMU500_ACR_S2CRB_TLBEN;
129128
arm_smmu_gr0_write(smmu, ARM_SMMU_GR0_sACR, reg);
130129

130+
#ifdef CONFIG_ARM_SMMU_MMU_500_CPRE_ERRATA
131131
/*
132132
* Disable MMU-500's not-particularly-beneficial next-page
133133
* prefetcher for the sake of at least 5 known errata.
134134
*/
135-
for (i = 0; i < smmu->num_context_banks; ++i) {
135+
for (int i = 0; i < smmu->num_context_banks; ++i) {
136136
reg = arm_smmu_cb_read(smmu, i, ARM_SMMU_CB_ACTLR);
137137
reg &= ~ARM_MMU500_ACTLR_CPRE;
138138
arm_smmu_cb_write(smmu, i, ARM_SMMU_CB_ACTLR, reg);
139139
reg = arm_smmu_cb_read(smmu, i, ARM_SMMU_CB_ACTLR);
140140
if (reg & ARM_MMU500_ACTLR_CPRE)
141141
dev_warn_once(smmu->dev, "Failed to disable prefetcher for errata workarounds, check SACR.CACHE_LOCK\n");
142142
}
143+
#endif
143144

144145
return 0;
145146
}

0 commit comments

Comments
 (0)