ARM: errata: LoUIS bit field in CLIDR register is incorrect
Subsystems (3)
PATCH 1/1 ARM: errata: LoUIS bit field in CLIDR register is incorrect
On Cortex-A9 before version r1p0, the LoUIS bit field of the CLIDR register returns zero when it should return one. This leads to cache maintenance operations which rely on this value to not function as intended, causing data corruption.
The workaround for this errata is to detect affected CPUs and correct the LoUIS value read.
We also selected this workaround in CONFIG_ARCH_VEXPRESS_CA9X4 as that platform is affected by the errata and as a consequence was suffering reboot and shutdown crashes since the cpu hotplug changes introduced in Linux 3.10. (Commit bca7a5a04933 "ARM: cpu hotplug: remove majority of cache flushing from platforms")
--- arch/arm/Kconfig | 10 ++++++++++ arch/arm/mach-vexpress/Kconfig | 1 + arch/arm/mm/cache-v7.S | 8 ++++++++ 3 files changed, 19 insertions(+)
arch/arm/Kconfig +10 -0
@@ -1189,6 +1189,16 @@ config PL310_ERRATA_588369 is not correctly implemented in PL310 as clean lines are not invalidated as a result of these operations. +config ARM_ERRATA_643719 + bool "ARM errata: LoUIS bit field in CLIDR register is incorrect" + depends on CPU_V7 + help + This option enables the workaround for the 643719 Cortex-A9 (prior to + r1p0) erratum. On affected cores the LoUIS bit field of the CLIDR + register returns zero when it should return one. The workaround + corrects this value, ensuring cache maintenance operations which use + it behave as intended and avoiding data corruption. + config ARM_ERRATA_720789 bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID" depends on CPU_V7
arch/arm/mach-vexpress/Kconfig +1 -0
@@ -56,5 +56,6 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA config ARCH_VEXPRESS_CA9X4 bool "Versatile Express Cortex-A9x4 tile" + select ARM_ERRATA_643719 endmenu
arch/arm/mm/cache-v7.S +8 -0
@@ -92,6 +92,14 @@ ENTRY(v7_flush_dcache_louis) mrc p15, 1, r0, c0, c0, 1 @ read clidr, r0 = clidr ALT_SMP(ands r3, r0, #(7 << 21)) @ extract LoUIS from clidr ALT_UP(ands r3, r0, #(7 << 27)) @ extract LoUU from clidr +#ifdef CONFIG_ARM_ERRATA_643719 + ALT_SMP(mrceq p15, 0, r2, c0, c0, 0) @ read main ID register + ALT_UP(moveq pc, lr) @ LoUU is zero, so nothing to do + biceq r2, r2, #0x0000000f @ clear minor revision number + ldreq r1, =0x410fc090 @ ID of ARM Cortex A9 r0p? + teqeq r2, r1 @ test for errata affected core and if so... + orreqs r3, #(1 << 21) @ fix LoUIS value (and set flags state to 'ne') +#endif ALT_SMP(mov r3, r3, lsr #20) @ r3 = LoUIS * 2 ALT_UP(mov r3, r3, lsr #26) @ r3 = LoUU * 2 moveq pc, lr @ return if level == 0
Signature · 1 line
1.7.10.4
PATCH 1/1 ARM: errata: LoUIS bit field in CLIDR register is incorrect
Quoted 26 lines · Jon Medhurst (Tixy)
On Cortex-A9 before version r1p0, the LoUIS bit field of the CLIDR register returns zero when it should return one. This leads to cache maintenance operations which rely on this value to not function as intended, causing data corruption.
The workaround for this errata is to detect affected CPUs and correct the LoUIS value read.
We also selected this workaround in
CONFIG_ARCH_VEXPRESS_CA9X4as that platform is affected by the errata and as a consequence was suffering reboot and shutdown crashes since the cpu hotplug changes introduced in Linux 3.10. (Commitbca7a5a04933"ARM: cpu hotplug: remove majority of cache flushing from platforms")Signed-off-by Jon Medhurst <[email protected]>--- arch/arm/Kconfig | 10 ++++++++++ arch/arm/mach-vexpress/Kconfig | 1 + arch/arm/mm/cache-v7.S | 8 ++++++++ 3 files changed, 19 insertions(+)arch/arm/Kconfig +0
-0
arch/arm/Kconfig config PL310_ERRATA_588369 · line 1194
Quoted 6 lines
arch/arm/Kconfig +3
-0@@ -1189,6 +1189,16 @@ config PL310_ERRATA_588369 is not correctly implemented in PL310 as clean lines are not invalidated as a result of these operations. +config ARM_ERRATA_643719 + bool "ARM errata: LoUIS bit field in CLIDR register is incorrect" + depends on CPU_V7
You could add an SMP dependency here too.
Quoted 15 lines
arch/arm/Kconfig +7
-0+ help + This option enables the workaround for the 643719 Cortex-A9 (prior to + r1p0) erratum. On affected cores the LoUIS bit field of the CLIDR + register returns zero when it should return one. The workaround + corrects this value, ensuring cache maintenance operations which use + it behave as intended and avoiding data corruption. + config ARM_ERRATA_720789 bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID" depends on CPU_V7arch/arm/mach-vexpress/Kconfig +0
-0
arch/arm/mach-vexpress/Kconfig config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA · line 59
Quoted 4 lines
arch/arm/mach-vexpress/Kconfig +1
-0@@ -56,5 +56,6 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA config ARCH_VEXPRESS_CA9X4 bool "Versatile Express Cortex-A9x4 tile" + select ARM_ERRATA_643719
We don't do this for any other workarounds, so I'd suggest either dropping this or having a separate patch adding all of those that are required.
Quoted 10 lines
arch/arm/mach-vexpress/Kconfig +0
-0endmenuarch/arm/mm/cache-v7.S +1
-0@@ -92,6 +92,14 @@ ENTRY(v7_flush_dcache_louis) mrc p15, 1, r0, c0, c0, 1 @ read clidr, r0 = clidr ALT_SMP(ands r3, r0, #(7 << 21)) @ extract LoUIS from clidr ALT_UP(ands r3, r0, #(7 << 27)) @ extract LoUU from clidr +#ifdef CONFIG_ARM_ERRATA_643719
arch/arm/mm/cache-v7.S ENTRY(v7_flush_dcache_louis) · line 105
Quoted 10 lines
arch/arm/mm/cache-v7.S +7
-0+ ALT_SMP(mrceq p15, 0, r2, c0, c0, 0) @ read main ID register + ALT_UP(moveq pc, lr) @ LoUU is zero, so nothing to do + biceq r2, r2, #0x0000000f @ clear minor revision number + ldreq r1, =0x410fc090 @ ID of ARM Cortex A9 r0p? + teqeq r2, r1 @ test for errata affected core and if so... + orreqs r3, #(1 << 21) @ fix LoUIS value (and set flags state to 'ne') +#endif ALT_SMP(mov r3, r3, lsr #20) @ r3 = LoUIS * 2 ALT_UP(mov r3, r3, lsr #26) @ r3 = LoUU * 2 moveq pc, lr @ return if level == 0
This part looks good to me:
Will
PATCH 1/1 ARM: errata: LoUIS bit field in CLIDR register is incorrect
Quoted 30 lines · Will Deacon
Quoted 29 lines · Jon Medhurst (Tixy)
On Cortex-A9 before version r1p0, the LoUIS bit field of the CLIDR register returns zero when it should return one. This leads to cache maintenance operations which rely on this value to not function as intended, causing data corruption.
The workaround for this errata is to detect affected CPUs and correct the LoUIS value read.
We also selected this workaround in
CONFIG_ARCH_VEXPRESS_CA9X4as that platform is affected by the errata and as a consequence was suffering reboot and shutdown crashes since the cpu hotplug changes introduced in Linux 3.10. (Commitbca7a5a04933"ARM: cpu hotplug: remove majority of cache flushing from platforms")Signed-off-by Jon Medhurst <[email protected]>--- arch/arm/Kconfig | 10 ++++++++++ arch/arm/mach-vexpress/Kconfig | 1 + arch/arm/mm/cache-v7.S | 8 ++++++++ 3 files changed, 19 insertions(+)arch/arm/Kconfig +0
-0@@ -1189,6 +1189,16 @@ config PL310_ERRATA_588369 is not correctly implemented in PL310 as clean lines are not invalidated as a result of these operations.
Quoted 5 lines
arch/arm/Kconfig config PL310_ERRATA_588369 · line 1194
Quoted 3 lines
arch/arm/Kconfig +3
-0+config ARM_ERRATA_643719 + bool "ARM errata: LoUIS bit field in CLIDR register is incorrect" + depends on CPU_V7You could add an SMP dependency here too.
OK.
Quoted 16 lines
Quoted 16 lines
arch/arm/Kconfig +7
-0+ help + This option enables the workaround for the 643719 Cortex-A9 (prior to + r1p0) erratum. On affected cores the LoUIS bit field of the CLIDR + register returns zero when it should return one. The workaround + corrects this value, ensuring cache maintenance operations which use + it behave as intended and avoiding data corruption. + config ARM_ERRATA_720789 bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID" depends on CPU_V7arch/arm/mach-vexpress/Kconfig +0
-0@@ -56,5 +56,6 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
Quoted 6 lines
arch/arm/mach-vexpress/Kconfig config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA · line 59
Quoted 3 lines
arch/arm/mach-vexpress/Kconfig +1
-0config ARCH_VEXPRESS_CA9X4 bool "Versatile Express Cortex-A9x4 tile" + select ARM_ERRATA_643719We don't do this for any other workarounds, so I'd suggest either dropping this or having a separate patch adding all of those that are required.
Not quite sure by what you mean by 'all of those that are required'. All the errata required for vexpress? Or all platforms which require the errata workaround?
If we don't enable the workaround in the Kconfig, then do we just add it to the vexpress_defconfig and hope people notice? Or, as we have ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA, we could select it in there?
Finally, whilst I'm asking questions ;-) I was hoping to fix a regression that slipped into 3.10, is this late -rc material or will it end up waiting for 3.11?
Quoted 25 lines
Quoted 11 lines
arch/arm/mach-vexpress/Kconfig +0
-0endmenuarch/arm/mm/cache-v7.S +1
-0@@ -92,6 +92,14 @@ ENTRY(v7_flush_dcache_louis) mrc p15, 1, r0, c0, c0, 1 @ read clidr, r0 = clidr ALT_SMP(ands r3, r0, #(7 << 21)) @ extract LoUIS from clidr ALT_UP(ands r3, r0, #(7 << 27)) @ extract LoUU from clidr +#ifdef CONFIG_ARM_ERRATA_643719arch/arm/mm/cache-v7.S ENTRY(v7_flush_dcache_louis) · line 105
Quoted 10 lines
arch/arm/mm/cache-v7.S +7
-0+ ALT_SMP(mrceq p15, 0, r2, c0, c0, 0) @ read main ID register + ALT_UP(moveq pc, lr) @ LoUU is zero, so nothing to do + biceq r2, r2, #0x0000000f @ clear minor revision number + ldreq r1, =0x410fc090 @ ID of ARM Cortex A9 r0p? + teqeq r2, r1 @ test for errata affected core and if so... + orreqs r3, #(1 << 21) @ fix LoUIS value (and set flags state to 'ne') +#endif ALT_SMP(mov r3, r3, lsr #20) @ r3 = LoUIS * 2 ALT_UP(mov r3, r3, lsr #26) @ r3 = LoUU * 2 moveq pc, lr @ return if level == 0This part looks good to me:
Acked-by Will Deacon <[email protected]>
Signature · 1 line
Tixy
PATCH 1/1 ARM: errata: LoUIS bit field in CLIDR register is incorrect
Quoted 14 lines · Jon Medhurst (Tixy)
Quoted 6 lines · Will Deacon
Quoted 6 lines
arch/arm/mach-vexpress/Kconfig +0
-0@@ -56,5 +56,6 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATAQuoted 6 lines
arch/arm/mach-vexpress/Kconfig config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA · line 59
Quoted 3 lines
arch/arm/mach-vexpress/Kconfig +1
-0config ARCH_VEXPRESS_CA9X4 bool "Versatile Express Cortex-A9x4 tile" + select ARM_ERRATA_643719We don't do this for any other workarounds, so I'd suggest either dropping this or having a separate patch adding all of those that are required.
Quoted 3 lines
Not quite sure by what you mean by 'all of those that are required'. All the errata required for vexpress? Or all platforms which require the errata workaround?
I mean, the A9 coretile on vexpress also has other errata, for which we have workarounds in the kernel. They aren't automatically selected (for example, ARM_ERRATA_720789) so if you want to do this, it's worth selecting all or none, rather than make it look like you're selecting all those that apply when you're not.
Quoted 3 lines
If we don't enable the workaround in the
Kconfig, then do we just add it to thevexpress_defconfigand hope people notice? Or, as we haveARCH_VEXPRESS_CORTEX_A5_A9_ERRATA, we could select it in there?
It doesn't affect A5, so I wouldn't put it there. The usual place is the defconfig.
Quoted 3 lines
Finally, whilst I'm asking questions ;-) I was hoping to fix a regression that slipped into 3.10, is this late -rc material or will it end up waiting for 3.11?
The fix to v7_flush_dcache_louis should go in for 3.10 and probably stable as well. I don't think the vexpress kconfig stuff is as important.
Will
PATCH 1/1 ARM: errata: LoUIS bit field in CLIDR register is incorrect
Quoted 19 lines · Will Deacon
Quoted 14 lines · Jon Medhurst (Tixy)
Quoted 6 lines · Will Deacon
Quoted 6 lines
arch/arm/mach-vexpress/Kconfig +0
-0@@ -56,5 +56,6 @@ config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATAQuoted 6 lines
arch/arm/mach-vexpress/Kconfig config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA · line 59
Quoted 3 lines
arch/arm/mach-vexpress/Kconfig +1
-0config ARCH_VEXPRESS_CA9X4 bool "Versatile Express Cortex-A9x4 tile" + select ARM_ERRATA_643719We don't do this for any other workarounds, so I'd suggest either dropping this or having a separate patch adding all of those that are required.
Quoted 3 lines
Not quite sure by what you mean by 'all of those that are required'. All the errata required for vexpress? Or all platforms which require the errata workaround?
Quoted 5 lines
I mean, the A9 coretile on vexpress also has other errata, for which we have workarounds in the kernel. They aren't automatically selected (for example,
ARM_ERRATA_720789) so if you want to do this, it's worth selecting all or none, rather than make it look like you're selecting all those that apply when you're not.
I think we _really_ should move towards selecting all the errata that apply on a per platform basis. We simply cannot expect everyone to be aware of the actual errata list that apply for a given platform. And as we move towards reducing the amount of defconfig files we need a reliable way to record which erratum applies to which platform.
Many platforms appear to do it already:
mach-bcm/Kconfig: select ARM_ERRATA_754322 mach-bcm/Kconfig: select ARM_ERRATA_764369 if SMP mach-bcm2835/Kconfig: select ARM_ERRATA_411920 mach-imx/Kconfig: select ARM_ERRATA_754322 mach-imx/Kconfig: select ARM_ERRATA_764369 if SMP mach-imx/Kconfig: select ARM_ERRATA_775420 mach-imx/Kconfig: select PL310_ERRATA_588369 if CACHE_PL310 mach-imx/Kconfig: select PL310_ERRATA_727915 if CACHE_PL310 mach-imx/Kconfig: select PL310_ERRATA_769419 if CACHE_PL310 mach-omap2/Kconfig: select ARM_ERRATA_720789 mach-omap2/Kconfig: select PL310_ERRATA_588369 mach-omap2/Kconfig: select PL310_ERRATA_727915 mach-omap2/Kconfig: select ARM_ERRATA_754322 mach-omap2/Kconfig: select ARM_ERRATA_775420 mach-tegra/Kconfig: select ARM_ERRATA_720789 mach-tegra/Kconfig: select ARM_ERRATA_754327 if SMP mach-tegra/Kconfig: select ARM_ERRATA_764369 if SMP mach-tegra/Kconfig: select PL310_ERRATA_727915 if CACHE_L2X0 mach-tegra/Kconfig: select PL310_ERRATA_769419 if CACHE_L2X0 mach-tegra/Kconfig: select ARM_ERRATA_754322 mach-tegra/Kconfig: select ARM_ERRATA_764369 if SMP mach-tegra/Kconfig: select PL310_ERRATA_769419 if CACHE_L2X0 mach-ux500/Kconfig: select ARM_ERRATA_754322 mach-ux500/Kconfig: select ARM_ERRATA_764369 if SMP mach-ux500/Kconfig: select PL310_ERRATA_753970 if CACHE_PL310
So if someone knowledgeable about applicable errata for VExpress could do the same that would be great. I agree that this should be a separate patch though.
Nicolas