armv8: Enable CPUECTLR.SMPEN for coherency
PATCH 1/2 armv8: Enable CPUECTLR.SMPEN for coherency
From: Mingkai Hu <[email protected]>
For A53, data coherency is enabled only when the CPUECTLR.SMPEN bit is set. The SMPEN bit should be set before enabling the data cache. If not enabled, the cache is not coherent with other cores and data corruption could occur.
For A57/A72, SMPEN bit enables the processor to receive instruction cache and TLB maintenance operations broadcast from other processors in the cluster. This bit should be set before enabling the caches and MMU, or performing any cache and TLB maintenance operations.
--- arch/arm/cpu/armv8/Kconfig | 12 ++++++++++++ arch/arm/cpu/armv8/start.S | 11 +++++++++++ 2 files changed, 23 insertions(+)
arch/arm/cpu/armv8/Kconfig +12 -0
@@ -3,6 +3,18 @@ if ARM64 config ARMV8_MULTIENTRY bool "Enable multiple CPUs to enter into U-Boot" +config ARMV8_SET_SMPEN + bool "Enable data coherency with other cores in cluster" + help + Cortex A53/57/72 cores require CPUECTLR_EL1.SMPEN set even + for single core systems. Unfortunately write access to this + register may be controlled by EL3/EL2 firmware. To be more + precise, by default (if there is EL2/EL3 firmware running) + this register is RO for NS EL1. + This switch can be used to avoid writing to CPUECTLR_EL1, + it can be safely enabled when El2/EL3 initialized SMPEN bit + or when CPU implementation doesn't include that register. + config ARMV8_SPIN_TABLE bool "Support spin-table enable method" depends on ARMV8_MULTIENTRY && OF_LIBFDT
arch/arm/cpu/armv8/start.S +11 -0
@@ -86,6 +86,17 @@ save_boot_params_ret: msr cpacr_el1, x0 /* Enable FP/SIMD */ 0: + /* + * Enalbe SMPEN bit for coherency. + * This register is not architectural but at the moment + * this bit should be set for A53/A57/A72. + */ +#ifdef CONFIG_ARMV8_SET_SMPEN + mrs x0, S3_1_c15_c2_1 /* cpuactlr_el1 */ + orr x0, x0, #0x40 + msr S3_1_c15_c2_1, x0 +#endif + /* Apply ARM core specific erratas */ bl apply_core_errata
Signature · 1 line
2.1.0.27.g96db324
PATCH 2/2 ARMv8/fsl-layerscape: Enable data coherency between cores in cluster
From: Hou Zhiqiang <[email protected]>
--- arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +4 -0
@@ -1,5 +1,6 @@ config ARCH_LS1012A bool + select ARMV8_SET_SMPEN select FSL_LSCH2 select SYS_FSL_DDR_BE select SYS_FSL_MMDC
@@ -7,6 +8,7 @@ config ARCH_LS1012A config ARCH_LS1043A bool + select ARMV8_SET_SMPEN select FSL_LSCH2 select SYS_FSL_DDR_BE select SYS_FSL_DDR_VER_50
@@ -15,6 +17,7 @@ config ARCH_LS1043A config ARCH_LS1046A bool + select ARMV8_SET_SMPEN select FSL_LSCH2 select SYS_FSL_DDR_BE select SYS_FSL_DDR4
@@ -24,6 +27,7 @@ config ARCH_LS1046A config ARCH_LS2080A bool + select ARMV8_SET_SMPEN select FSL_LSCH3 select SYS_FSL_DDR4 select SYS_FSL_DDR_LE
Signature · 1 line
2.1.0.27.g96db324
PATCH 1/2 armv8: Enable CPUECTLR.SMPEN for coherency
In reply to Zhiqiang HouQuoted 56 lines · Zhiqiang Hou
From: Mingkai Hu <[email protected]>
For A53, data coherency is enabled only when the CPUECTLR.SMPEN bit is set. The SMPEN bit should be set before enabling the data cache. If not enabled, the cache is not coherent with other cores and data corruption could occur.
For A57/A72, SMPEN bit enables the processor to receive instruction cache and TLB maintenance operations broadcast from other processors in the cluster. This bit should be set before enabling the caches and MMU, or performing any cache and TLB maintenance operations.
Signed-off-by Mingkai Hu <[email protected]>Signed-off-by Gong Qianyu <[email protected]>Signed-off-by Mateusz Kulikowski <[email protected]>Signed-off-by Hou Zhiqiang <[email protected]>--- arch/arm/cpu/armv8/Kconfig | 12 ++++++++++++ arch/arm/cpu/armv8/start.S | 11 +++++++++++ 2 files changed, 23 insertions(+)arch/arm/cpu/armv8/Kconfig +12
-0@@ -3,6 +3,18 @@ if ARM64 config ARMV8_MULTIENTRY bool "Enable multiple CPUs to enter into U-Boot" +config ARMV8_SET_SMPEN + bool "Enable data coherency with other cores in cluster" + help + Cortex A53/57/72 cores require CPUECTLR_EL1.SMPEN set even + for single core systems. Unfortunately write access to this + register may be controlled by EL3/EL2 firmware. To be more + precise, by default (if there is EL2/EL3 firmware running) + this register is RO for NS EL1. + This switch can be used to avoid writing to CPUECTLR_EL1, + it can be safely enabled when El2/EL3 initialized SMPEN bit + or when CPU implementation doesn't include that register. + config ARMV8_SPIN_TABLE bool "Support spin-table enable method" depends on ARMV8_MULTIENTRY && OF_LIBFDTarch/arm/cpu/armv8/start.S +4
-0@@ -86,6 +86,17 @@ save_boot_params_ret: msr cpacr_el1, x0 /* Enable FP/SIMD */ 0: + /* + * Enalbe SMPEN bit for coherency. + * This register is not architectural but at the moment + * this bit should be set for A53/A57/A72.
arch/arm/cpu/armv8/start.S save_boot_params_ret: · line 102
Quoted 10 lines
arch/arm/cpu/armv8/start.S +7
-0+ */ +#ifdef CONFIG_ARMV8_SET_SMPEN + mrs x0, S3_1_c15_c2_1 /* cpuactlr_el1 */ + orr x0, x0, #0x40 + msr S3_1_c15_c2_1, x0 +#endif + /* Apply ARM core specific erratas */ bl apply_core_errata
Would it be a good idea to detect the core and apply this setting at run time, instead of using Kconfig option? Check the macro branch_if_a53_core, branch_if_a57_core for example.
York
PATCH 1/2 armv8: Enable CPUECTLR.SMPEN for coherency
Quoted 63 lines · york sun
Quoted 62 lines · Zhiqiang Hou
From: Mingkai Hu <[email protected]>
For A53, data coherency is enabled only when the CPUECTLR.SMPEN bit is set. The SMPEN bit should be set before enabling the data cache. If not enabled, the cache is not coherent with other cores and data corruption could occur.
For A57/A72, SMPEN bit enables the processor to receive instruction cache and TLB maintenance operations broadcast from other processors in the cluster. This bit should be set before enabling the caches and MMU, or performing any cache and TLB maintenance operations.
Signed-off-by Mingkai Hu <[email protected]>Signed-off-by Gong Qianyu <[email protected]>Signed-off-by Mateusz Kulikowski <[email protected]>Signed-off-by Hou Zhiqiang <[email protected]>--- arch/arm/cpu/armv8/Kconfig | 12 ++++++++++++ arch/arm/cpu/armv8/start.S | 11 +++++++++++ 2 files changed, 23 insertions(+)arch/arm/cpu/armv8/Kconfig +12
-0@@ -3,6 +3,18 @@ if ARM64 config ARMV8_MULTIENTRY bool "Enable multiple CPUs to enter into U-Boot" +config ARMV8_SET_SMPEN + bool "Enable data coherency with other cores in cluster" + help + Cortex A53/57/72 cores require CPUECTLR_EL1.SMPEN set even + for single core systems. Unfortunately write access to this + register may be controlled by EL3/EL2 firmware. To be more + precise, by default (if there is EL2/EL3 firmware running) + this register is RO for NS EL1. + This switch can be used to avoid writing to CPUECTLR_EL1, + it can be safely enabled when El2/EL3 initialized SMPEN bit + or when CPU implementation doesn't include that register. + config ARMV8_SPIN_TABLE bool "Support spin-table enable method" depends on ARMV8_MULTIENTRY && OF_LIBFDTarch/arm/cpu/armv8/start.S +10
-0@@ -86,6 +86,17 @@ save_boot_params_ret: msr cpacr_el1, x0 /* Enable FP/SIMD */ 0: + /* + * Enalbe SMPEN bit for coherency. + * This register is not architectural but at the moment + * this bit should be set for A53/A57/A72. + */ +#ifdef CONFIG_ARMV8_SET_SMPEN + mrs x0, S3_1_c15_c2_1 /* cpuactlr_el1 */ + orr x0, x0, #0x40 + msr S3_1_c15_c2_1, x0 +#endif
Quoted 9 lines
arch/arm/cpu/armv8/start.S save_boot_params_ret: · line 102
Quoted 4 lines
arch/arm/cpu/armv8/start.S +1
-0+ /* Apply ARM core specific erratas */ bl apply_core_errataWould it be a good idea to detect the core and apply this setting at run time, instead of using
Kconfigoption? Check the macrobranch_if_a53_core,branch_if_a57_corefor example.
I think we need to look back at the discussion from the last time we made a change around here, and make sure to fully understand what platforms do and do not need / want to touch that. See d73718f3236c520a92efa401084c658e6cc067f3 and then 3a592a1349ac3961b0f4f2db0a8d9f128225d897.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161215/4d8831c8/attachment.sig>
PATCH 1/2 armv8: Enable CPUECTLR.SMPEN for coherency
Quoted 7 lines · Tom Rini
Quoted 5 lines · york sun
Would it be a good idea to detect the core and apply this setting at run time, instead of using
Kconfigoption? Check the macrobranch_if_a53_core,branch_if_a57_corefor example.
Quoted 6 lines
I think we need to look back at the discussion from the last time we made a change around here, and make sure to fully understand what platforms do and do not need / want to touch that. See
d73718f3236c520a92efa401084c658e6cc067f3and then3a592a1349ac3961b0f4f2db0a8d9f128225d897.
Tom,
Thanks for the reminder. Yes we need to understand which platform really needs this change. The author suggested using Kconfig option. It can surely avoid applying this change blindly.
York
PATCH 1/2 armv8: Enable CPUECTLR.SMPEN for coherency
Quoted 15 lines · york sun
Quoted 7 lines · Tom Rini
Quoted 5 lines · york sun
Would it be a good idea to detect the core and apply this setting at run time, instead of using
Kconfigoption? Check the macrobranch_if_a53_core,branch_if_a57_corefor example.Quoted 6 lines
I think we need to look back at the discussion from the last time we made a change around here, and make sure to fully understand what platforms do and do not need / want to touch that. See
d73718f3236c520a92efa401084c658e6cc067f3and then3a592a1349ac3961b0f4f2db0a8d9f128225d897.
Quoted 5 lines
Tom,
Thanks for the reminder. Yes we need to understand which platform really needs this change. The author suggested using
Kconfigoption. It can surely avoid applying this change blindly.
Yes. I think this series as-is will be safe in that it's only being enabled on NXP platforms that have (I will assume) all been tested with the change. But even for this series I want to make sure it's clear when/why it would be needed and the Kconfig help should reflect that information. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161215/d5e0f61a/attachment.sig>
PATCH 1/2 armv8: Enable CPUECTLR.SMPEN for coherency
In reply to Zhiqiang Hou2016-12-15 15:08 GMT+09:00 Zhiqiang Hou <[email protected]>:
Quoted 31 lines
From: Mingkai Hu <[email protected]>
For A53, data coherency is enabled only when the CPUECTLR.SMPEN bit is set. The SMPEN bit should be set before enabling the data cache. If not enabled, the cache is not coherent with other cores and data corruption could occur.
For A57/A72, SMPEN bit enables the processor to receive instruction cache and TLB maintenance operations broadcast from other processors in the cluster. This bit should be set before enabling the caches and MMU, or performing any cache and TLB maintenance operations.
Signed-off-by Mingkai Hu <[email protected]>Signed-off-by Gong Qianyu <[email protected]>Signed-off-by Mateusz Kulikowski <[email protected]>Signed-off-by Hou Zhiqiang <[email protected]>--- arch/arm/cpu/armv8/Kconfig | 12 ++++++++++++ arch/arm/cpu/armv8/start.S | 11 +++++++++++ 2 files changed, 23 insertions(+)arch/arm/cpu/armv8/Kconfig +2
-0@@ -3,6 +3,18 @@ if ARM64 config ARMV8_MULTIENTRY bool "Enable multiple CPUs to enter into U-Boot" +config ARMV8_SET_SMPEN + bool "Enable data coherency with other cores in cluster"
arch/arm/cpu/armv8/Kconfig if ARM64 · line 17
Quoted 10 lines
arch/arm/cpu/armv8/Kconfig +10
-0+ help + Cortex A53/57/72 cores require CPUECTLR_EL1.SMPEN set even + for single core systems. Unfortunately write access to this + register may be controlled by EL3/EL2 firmware. To be more + precise, by default (if there is EL2/EL3 firmware running) + this register is RO for NS EL1. + This switch can be used to avoid writing to CPUECTLR_EL1, + it can be safely enabled when El2/EL3 initialized SMPEN bit + or when CPU implementation doesn't include that register. +
If you run ARM Trusted Firmware, this bit has already been set correctly. (or if you implement your own trusted firmware, this bit should be set there.)
In those cases, there is no need to touch it in U-Boot.
The motivation for this commit is
to boot the system without any firmware before U-Boot?
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/2 armv8: Enable CPUECTLR.SMPEN for coherency
Hi Masahiro Yamada,
Thanks a lot for your comments!
Quoted 57 lines
-----Original Message-----
From: Masahiro Yamada [mailto:yamada.masahiro at socionext.com]
Sent: 2016?12?19? 0:49
To: Z.Q. Hou <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Albert ARIBAUD <[email protected]>; Simon Glass <[email protected]>; Mingkai Hu <[email protected]>; york sun <[email protected]>; Ashish Kumar <[email protected]>; Mateusz Kulikowski <[email protected]>; Tom Rini <[email protected]>
Subject: Re: [U-Boot] [PATCH 1/2] armv8: Enable CPUECTLR.SMPEN for coherency2016-12-15 15:08 GMT+09:00 Zhiqiang Hou <[email protected]>:
Quoted 26 lines
From: Mingkai Hu <[email protected]>
For A53, data coherency is enabled only when the CPUECTLR.SMPEN bit is set. The SMPEN bit should be set before enabling the data cache. If not enabled, the cache is not coherent with other cores and data corruption could occur.
For A57/A72, SMPEN bit enables the processor to receive instruction cache and TLB maintenance operations broadcast from other processors in the cluster. This bit should be set before enabling the caches and MMU, or performing any cache and TLB maintenance operations.
Signed-off-by Mingkai Hu <[email protected]>Signed-off-by Gong Qianyu <[email protected]>Signed-off-by Mateusz Kulikowski <[email protected]>Signed-off-by Hou Zhiqiang <[email protected]>--- arch/arm/cpu/armv8/Kconfig | 12 ++++++++++++ arch/arm/cpu/armv8/start.S | 11 +++++++++++ 2 files changed, 23 insertions(+)arch/arm/cpu/armv8/Kconfig +0
-0arch/arm/cpu/armv8/Kconfig if ARM64 · line 9
Quoted 7 lines
arch/arm/cpu/armv8/Kconfig +4
-0@@ -3,6 +3,18 @@ if ARM64 config ARMV8_MULTIENTRY bool "Enable multiple CPUs to enter into U-Boot" +config ARMV8_SET_SMPEN + bool "Enable data coherency with other cores in cluster" + help + Cortex A53/57/72 cores require CPUECTLR_EL1.SMPEN seteven
arch/arm/cpu/armv8/Kconfig if ARM64 · line 17
Quoted 8 lines
arch/arm/cpu/armv8/Kconfig +8
-0+ for single core systems. Unfortunately write access to this + register may be controlled by EL3/EL2 firmware. To be more + precise, by default (if there is EL2/EL3 firmware running) + this register is RO for NS EL1. + This switch can be used to avoid writing to CPUECTLR_EL1, + it can be safely enabled when El2/EL3 initialized SMPEN bit + or when CPU implementation doesn't include that register. +
Quoted 7 lines
If you run ARM Trusted Firmware, this bit has already been set correctly. (or if you implement your own trusted firmware, this bit should be set there.) In those cases, there is no need to touch it in U-Boot.
The motivation for this commit is
to boot the system without any firmware before U-Boot?
Yes
Thanks,
Zhiqiang