Add L1 and L2 error detection for A53 and A57
Subsystems (2)
cover Add L1 and L2 error detection for A53 and A57
Hi All,
As mentioned by Marc and Mark usage of the implementation defined registers is not generally safe, they can't be used in virtualized environments or when EL3 already uses the same registers. This is probably the last attempt to get this upstream, I added an additional property to the CPU device nodes to be set explicitly when using these registers is safe and desired.
Sascha
Changes since v3:
- Add edac-enabled property to make EDAC support optional
Changes since v2:
- drop usage of virtual dt node (Robh)
- use read_sysreg_s instead of open coded variant (James Morse)
- separate error retrieving from error reporting
- use smp_call_function_single rather than smp_call_function_single_async
- make driver single instance and register all 'cpu' hierarchy up front once
Changes since v1:
- Split dt-binding into separate patch
- Sort local function variables in reverse-xmas tree order
- drop unnecessary comparison and make variable bool
Sascha Hauer (2):
drivers/edac: Add L1 and L2 error detection for A53 and A57
dt-bindings: arm: cpus: Add edac-enabled property
.../devicetree/bindings/arm/cpus.yaml | 6 + drivers/edac/Kconfig | 6 + drivers/edac/Makefile | 1 + drivers/edac/cortex_arm64_l1_l2.c | 221 ++++++++++++++++++ 4 files changed, 234 insertions(+) create mode 100644 drivers/edac/cortex_arm64_l1_l2.c
Signature · 1 line
2.20.1
PATCH 1/2 drivers/edac: Add L1 and L2 error detection for A53 and A57
The Cortex A53 and A57 cores have error detection capabilities for the L1/L2 Caches, this patch adds a driver for them.
Unfortunately there is no robust way to inject errors into the caches, so this driver doesn't contain any code to actually test it. It has been tested though with code taken from an older version of this driver found here: https://lkml.org/lkml/2018/3/14/1203. For reasons stated in this thread the error injection code is not suitable for mainline, so it is removed from the driver.
--- drivers/edac/Kconfig | 6 + drivers/edac/Makefile | 1 + drivers/edac/cortex_arm64_l1_l2.c | 218 ++++++++++++++++++++++++++++++ 3 files changed, 225 insertions(+) create mode 100644 drivers/edac/cortex_arm64_l1_l2.c
drivers/edac/Kconfig +6 -0
@@ -539,4 +539,10 @@ config EDAC_DMC520 Support for error detection and correction on the SoCs with ARM DMC-520 DRAM controller. +config EDAC_CORTEX_ARM64_L1_L2 + tristate "ARM Cortex A57/A53" + depends on ARM64 + help + Support for L1/L2 cache error detection on ARM Cortex A57 and A53. + endif # EDAC
drivers/edac/Makefile +1 -0
@@ -89,3 +89,4 @@ obj-$(CONFIG_EDAC_QCOM) += qcom_edac.o obj-$(CONFIG_EDAC_ASPEED) += aspeed_edac.o obj-$(CONFIG_EDAC_BLUEFIELD) += bluefield_edac.o obj-$(CONFIG_EDAC_DMC520) += dmc520_edac.o +obj-$(CONFIG_EDAC_CORTEX_ARM64_L1_L2) += cortex_arm64_l1_l2.o
drivers/edac/cortex_arm64_l1_l2.c new file +218 -0
218 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 2/2 dt-bindings: arm: cpus: Add edac-enabled property
In reply to Sascha HauerSome CPUs like the Cortex-A53 and Cortex-A57 have Error Detection And Correction (EDAC) support on their L1 and L2 caches. This is implemented in implementation defined registers, so usage of this functionality is not safe in virtualized environments or when EL3 already uses these registers.
This patch adds a edac-enabled flag which can be explicitly set when EDAC can be used.
--- Documentation/devicetree/bindings/arm/cpus.yaml | 6 ++++++ drivers/edac/cortex_arm64_l1_l2.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/cpus.yaml +6 -0
@@ -269,6 +269,12 @@ properties: For PSCI based platforms, the name corresponding to the index of the PSCI PM domain provider, must be "psci". + edac-enabled: + $ref: '/schemas/types.yaml#/definitions/flag' + description: + Some CPUs support Error Detection And Correction (EDAC) on their L1 and + L2 caches. This flag marks this function as usable. + qcom,saw: $ref: '/schemas/types.yaml#/definitions/phandle' description: |
drivers/edac/cortex_arm64_l1_l2.c +5 -2
@@ -190,8 +190,11 @@ static int __init cortex_arm64_edac_driver_init(void)for_each_possible_cpu (cpu) { np =of_get_cpu_node (cpu,NULL ); -if (of_match_node (cortex_arm64_edac_of_match, np)) -cpumask_set_cpu (cpu, &compat_mask); +if (!of_match_node (cortex_arm64_edac_of_match, np)) +continue ; +if (!of_property_read_bool (np,"edac-enabled" )) +continue ; +cpumask_set_cpu (cpu, &compat_mask); }if (cpumask_empty (&compat_mask))
Signature · 1 line
2.20.1
Re: [PATCH 2/2] dt-bindings: arm: cpus: Add edac-enabled property
Quoted 36 lines · Sascha Hauer
Some CPUs like the Cortex-A53 and Cortex-A57 have Error Detection And Correction (EDAC) support on their L1 and L2 caches. This is implemented in implementation defined registers, so usage of this functionality is not safe in virtualized environments or when EL3 already uses these registers.
This patch adds a edac-enabled flag which can be explicitly set when EDAC can be used.Signed-off-by Sascha Hauer <[email protected]>--- Documentation/devicetree/bindings/arm/cpus.yaml | 6 ++++++ drivers/edac/cortex_arm64_l1_l2.c | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/arm/cpus.yaml +6
-0@@ -269,6 +269,12 @@ properties: For PSCI based platforms, the name corresponding to the index of the PSCI PM domain provider, must be "psci". + edac-enabled: + $ref: '/schemas/types.yaml#/definitions/flag' + description: + Some CPUs support Error Detection And Correction (EDAC) on their L1 and + L2 caches. This flag marks this function as usable. + qcom,saw: $ref: '/schemas/types.yaml#/definitions/phandle' description: |drivers/edac/cortex_arm64_l1_l2.c +0
-0
drivers/edac/cortex_arm64_l1_l2.c static int __init cortex_arm64_edac_driver_init(void) · line 197
Quoted 10 lines
drivers/edac/cortex_arm64_l1_l2.c +5
-2@@ -190,8 +190,11 @@ static int __init cortex_arm64_edac_driver_init(void)for_each_possible_cpu (cpu) { np =of_get_cpu_node (cpu,NULL ); -if (of_match_node (cortex_arm64_edac_of_match, np)) -cpumask_set_cpu (cpu, &compat_mask); +if (!of_match_node (cortex_arm64_edac_of_match, np)) +continue ; +if (!of_property_read_bool (np,"edac-enabled" )) +continue ; +cpumask_set_cpu (cpu, &compat_mask);
Hum, this should be in patch 1/2 of course.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel