Skip to contentSkip to conversation

edac: nxp: Add L1 and L2 error detection for A53 and A72 cores

PATCH In review Alison Wang 3 participants 7 messages Jul 9, 2020 – Aug 27, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 edac: nxp: Add L1 and L2 error detection for A53 and A72 cores

Add error detection for A53 and A72 cores. Hardware error injection is supported on A53. Software error injection is supported on both. For hardware error injection on A53 to work, proper access to L2ACTLR_EL1, CPUACTLR_EL1 needs to be granted by EL3 firmware. This is done by making an SMC call in the driver. Failure to enable access disables hardware error injection. For error detection to work, another SMC call enables access to L2ECTLR_EL1.

It is for NXP's Layerscape family LS1043A, LS1046A, LS2088A and LX2160A.

---
 .../bindings/edac/cortex-arm64-edac.txt       |  40 +
 drivers/edac/Kconfig                          |   7 +
 drivers/edac/Makefile                         |   1 +
 drivers/edac/cortex_arm64_l1_l2.c             | 738 ++++++++++++++++++
 drivers/edac/cortex_arm64_l1_l2.h             |  54 ++
 5 files changed, 840 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt
 create mode 100644 drivers/edac/cortex_arm64_l1_l2.c
 create mode 100644 drivers/edac/cortex_arm64_l1_l2.h
Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt new file +40 -0
new file mode 100644
index 000000000000..41c840993814
@@ -0,0 +1,40 @@
+ARM Cortex A53 and A72 L1/L2 cache error reporting
+
+CPU Memory Error Syndrome and L2 Memory Error Syndrome registers can be
+used for checking L1 and L2 memory errors. However, only A53 supports
+double-bit error injection to L1 and L2 memory. This driver uses the
+hardware error injection when available, but also provides a way to
+inject errors by software.
+
+To use hardware error injection and the interrupt, proper access needs
+to be granted in ACTLR_EL3 (and/or ACTLR_EL2) register by EL3 firmware SMC call.
+
+Correctable errors do not trigger such interrupt. This driver uses
+dynamic polling internal to check for errors. The more errors detected,
+the more frequently it polls. Combining with interrupt, this driver can
+detect correctable and uncorrectable errors. However, if the
+uncorrectable errors cause system abort exception, this driver is not able to
+report errors in time.
+
+The SIP-specific SMC calls are only for NXP's Layerscape family LS1043A,
+LS1046A, LS2088A and LX2160A.
+
+The following section describes the Cortex A53/A72 EDAC DT node binding.
+
+Required properties:
+- compatible: Should be "arm,cortex-a53-edac" or "arm,cortex-a72-edac"
+- cpus: Should be a list of compatible cores
+
+Optional properties:
+- interrupts: Interrupt number if supported
+
+Example:
+	edac {
+		compatible = "arm,cortex-a53-edac";
+		cpus = <&cpu0>,
+		       <&cpu1>,
+		       <&cpu2>,
+		       <&cpu3>;
+		interrupts = <0 108 0x4>;
+
+	};
drivers/edac/Kconfig +7 -0
index 7b6ec3014ba2..6317cebf0a95 100644
@@ -530,4 +530,11 @@ 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 A53/A72"
+	depends on ARM64 && ARCH_LAYERSCAPE
+	help
+	  Support for error detection on ARM Cortex A53 and A72 with Layerscape
+	  SoC family LS1043A, LS1046A, LS2088A and LX2160A.
+
 endif # EDAC
drivers/edac/Makefile +1 -0
index 269e15118cea..3edba6bea350 100644
@@ -88,3 +88,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 +738 -0

738 lines not on this page · raw message

drivers/edac/cortex_arm64_l1_l2.h new file +54 -0

54 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 12 lines · Alison Wang

Add error detection for A53 and A72 cores. Hardware error injection is supported on A53. Software error injection is supported on both. For hardware error injection on A53 to work, proper access to L2ACTLR_EL1, CPUACTLR_EL1 needs to be granted by EL3 firmware. This is done by making an SMC call in the driver. Failure to enable access disables hardware error injection. For error detection to work, another SMC call enables access to L2ECTLR_EL1.

It is for NXP's Layerscape family LS1043A, LS1046A, LS2088A and LX2160A.

Quoted 10 lines
---
 .../bindings/edac/cortex-arm64-edac.txt       |  40 +
 drivers/edac/Kconfig                          |   7 +
 drivers/edac/Makefile                         |   1 +
 drivers/edac/cortex_arm64_l1_l2.c             | 738 ++++++++++++++++++
 drivers/edac/cortex_arm64_l1_l2.h             |  54 ++
 5 files changed, 840 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt
 create mode 100644 drivers/edac/cortex_arm64_l1_l2.c
 create mode 100644 drivers/edac/cortex_arm64_l1_l2.h

This needs James to have a look at.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#2 lore raw
In reply to Alison Wang

Hi Alison,

Quoted 5 lines · Alison Wang

Add error detection for A53 and A72 cores. Hardware error injection is supported on A53. Software error injection is supported on both.

For hardware error injection on A53 to work, proper access to L2ACTLR_EL1, CPUACTLR_EL1 needs to be granted by EL3 firmware.

Not just hardware error injection, any access to these registers needs to be granted by each higher exception level. If you run as a KVM guest, all access to these implementation-defined registers is disabled.

This means your driver doesn't work on:
| compatible = "arm,cortex-a53-edac" or "arm,cortex-a72-edac",

as it also depends on firmware settings.

Writing to CPUACTLR_EL1 isn't something we can do in linux. The TRM has this clanger:

| The CPU Auxiliary Control Register can be written only when the system is idle. ARM
| recommends that you write to this register after a powerup reset, before the MMU is
| enabled, and before any ACE or ACP traffic begins.

We can't make the system idle from linux. Only firmware can do this.

The same goes for L2ACTLR.

Quoted 4 lines

This is
done by making an SMC call in the driver. Failure to enable access disables hardware error injection. For error detection to work, another SMC call enables access to L2ECTLR_EL1.

Ewww. Surely this should either be enabled, or disabled. What is the point of letting the OS toggle it?

Using these registers, you can do dangerous things like turn the L2 cache off. Does your platform have any resident secure-world software?

Quoted 1 line

It is for NXP's Layerscape family LS1043A, LS1046A, LS2088A and LX2160A.

Please ensure your driver probes from the top-level platform compatible. This is the only way to know the platform has your firmware, with the special settings and magic SMC call that the driver depends on.

Quoted 2 lines

Who is the author of this patch?

If the first Signed-of-by tag isn't for the person posting the patch, there should be a 'From:' line in the patch so that git picks up the author properly when the maintainer applies the patch.
If you set the author of the patch correctly in git, git format-patch will do the right thing for you.

Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt

Quoted 4 lines
Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt new file +0 -0
index 000000000000..41c840993814

Binding patches should be in a separate patch, that appears first in the series. The whole series should be copied to the devicetree mailing list: [email protected]

You should also run get-maintainers.pl to ensure you copy the devicetree maintainers.

Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt line 10

Quoted 11 lines
Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt new file +10 -0
@@ -0,0 +1,40 @@
+ARM Cortex A53 and A72 L1/L2 cache error reporting
+
+CPU Memory Error Syndrome and L2 Memory Error Syndrome registers can be
+used for checking L1 and L2 memory errors. However, only A53 supports
+double-bit error injection to L1 and L2 memory. This driver uses the
+hardware error injection when available, but also provides a way to
+inject errors by software.
+
+To use hardware error injection and the interrupt, proper access needs
+to be granted in ACTLR_EL3 (and/or ACTLR_EL2) register by EL3 firmware SMC call.

Please describe this as "on $platforms this is done by".
On others it may be enabled already, or not possible to enable at all.

Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt line 11

Quoted 1 line
Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt new file +1 -0
+Correctable errors do not trigger such interrupt.

What interrupt?

Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt line 17

Quoted 6 lines

This driver uses

Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt new file +5 -0
+dynamic polling internal to check for errors. The more errors detected,
+the more frequently it polls. Combining with interrupt, this driver can
+detect correctable and uncorrectable errors. However, if the
+uncorrectable errors cause system abort exception, this driver is not able to
+report errors in time.

The driver isn't involved in correct-ing the errors, this was already done, or not-done, by the hardware.
Please describe this as 'corrected and uncorrected', as the state is pretty final.

Quoted 12 lines
Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt new file +12 -0
+The SIP-specific SMC calls are only for NXP's Layerscape family LS1043A,
+LS1046A, LS2088A and LX2160A.
+
+The following section describes the Cortex A53/A72 EDAC DT node binding.
+
+Required properties:
+- compatible: Should be "arm,cortex-a53-edac" or "arm,cortex-a72-edac"
+- cpus: Should be a list of compatible cores
+
+Optional properties:
+- interrupts: Interrupt number if supported
+

Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt line 40

Quoted 10 lines
Documentation/devicetree/bindings/edac/cortex-arm64-edac.txt new file +10 -0
+Example:
+	edac {
+		compatible = "arm,cortex-a53-edac";
+		cpus = <&cpu0>,
+		       <&cpu1>,
+		       <&cpu2>,
+		       <&cpu3>;
+		interrupts = <0 108 0x4>;
+
+	};

Because this depends on firmware, please make this depend on the top-level compatible for the whole platform.

It might be worth describing the SMC calls in the binding if its likely anyone else will use the driver. (matching a platform, but no SMC defined would imply the access is always enabled).

But the DT people will have the best view on what is best here.

drivers/edac/Kconfig config EDAC_DMC520 · line 535

Quoted 11 lines
drivers/edac/Kconfig +2 -0
index 7b6ec3014ba2..6317cebf0a95 100644
@@ -530,4 +530,11 @@ 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 A53/A72"

Please pick a name that indicates this driver is for layerscape socs.

Quoted 14 lines
drivers/edac/Kconfig +5 -0
+	depends on ARM64 && ARCH_LAYERSCAPE
 
+	help
+	  Support for error detection on ARM Cortex A53 and A72 with Layerscape
+	  SoC family LS1043A, LS1046A, LS2088A and LX2160A.
+
 endif # EDAC
drivers/edac/Makefile +0 -0
index 269e15118cea..3edba6bea350 100644

drivers/edac/Makefile obj-$(CONFIG_EDAC_QCOM) += qcom_edac.o · line 91

Quoted 5 lines
drivers/edac/Makefile +1 -0
@@ -88,3 +88,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

'cortex' is a large number of CPUs. There is no guarantee these implementation-defined registers behave in the same way on other versions. (we'd have to check each and every TRM)

The driver depends on your platform firmare, and doesn't build unless you select ARCH_LAYERSCAPE.

Can I suggest naming it a53a72, or layerscape_cpu... ?

Quoted 32 lines
drivers/edac/cortex_arm64_l1_l2.c new file +26 -0
new file mode 100644
index 000000000000..0443384bd656
@@ -0,0 +1,738 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Cortex A53 and A72 EDAC L1 and L2 cache error detection
+ *
+ * Copyright 2018-2020 NXP
+ * Author: York Sun <[email protected]>
+ *
+ * Partially take from a similar driver by
+ * Brijesh Singh <[email protected]>
+ * Copyright (c) 2015, Advanced Micro Devices
+ */
+
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/of_device.h>
+#include <linux/arm-smccc.h>
+#include <asm/barrier.h>
+#include <asm/cacheflush.h>
+#include <asm/smp_plat.h>
+
+#include "edac_module.h"
+#include "cortex_arm64_l1_l2.h"
+
+static int poll_msec = 1024;
+static long l1_ce_sw_inject_count, l1_ue_sw_inject_count;
+static long l2_ce_sw_inject_count, l2_ue_sw_inject_count;

drivers/edac/cortex_arm64_l1_l2.c line 35

Quoted 10 lines
drivers/edac/cortex_arm64_l1_l2.c new file +9 -0
+static struct cpumask compat_mask;
+static struct cpumask l1_ce_cpu_mask, l1_ue_cpu_mask;
+static struct cpumask l2_ce_cpu_mask, l2_ue_cpu_mask;
 
+static DEFINE_PER_CPU(unsigned long, actlr_en);
+static DEFINE_PER_CPU(unsigned long, l2ectlr_en);
+static DEFINE_PER_CPU(u64, cpumerr);
+static DEFINE_PER_CPU(u64, cpuactlr);
+static DEFINE_PER_CPU(u64, l2actlr);
+static DEFINE_PER_CPU(u64, l2merr);

There are already per-cpu copies of all these in the hardware. Why would you need to read it from another CPU?

drivers/edac/cortex_arm64_l1_l2.c line 44

Quoted 10 lines
drivers/edac/cortex_arm64_l1_l2.c new file +7 -0
+static DEFINE_PER_CPU(call_single_data_t, csd_check);
+static DEFINE_SPINLOCK(cortex_edac_lock);
 
 
+static inline void read_cpuactlr(void *info)
+{
+	u64 val;
+	int cpu = smp_processor_id();
 
+	asm volatile("mrs %0, S3_1_C15_C2_0" : "=r" (val));

There are versions of binutils that choke on this. See 72c583951526 for the story.

Please define a SYS_CPUACTLR_EL1 for this using the sys_reg() macro. It may as well be private in this file.
Please use the read_sysreg() acessors as this makes for more readable code.

drivers/edac/cortex_arm64_l1_l2.c line 45

Quoted 1 line
drivers/edac/cortex_arm64_l1_l2.c new file +1 -0
+	per_cpu(cpuactlr, cpu) = val;

Why not return the value? We already have a per cpu copy of this register: in the register.

Quoted 1 line

+}

With the right macros, this is nothing more than:
| return read_sysreg_s(SYS_CPUACTLR_EL1)

Quoted 1 line

+static inline void write_cpuactlr(int *mem)

We can't write to CPUACTLR_EL1 when the system is running. I don't think we can have this code.

(and write_cpuactlr() is a terrible name! it does lots more than that!)

drivers/edac/cortex_arm64_l1_l2.c line 59

Quoted 11 lines
drivers/edac/cortex_arm64_l1_l2.c new file +10 -0
+{
+	u64 val;
+	int cpu;
+	unsigned long flags;
+
+	spin_lock_irqsave(&cortex_edac_lock, flags);
+	cpu = smp_processor_id();
+	__flush_dcache_area(mem, 8);
+	asm volatile("mrs %0, S3_1_C15_C2_0" : "=r" (val));
 
+	val |= L1_ERR_INJ_EN;

The TRM calls this 'L1DEIEN', using the same name as the TRM makes it a lot easier to find what this does:
| Double-bit errors are injected on all writes to the L1 D-cache data RAMs for the first | word of each 32-byte region.

What happens if your firmware takes an interrupt? Now the CPU will report faults for the work firmware is doing.
What happens if the compiler decides to write to the stack while you have this set?

The TRM says not to write to this register unless the system is idle and the MMU is off. We really can't do this in Linux.

drivers/edac/cortex_arm64_l1_l2.c line 71

Quoted 13 lines
drivers/edac/cortex_arm64_l1_l2.c new file +12 -0
+	asm volatile("dsb sy");
+	asm volatile("msr S3_1_C15_C2_0, %0" :: "r" (val));
+	asm volatile("isb sy");
 
+	/* make cache dirty */
+	*mem = 0xDEADBEEF;	/* write to L1 data causes error right away */
+	__flush_dcache_area(mem, 8);
+	val &= ~L1_ERR_INJ_EN;
+	asm volatile("dsb sy");
+	asm volatile("msr S3_1_C15_C2_0, %0" :: "r" (val));
+	asm volatile("isb sy");
+	spin_unlock_irqrestore(&cortex_edac_lock, flags);
+}

For where they appear elsewhere, please use the macros in asm/barrier.h. For DSB, please add a comment to describe what you need it for.

drivers/edac/cortex_arm64_l1_l2.c line 80

Quoted 8 lines
drivers/edac/cortex_arm64_l1_l2.c new file +8 -0
+static inline void read_l2actlr(void *info)
+{
+	u64 val;
+	int cpu = smp_processor_id();
+
+	asm volatile("mrs %0, S3_1_C15_C0_0" : "=r" (val));
+	per_cpu(l2actlr, cpu) = val;
+}

return read_sysreg_s(SYS_L2ACTLR_EL1)

Quoted 12 lines
drivers/edac/cortex_arm64_l1_l2.c new file +12 -0
+
+static inline void write_l2actlr(int *mem)
+{
+	u64 val;
+	unsigned long flags;
+
+	spin_lock_irqsave(&cortex_edac_lock, flags);
+	__flush_dcache_area(mem, 8);
+	asm volatile("mrs %0, S3_1_C15_C0_0" : "=r" (val));
+	val |= L2D_ERR_INJ_EN;
+	asm volatile("dsb sy");
+	asm volatile("msr S3_1_C15_C0_0, %0" :: "r" (val));

drivers/edac/cortex_arm64_l1_l2.c line 102

Quoted 10 lines
drivers/edac/cortex_arm64_l1_l2.c new file +10 -0
+	asm volatile("isb sy");
+	/* make cache dirty */
+	*mem = 0xDEADBEEF;	/* Error will be reported when L2 is accessed. */
+	__flush_dcache_area(mem, 8);
+	val &= ~L2D_ERR_INJ_EN;
+	asm volatile("dsb sy");
+	asm volatile("msr S3_1_C15_C0_0, %0" :: "r" (val));
+	asm volatile("isb sy");
+	spin_unlock_irqrestore(&cortex_edac_lock, flags);
+}

We can't do this in Linux.

Quoted 20 lines
drivers/edac/cortex_arm64_l1_l2.c new file +20 -0
+static inline void write_l2ectlr_el1(void *info)
+{
+	u64 val;
+	int cpu = smp_processor_id();
+
+	asm volatile("mrs %0, S3_1_C11_C0_3" : "=r" (val));
+	if (val & L2_ERR_INT) {
+		pr_debug("l2ectlr_el1 on cpu %d reads 0x%llx\n", cpu, val);
+		val &= ~L2_ERR_INT;
+		asm volatile("msr S3_1_C11_C0_3, %0" :: "r" (val));
+	}
+}
+
+static inline void write_cpumerrsr_el1(u64 val)
+{
+	asm volatile("msr s3_1_c15_c2_2, %0" :: "r" (val));
+}
+
+static void a53_allow_l1l2_err_inj(void *info)
+{

drivers/edac/cortex_arm64_l1_l2.c line 132

Quoted 10 lines
drivers/edac/cortex_arm64_l1_l2.c new file +9 -0
+	int cpu = smp_processor_id();
+	struct arm_smccc_res res;
+	unsigned long flags;
+
+	pr_debug("%s: cpu is %d\n", __func__, cpu);
+	spin_lock_irqsave(&cortex_edac_lock, flags);
 
+	arm_smccc_smc(NXP_SIP_SVC_ALLOW_L1L2_ERR, 0, 0, 0, 0, 0, 0, 0, &res);
+	per_cpu(actlr_en, cpu) = res.a0;
+	spin_unlock_irqrestore(&cortex_edac_lock, flags);

How do you know firmware implements this SMC? Your driver compatible was jut for the CPU.

This returns something. Please document what in the binding as someone else may implement it for their A53/A72.

If you're returning a CPUACTLR_EL1 value, the OS can just read it from the register, which should make the SMC call (and its description) simpler.

drivers/edac/cortex_arm64_l1_l2.c

Quoted 2 lines
drivers/edac/cortex_arm64_l1_l2.c new file +2 -0
+	pr_debug("%s: return is %ld\n", __func__, res.a0);
+}

As we can't safely write to these registers from linux, so I think this means all the error injection and maybe SMC stuff can disappear.

(I've not read past here..)

Thanks,

James

#3 lore raw

Hi, James,

Quoted 4 lines · Alison Wang
Quoted 2 lines

Add error detection for A53 and A72 cores. Hardware error injection is supported on A53. Software error injection is supported on both.

<snip>

Quoted 7 lines

As we can't safely write to these registers from linux, so I think this means all the error injection and maybe SMC stuff can disappear.

(I've not read past here..)

[Alison] Thank you very much for all your detailed comments.
I agreed with your opinion that CPUACTLR_EL1 and L2ACTLR can't be written in Linux. So the error injection can't be done in Linux. Do you mean the error injection can only be done in firmware before Linux boots up? If so, the system is running with error injection enabled all the time, it may be not a good idea too. Any suggestion?

Best Regards,
Alison Wang

#4 lore raw

Hi Alison,

Quoted 10 lines · Alison Wang
Quoted 4 lines · Alison Wang
Quoted 2 lines

Add error detection for A53 and A72 cores. Hardware error injection is supported on A53. Software error injection is supported on both.

<snip>

Quoted 3 lines

As we can't safely write to these registers from linux, so I think this means all the error injection and maybe SMC stuff can disappear.

I agreed with your opinion that CPUACTLR_EL1 and L2ACTLR can't be written in Linux.

Well, we can't do what the TRM tells us we must before writing to that register.

Quoted 3 lines

So the error injection can't be done in Linux. Do you mean the error injection can only be done in firmware before Linux boots up? If so, the system is running with error injection enabled all the time, it may be not a good idea too. Any suggestion?

These registers are expected to have one value, forever. The errata document sometimes tells us to to set or clear one of these bits to workaround an issue. Because they can only be written to when the system is idle, typically during boot, this is firmware's responsibility.

I expect firmware to set the bits in ACTLR_EL3, to prevent lower exception levels from touching any of these registers.

I don't know how the error injection on A53 or A72 works, so I don't know if you can leave it enabled all the time. The bit you are setting is described as RES0 by the A53 and A72 TRMs. I suspect I had the wrong TRM open, as my 'L1DEIEN' comment seems to be what your CPUACTLR_EL1[6] is called on A35. (35, 53? Guess how that happened!)

A35's error injection says:
| While this bit is set, double-bit errors are injected on all writes to the L1 D-cache | data RAMs for the first word of each 32-byte region.

You certainly can't leave this sort of thing enabled! And you can't change it at runtime, so we can't use it.

I think features like this are intended to be used to check the integration, not to test the software.

After I sent the original comments on this, I found Sascha's version, which has these issues resolved:
https://lore.kernel.org/linux-arm-kernel/[email protected]/

I think this version should work on your platform too.

Thanks,

James

#5 lore raw

Hi, James,

Quoted 7 lines · Alison Wang
Quoted 6 lines
Quoted 4 lines · Alison Wang
Quoted 2 lines

Add error detection for A53 and A72 cores. Hardware error injection is supported on A53. Software error injection is supported on both.

<snip>

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

As we can't safely write to these registers from linux, so I think this means all the error injection and maybe SMC stuff can disappear.

I agreed with your opinion that CPUACTLR_EL1 and L2ACTLR can't be written

in Linux.

Well, we can't do what the TRM tells us we must before writing to that register.

[Alison] Right.

Quoted 16 lines
Quoted 5 lines

So the error injection can't be done in Linux. Do you mean the error injection can only be done in firmware before Linux boots up? If so, the system is running with error injection enabled all the time, it may be not

a good idea too. Any suggestion?

These registers are expected to have one value, forever. The errata document sometimes tells us to to set or clear one of these bits to workaround an issue. Because they can only be written to when the system is idle, typically during boot, this is firmware's responsibility.

I expect firmware to set the bits in ACTLR_EL3, to prevent lower exception levels from touching any of these registers.

Quoted 5 lines

I don't know how the error injection on A53 or A72 works, so I don't know if you can leave it enabled all the time. The bit you are setting is described as RES0 by the A53 and A72 TRMs. I suspect I had the wrong TRM open, as my 'L1DEIEN' comment seems to be what your CPUACTLR_EL1[6] is called on A35. (35, 53? Guess how that happened!)

[Alison] Please check A53 TRM r0p4 from https://developer.arm.com/documentation/ddi0500/j/System-Control/AArch64-register-descriptions/CPU-Auxiliary-Control-Register--EL1?lang=en . In the CPUACTLR_EL1 bit assignments, you will find the following description.
[6] L1DEIEN
L1 D-cache data RAM error injection enable.
0
Normal behavior, errors are not injected. This is the reset value.
1
Double-bit errors are injected on all writes to the L1 D-cache data RAMs for the first word of each 32-byte region.

Quoted 7 lines

A35's error injection says:
| While this bit is set, double-bit errors are injected on all writes to | the L1 D-cache data RAMs for the first word of each 32-byte region.

You certainly can't leave this sort of thing enabled! And you can't change it at runtime, so we can't use it.

[Alison] Ok.

Quoted 15 lines

I think features like this are intended to be used to check the integration, not to test the software.

After I sent the original comments on this, I found Sascha's version, which has these issues resolved:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ker
nel.org%2Flinux-arm-kernel%2F20200813075721.27981-1-s.hauer%40pengut ronix.de%2F&amp;data=02%7C01%7Calison.wang%40nxp.com%7C3dc61602 25b24fce068708d848f9557e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0 %7C0%7C637339583002064849&amp;sdata=tLf6MHh5IMSBXvASkeaIANLGX A0J6F26hpn254a6I6c%3D&amp;reserved=0

Quoted 1 line

I think this version should work on your platform too.

[Alison] I have a look at this patch. This patch doesn't complete all the functions in my patch. It is just to report errors, but error injection function is all removed.

Best Regards,
Alison Wang

maintainer
#6 lore raw
Quoted 2 lines · Alison Wang

[Alison] I have a look at this patch. This patch doesn't complete all the functions in my patch.

Yep, but pls work together to see if a single driver can support your hw too.

Quoted 2 lines

It is just to report errors, but error injection function is all removed.

Right, because you can't use that on this hw, apparently.

Also note that you should disable error injection in production for obvious reasons. Thus all the error injection stuff in EDAC is behind CONFIG_EDAC_DEBUG which should be off in production kernels.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette