Add support for Amazon's Annapurna Labs EDAC for L1/L2
Subsystems (2)
v3 cover Add support for Amazon's Annapurna Labs EDAC for L1/L2
This series adds L1 and L2 caches support for error detection and correction for Amazon's Annapurna Labs SoCs.
Alpine SoCs supports L1 and L2 single bit correction and two bits detection capability based on ARM implementation.
Changes since v2:
-----------------
- Use BIT for single bit instead of GENMASK
- Use BIT_ULL and GENMASK_ULL for 64bit vector
- Fix the mod_name/ctrl_name.
Changes since v1:
-----------------
- Split into two drivers
- Get cpu-mask according to l2-cache handler from devicetree
- Remove parameter casting
- Use GENMASK() in bit mask
- Use FIELD_GET()
- Update define description PLRU_RAM -> PF_RAM
- Use sys_reg() and read_sysreg_s()
- Remove all write/read wrappers
- Check fatal field to set if the error correctable or not
- Remove un-relevant information from error prints.
- Update smp_call_function_single() call function to wait
- remove usage of get_online_cpus/put_online_cpus
- Use on_each_cpu() and smp_call_function_any() instead of loop with for_each_cpu.
- use buffer for error prints and pass to edac API
- Remove edac_op_state set
- Add for loop to report on repeated errors of the same type
- Fix error name of the TLB to be L2_TLB as written in ARM TRM
- Minor change in Kconfig
- Minor changes in commit message
Hanna Hawa (4):
dt-bindings: EDAC: Add Amazon's Annapurna Labs L1 EDAC
edac: Add support for Amazon's Annapurna Labs L1 EDAC
dt-bindings: EDAC: Add Amazon's Annapurna Labs L2 EDAC
edac: Add support for Amazon's Annapurna Labs L2 EDAC
.../devicetree/bindings/edac/amazon,al-l1-edac.txt | 14 ++ .../devicetree/bindings/edac/amazon,al-l2-edac.txt | 20 +++ MAINTAINERS | 12 ++ drivers/edac/Kconfig | 16 ++ drivers/edac/Makefile | 2 + drivers/edac/al_l1_edac.c | 156 +++++++++++++++++ drivers/edac/al_l2_edac.c | 187 +++++++++++++++++++++ 7 files changed, 407 insertions(+) create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-l1-edac.txt create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-l2-edac.txt create mode 100644 drivers/edac/al_l1_edac.c create mode 100644 drivers/edac/al_l2_edac.c
Signature · 1 line
2.7.4
PATCH v3 1/4 dt-bindings: EDAC: Add Amazon's Annapurna Labs L1 EDAC
Document Amazon's Annapurna Labs L1 EDAC SoC binding.
--- .../devicetree/bindings/edac/amazon,al-l1-edac.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-l1-edac.txt
Documentation/devicetree/bindings/edac/amazon,al-l1-edac.txt new file +14 -0
@@ -0,0 +1,14 @@ +* Amazon's Annapurna Labs L1 EDAC + +Amazon's Annapurna Labs SoCs supports L1 single bit correction and +two bits detection capability based on ARM implementation. + +Required properties: +- compatible: + should be "amazon,al-l1-edac". + +Example: + + al_l1_edac { + compatible = "amazon,al-l1-edac"; + };
Signature · 1 line
2.7.4
PATCH v3 2/4 edac: Add support for Amazon's Annapurna Labs L1 EDAC
In reply to Hanna HawaAdds support for Amazon's Annapurna Labs L1 EDAC driver to detect and report L1 errors.
--- MAINTAINERS | 6 ++ drivers/edac/Kconfig | 8 +++ drivers/edac/Makefile | 1 + drivers/edac/al_l1_edac.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 171 insertions(+) create mode 100644 drivers/edac/al_l1_edac.c
MAINTAINERS +6 -0
@@ -743,6 +743,12 @@ F: drivers/tty/serial/altera_jtaguart.c F: include/linux/altera_uart.h F: include/linux/altera_jtaguart.h +AMAZON ANNAPURNA LABS L1 EDAC +M: Hanna Hawa <[email protected]> +S: Maintained +F: drivers/edac/al_l1_edac.c +F: Documentation/devicetree/bindings/edac/amazon,al-l1-edac.txt + AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER M: Talel Shenhar <[email protected]> S: Maintained
drivers/edac/Kconfig +8 -0
@@ -74,6 +74,14 @@ config EDAC_GHES In doubt, say 'Y'. +config EDAC_AL_L1 + bool "Amazon's Annapurna Labs L1 EDAC" + depends on ARCH_ALPINE + help + Support for L1 error detection and correction + for Amazon's Annapurna Labs SoCs. + This driver detects errors of L1 caches. + config EDAC_AMD64 tristate "AMD64 (Opteron, Athlon64)" depends on AMD_NB && EDAC_DECODE_MCE
drivers/edac/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_EDAC_GHES) += ghes_edac.o edac_mce_amd-y := mce_amd.o obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o +obj-$(CONFIG_EDAC_AL_L1) += al_l1_edac.o obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o obj-$(CONFIG_EDAC_CPC925) += cpc925_edac.o obj-$(CONFIG_EDAC_I5000) += i5000_edac.o
drivers/edac/al_l1_edac.c new file +156 -0
156 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 3/4 dt-bindings: EDAC: Add Amazon's Annapurna Labs L2 EDAC
In reply to Hanna HawaDocument Amazon's Annapurna Labs L2 EDAC SoC binding.
--- .../devicetree/bindings/edac/amazon,al-l2-edac.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-l2-edac.txt
Documentation/devicetree/bindings/edac/amazon,al-l2-edac.txt new file +20 -0
@@ -0,0 +1,20 @@ +* Amazon's Annapurna Labs L2 EDAC + +Amazon's Annapurna Labs SoCs supports L2 single bit correction and +two bits detection capability based on ARM implementation. + +Required properties: +- compatible: + should be "amazon,al-l2-edac". +- l2-cache: + Phandle to L2 cache handler. + This property is used to compare with the CPU node property + 'next-level-cache' to create cpu-mask with all CPUs that + share same L2 cache. + +Example: + + al_l2_edac { + compatible = "amazon,al-l2-edac"; + l2-cache = <&cluster0_l2>; + };
Signature · 1 line
2.7.4
PATCH v3 4/4 edac: Add support for Amazon's Annapurna Labs L2 EDAC
In reply to Hanna HawaAdds support for Amazon's Annapurna Labs L2 EDAC driver to detect and report L2 errors.
--- MAINTAINERS | 6 ++ drivers/edac/Kconfig | 8 ++ drivers/edac/Makefile | 1 + drivers/edac/al_l2_edac.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 202 insertions(+) create mode 100644 drivers/edac/al_l2_edac.c
MAINTAINERS +6 -0
@@ -749,6 +749,12 @@ S: Maintained F: drivers/edac/al_l1_edac.c F: Documentation/devicetree/bindings/edac/amazon,al-l1-edac.txt +AMAZON ANNAPURNA LABS L2 EDAC +M: Hanna Hawa <[email protected]> +S: Maintained +F: drivers/edac/al_l2_edac.c +F: Documentation/devicetree/bindings/edac/amazon,al-l2-edac.txt + AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER M: Talel Shenhar <[email protected]> S: Maintained
drivers/edac/Kconfig +8 -0
@@ -82,6 +82,14 @@ config EDAC_AL_L1 for Amazon's Annapurna Labs SoCs. This driver detects errors of L1 caches. +config EDAC_AL_L2 + bool "Amazon's Annapurna Labs L2 EDAC" + depends on ARCH_ALPINE + help + Support for L2 error detection and correction + for Amazon's Annapurna Labs SoCs. + This driver detects errors of L2 caches. + config EDAC_AMD64 tristate "AMD64 (Opteron, Athlon64)" depends on AMD_NB && EDAC_DECODE_MCE
drivers/edac/Makefile +1 -0
@@ -23,6 +23,7 @@ edac_mce_amd-y := mce_amd.o obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o obj-$(CONFIG_EDAC_AL_L1) += al_l1_edac.o +obj-$(CONFIG_EDAC_AL_L2) += al_l2_edac.o obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o obj-$(CONFIG_EDAC_CPC925) += cpc925_edac.o obj-$(CONFIG_EDAC_I5000) += i5000_edac.o
drivers/edac/al_l2_edac.c new file +187 -0
187 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v3 2/4] edac: Add support for Amazon's Annapurna Labs L1 EDAC
In reply to Hanna HawaHi Hanna,
drivers/edac/al_l1_edac.c
Quoted 11 lines · Hanna Hawa
Adds support for Amazon's Annapurna Labs L1 EDAC driver to detect and report L1 errors.
drivers/edac/al_l1_edac.c new file +1
-0@@ -0,0 +1,156 @@ +#include <linux/bitfield.h>
You need <linux/smp.h> for on-each_cpu().
drivers/edac/al_l1_edac.c line 9
Quoted 2 lines
drivers/edac/al_l1_edac.c new file +2
-0+#include "edac_device.h" +#include "edac_module.h"
You need <asm/sysreg.h> for the sys_reg() macro. The ARCH_ALPINE dependency doesn't stop this from being built on 32bit arm, where this sys_reg() won't work/exist.
[...]
Quoted 7 lines
drivers/edac/al_l1_edac.c new file +7
-0+static void al_l1_edac_cpumerrsr (void *arg) +{ +struct edac_device_ctl_info *edac_dev = arg; +int cpu, i; +u32 ramid, repeat, other, fatal; +u64 val =read_sysreg_s (ARM_CA57_CPUMERRSR_EL1 ); +char msg[AL_L1_EDAC_MSG_MAX ];
drivers/edac/al_l1_edac.c line 52
Quoted 10 lines
drivers/edac/al_l1_edac.c new file +10
-0+int space, count; +char *p; +if (!(FIELD_GET (ARM_CA57_CPUMERRSR_VALID , val))) +return ; + space =sizeof (msg); + p = msg; + count =snprintf (p, space,"CPU%d L1 %serror detected" , cpu, + (fatal) ?"Fatal " :"" ); + p += count; + space -= count;
snprintf() will return the number of characters it would have generated, even if that is more than space. If this happen, space becomes negative, p points outside msg[] and msg[] isn't NULL terminated...
It looks like you want scnprintf(), which returns the number of characters written to buf instead. (I don't see how 256 characters would be printed by this code)
Quoted 25 lines
drivers/edac/al_l1_edac.c new file +25
-0+switch (ramid) { +case ARM_CA57_L1_I_TAG_RAM : + count =snprintf (p, space," RAMID='L1-I Tag RAM'" ); +break ; +case ARM_CA57_L1_I_DATA_RAM : + count =snprintf (p, space," RAMID='L1-I Data RAM'" ); +break ; +case ARM_CA57_L1_D_TAG_RAM : + count =snprintf (p, space," RAMID='L1-D Tag RAM'" ); +break ; +case ARM_CA57_L1_D_DATA_RAM : + count =snprintf (p, space," RAMID='L1-D Data RAM'" ); +break ; +case ARM_CA57_L2_TLB_RAM : + count =snprintf (p, space," RAMID='L2 TLB RAM'" ); +break ; +default : + count =snprintf (p, space," RAMID='unknown'" ); +break ; + } + + p += count; + space -= count; + count = snprintf(p, space, + " repeat=%d, other=%d (CPUMERRSR_EL1=0x%llx)",
drivers/edac/al_l1_edac.c line 88
Quoted 10 lines
drivers/edac/al_l1_edac.c new file +10
-0+ repeat, other, val); + +for (i =0 ; i < repeat; i++) { +if (fatal) +edac_device_handle_ue (edac_dev,0 ,0 , msg); +else +edac_device_handle_ce (edac_dev,0 ,0 , msg); + } + +write_sysreg_s (0 ,ARM_CA57_CPUMERRSR_EL1 );
Writing 0 just after you've read the value would minimise the window where repeat could have increased behind your back, or another error was counted as other, when it could have been reported more accurately.
drivers/edac/al_l1_edac.c line 105
Quoted 13 lines
drivers/edac/al_l1_edac.c new file +11
-0+} +static int al_l1_edac_probe (struct platform_device *pdev) +{ +struct edac_device_ctl_info *edac_dev; +struct device *dev = &pdev->dev; +int ret; + + edac_dev =edac_device_alloc_ctl_info (0 , (char *)dev_name (dev),1 ,"L" , +1 ,1 ,NULL ,0 , +edac_device_alloc_index ()); +if (IS_ERR (edac_dev))
edac_device_alloc_ctl_info() returns NULL, or dev_ctl, which comes from kzalloc(). I think you need to check for NULL here, IS_ERR() only catches the -errno range. (there is an IS_ERR_OR_NULL() if you really needed both)
drivers/edac/al_l1_edac.c line 106
Quoted 1 line
drivers/edac/al_l1_edac.c new file +1
-0+return -ENOMEM ;
With the header-includes and edac_device_alloc_ctl_info() NULL check:
Thanks,
James
Re: [PATCH v3 2/4] edac: Add support for Amazon's Annapurna Labs L1 EDAC
Quoted 15 lines · James Morse
Hi Hanna,
drivers/edac/al_l1_edac.c
Quoted 11 lines · Hanna Hawa
Adds support for Amazon's Annapurna Labs L1 EDAC driver to detect and report L1 errors.
drivers/edac/al_l1_edac.c new file +1
-0@@ -0,0 +1,156 @@ +#include <linux/bitfield.h>
Quoted 7 lines
You need <
linux/smp.h> for on-each_cpu().drivers/edac/al_l1_edac.c line 9
Quoted 2 lines
drivers/edac/al_l1_edac.c new file +2
-0+#include "edac_device.h" +#include "edac_module.h" You need <
asm/sysreg.h> for thesys_reg()macro. TheARCH_ALPINEdependency doesn't stop this from being built on 32bit arm, where thissys_reg()won't work/exist.
Will fix.
Quoted 25 lines
[...]
Quoted 7 lines
drivers/edac/al_l1_edac.c new file +7
-0+static void al_l1_edac_cpumerrsr (void *arg) +{ +struct edac_device_ctl_info *edac_dev = arg; +int cpu, i; +u32 ramid, repeat, other, fatal; +u64 val =read_sysreg_s (ARM_CA57_CPUMERRSR_EL1 ); +char msg[AL_L1_EDAC_MSG_MAX ];drivers/edac/al_l1_edac.c line 52
Quoted 10 lines
drivers/edac/al_l1_edac.c new file +10
-0+int space, count; +char *p; +if (!(FIELD_GET (ARM_CA57_CPUMERRSR_VALID , val))) +return ; + space =sizeof (msg); + p = msg; + count =snprintf (p, space,"CPU%d L1 %serror detected" , cpu, + (fatal) ?"Fatal " :"" ); + p += count; + space -= count;
snprintf()will return the number of characters it would have generated, even if that is more than space. If this happen, space becomes negative, p points outside msg[] and msg[] isn't NULL terminated...
Quoted 2 lines
It looks like you want
scnprintf(), which returns the number of characters written to buf instead. (I don't see how 256 characters would be printed by this code)
Will use scnprintf() instead.
Quoted 33 lines
Quoted 33 lines
drivers/edac/al_l1_edac.c new file +31
-0+switch (ramid) { +case ARM_CA57_L1_I_TAG_RAM : + count =snprintf (p, space," RAMID='L1-I Tag RAM'" ); +break ; +case ARM_CA57_L1_I_DATA_RAM : + count =snprintf (p, space," RAMID='L1-I Data RAM'" ); +break ; +case ARM_CA57_L1_D_TAG_RAM : + count =snprintf (p, space," RAMID='L1-D Tag RAM'" ); +break ; +case ARM_CA57_L1_D_DATA_RAM : + count =snprintf (p, space," RAMID='L1-D Data RAM'" ); +break ; +case ARM_CA57_L2_TLB_RAM : + count =snprintf (p, space," RAMID='L2 TLB RAM'" ); +break ; +default : + count =snprintf (p, space," RAMID='unknown'" ); +break ; + } + + p += count; + space -= count; + count =snprintf (p, space, +" repeat=%d, other=%d (CPUMERRSR_EL1=0x%llx)" , + repeat, other, val); + +for (i =0 ; i < repeat; i++) { +if (fatal) +edac_device_handle_ue (edac_dev,0 ,0 , msg); +else
Quoted 8 lines
drivers/edac/al_l1_edac.c line 88
Quoted 4 lines
drivers/edac/al_l1_edac.c new file +4
-0+edac_device_handle_ce (edac_dev,0 ,0 , msg); + } + +write_sysreg_s (0 ,ARM_CA57_CPUMERRSR_EL1 );Writing 0 just after you've read the value would minimise the window where repeat could have increased behind your back, or another error was counted as other, when it could have been reported more accurately.
Good point, I will move the write after checking the valid bit.
Quoted 5 lines
Quoted 3 lines
+}
Quoted 14 lines
drivers/edac/al_l1_edac.c line 105
Quoted 10 lines
drivers/edac/al_l1_edac.c new file +10
-0+static int al_l1_edac_probe (struct platform_device *pdev) +{ +struct edac_device_ctl_info *edac_dev; +struct device *dev = &pdev->dev; +int ret; + + edac_dev =edac_device_alloc_ctl_info (0 , (char *)dev_name (dev),1 ,"L" , +1 ,1 ,NULL ,0 , +edac_device_alloc_index ()); +if (IS_ERR (edac_dev))
edac_device_alloc_ctl_info()returns NULL, ordev_ctl, which comes fromkzalloc(). I think you need to check for NULL here,IS_ERR()only catches the -errno range. (there is anIS_ERR_OR_NULL()if you really needed both)
Will fix.
Quoted 7 lines
drivers/edac/al_l1_edac.c line 106
Quoted 3 lines
drivers/edac/al_l1_edac.c new file +1
-0+return -ENOMEM ;With the header-includes and
edac_device_alloc_ctl_info()NULL check:Reviewed-by James Morse <[email protected]>
Thanks James.
Thanks,
Hanna
Quoted 6 lines
Thanks,
James
Re: [PATCH v3 2/4] edac: Add support for Amazon's Annapurna Labs L1 EDAC
In reply to Hanna HawaQuoted 18 lines · Hanna Hawa
Adds support for Amazon's Annapurna Labs L1 EDAC driver to detect and report L1 errors.
Signed-off-by Hanna Hawa <[email protected]>Reviewed-by James Morse <[email protected]>--- MAINTAINERS | 6 ++ drivers/edac/Kconfig | 8 +++ drivers/edac/Makefile | 1 + drivers/edac/al_l1_edac.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 171 insertions(+) create mode 100644 drivers/edac/al_l1_edac.cdrivers/edac/al_l1_edac.c new file +0
-0
[...]
Quoted 1 line
+static void
al_l1_edac_cpumerrsr(void *arg)
Could this being named to something meaningful, such as *_read_status() or so?
Quoted 11 lines
drivers/edac/al_l1_edac.c new file +11
-0+{ +struct edac_device_ctl_info *edac_dev = arg; +int cpu, i; +u32 ramid, repeat, other, fatal; +u64 val =read_sysreg_s (ARM_CA57_CPUMERRSR_EL1 ); +char msg[AL_L1_EDAC_MSG_MAX ]; +int space, count; +char *p; + +if (!(FIELD_GET (ARM_CA57_CPUMERRSR_VALID , val))) +return ;
[...]
drivers/edac/al_l1_edac.c line 102
Quoted 12 lines
drivers/edac/al_l1_edac.c new file +12
-0+static void al_l1_edac_check (struct edac_device_ctl_info *edac_dev) +{ +on_each_cpu (al_l1_edac_cpumerrsr, edac_dev,1 ); +} + +static int al_l1_edac_probe (struct platform_device *pdev) +{ +struct edac_device_ctl_info *edac_dev; +struct device *dev = &pdev->dev; +int ret; + + edac_dev = edac_device_alloc_ctl_info(0, (char *)dev_name(dev), 1, "L",
This type cast looks broken. dev_name() is a constant string already.
Other drivers do not use the dynamically generated dev_name() string here, instead a fix string such as mod_name or ctl_name could be used. edac_device_alloc_ctl_info() later generates a unique instance name derived from name + index.
Regarding the type, this seems to be an API issue of edac_device_ alloc_ctl_info() that should actually use const char* in its interface. So if needed (from what I wrote above it is not) the type in the argument list needs to be changed instead.
drivers/edac/al_l1_edac.c line 106
Quoted 4 lines
drivers/edac/al_l1_edac.c new file +4
-0+1 ,1 ,NULL ,0 , + edac_device_alloc_index()); +if (IS_ERR (edac_dev)) +return -ENOMEM ;
Use the original error code instead.
drivers/edac/al_l1_edac.c line 112
Quoted 6 lines
drivers/edac/al_l1_edac.c new file +6
-0+ + edac_dev->edac_check = al_l1_edac_check; + edac_dev->dev = dev; + edac_dev->mod_name =DRV_NAME ; + edac_dev->dev_name =dev_name (dev); + edac_dev->ctl_name ="L1 cache" ;
Should not contain spaces and maybe a bit more specific.
drivers/edac/al_l1_edac.c line 117
Quoted 5 lines
drivers/edac/al_l1_edac.c new file +5
-0+platform_set_drvdata (pdev, edac_dev); + + ret =edac_device_add_device (edac_dev); +if (ret) { +dev_err (dev,"Failed to add L1 edac device\n" );
Move this printk below to the error path and maybe print the error code. You do not cover the -ENOMEM failure.
-Robert
Quoted 9 lines
drivers/edac/al_l1_edac.c new file +9
-0+ goto err; + } + +return 0 ; +err: +edac_device_free_ctl_info (edac_dev); + +return ret; +}
Re: [PATCH v3 4/4] edac: Add support for Amazon's Annapurna Labs L2 EDAC
In reply to Hanna HawaQuoted 12 lines · Hanna Hawa
Adds support for Amazon's Annapurna Labs L2 EDAC driver to detect and report L2 errors.
Signed-off-by Hanna Hawa <[email protected]>--- MAINTAINERS | 6 ++ drivers/edac/Kconfig | 8 ++ drivers/edac/Makefile | 1 + drivers/edac/al_l2_edac.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 202 insertions(+) create mode 100644 drivers/edac/al_l2_edac.c
Quoted 1 line
From a brief look at it, it seems some of my comments from 2/4 apply
here too. Please look through it.
-Robert
Re: [PATCH v3 2/4] edac: Add support for Amazon's Annapurna Labs L1 EDAC
In reply to Robert RichterQuoted 56 lines · Robert Richter
Quoted 18 lines · Hanna Hawa
Adds support for Amazon's Annapurna Labs L1 EDAC driver to detect and report L1 errors.
Signed-off-by Hanna Hawa <[email protected]>Reviewed-by James Morse <[email protected]>--- MAINTAINERS | 6 ++ drivers/edac/Kconfig | 8 +++ drivers/edac/Makefile | 1 + drivers/edac/al_l1_edac.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 171 insertions(+)create mode 100644
drivers/edac/al_l1_edac.cdrivers/edac/al_l1_edac.c new file +0
-0[...]
Quoted 1 line
+static void
al_l1_edac_cpumerrsr(void *arg)Could this being named to something meaningful, such as
*_read_status()or so?Quoted 11 lines
drivers/edac/al_l1_edac.c new file +11
-0+{ +struct edac_device_ctl_info *edac_dev = arg; +int cpu, i; +u32 ramid, repeat, other, fatal; +u64 val =read_sysreg_s (ARM_CA57_CPUMERRSR_EL1 ); +char msg[AL_L1_EDAC_MSG_MAX ]; +int space, count; +char *p; + +if (!(FIELD_GET (ARM_CA57_CPUMERRSR_VALID , val))) +return ;[...]
drivers/edac/al_l1_edac.c line 102
Quoted 12 lines
drivers/edac/al_l1_edac.c new file +12
-0+static void al_l1_edac_check (struct edac_device_ctl_info *edac_dev) +{ +on_each_cpu (al_l1_edac_cpumerrsr, edac_dev,1 ); +} + +static int al_l1_edac_probe (struct platform_device *pdev) +{ +struct edac_device_ctl_info *edac_dev; +struct device *dev = &pdev->dev; +int ret; + + edac_dev = edac_device_alloc_ctl_info(0, (char *)dev_name(dev), 1, "L",This type cast looks broken.
dev_name()is a constant string already.
Quoted 4 lines
Other drivers do not use the dynamically generated
dev_name()string here, instead a fix string such asmod_nameorctl_namecould be used.edac_device_alloc_ctl_info()later generates a unique instance name derived from name + index.
Ack, will fix and use DRV_NAME.
Quoted 6 lines
Regarding the type, this seems to be an API issue of
edac_device_alloc_ctl_info()that should actually use const char* in its interface. So if needed (from what I wrote above it is not) the type in the argument list needs to be changed instead.
Quoted 6 lines
drivers/edac/al_l1_edac.c line 106
Quoted 4 lines
drivers/edac/al_l1_edac.c new file +4
-0+1 ,1 ,NULL ,0 , + edac_device_alloc_index()); +if (IS_ERR (edac_dev)) +return -ENOMEM ;Use the original error code instead.
Actually it return NULL in case of failure, it was changed in v5 to check if error/NULL.
Quoted 9 lines
drivers/edac/al_l1_edac.c line 112
Quoted 7 lines
drivers/edac/al_l1_edac.c new file +6
-0+ + edac_dev->edac_check = al_l1_edac_check; + edac_dev->dev = dev; + edac_dev->mod_name =DRV_NAME ; + edac_dev->dev_name =dev_name (dev); + edac_dev->ctl_name ="L1 cache" ;Should not contain spaces and maybe a bit more specific.
L1_cache_ecc_err? or L1_cache_err?
Quoted 9 lines
drivers/edac/al_l1_edac.c line 117
Quoted 6 lines
drivers/edac/al_l1_edac.c new file +5
-0+platform_set_drvdata (pdev, edac_dev); + + ret =edac_device_add_device (edac_dev); +if (ret) { +dev_err (dev,"Failed to add L1 edac device\n" );Move this printk below to the error path and maybe print the error code. You do not cover the
-ENOMEMfailure.
Ack.
Quoted 12 lines
-Robert
Quoted 9 lines
drivers/edac/al_l1_edac.c new file +9
-0+ goto err; + } + +return 0 ; +err: +edac_device_free_ctl_info (edac_dev); + +return ret; +}
Re: [PATCH v3 4/4] edac: Add support for Amazon's Annapurna Labs L2 EDAC
In reply to Robert RichterQuoted 13 lines · Robert Richter
Quoted 11 lines · Hanna Hawa
Adds support for Amazon's Annapurna Labs L2 EDAC driver to detect and report L2 errors.
Signed-off-by Hanna Hawa <[email protected]>--- MAINTAINERS | 6 ++ drivers/edac/Kconfig | 8 ++ drivers/edac/Makefile | 1 + drivers/edac/al_l2_edac.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 202 insertions(+)create mode 100644
drivers/edac/al_l2_edac.c
Quoted 2 lines
From a brief look at it, it seems some of my comments from 2/4 apply
here too. Please look through it.
Thanks for your review, will look and fix on top of v5.
Thanks,
Hanna
Quoted 3 lines
-Robert
Re: [PATCH v3 4/4] edac: Add support for Amazon's Annapurna Labs L2 EDAC
Quoted 14 lines · Hanna
Quoted 13 lines · Robert Richter
Quoted 11 lines · Hanna Hawa
Adds support for Amazon's Annapurna Labs L2 EDAC driver to detect and report L2 errors.
Signed-off-by Hanna Hawa <[email protected]>--- MAINTAINERS | 6 ++ drivers/edac/Kconfig | 8 ++ drivers/edac/Makefile | 1 + drivers/edac/al_l2_edac.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 202 insertions(+)create mode 100644
drivers/edac/al_l2_edac.c
Quoted 4 lines
Quoted 2 lines
From a brief look at it, it seems some of my comments from 2/4 apply
here too. Please look through it.Thanks for your review, will look and fix on top of v5.
I have later seen your newer versions posted which haven't made it into my inbox. But looking at the changelog my comments are still valid. Thanks for addressing them.
Quoted 1 line
From the changelog:
"Changes since v1:
-----------------
- Split into two drivers"
This is good, but recent practice is also to have all the drivers for the same piece of hardware in a single file, see e.g. thunderx_edac.c. I don't know how detailed this was discussed already, but I would prefer to join the code.
-Robert
Borislav Petkov
maintainerRe: [PATCH v3 4/4] edac: Add support for Amazon's Annapurna Labs L2 EDAC
Quoted 4 lines · Robert Richter
This is good, but recent practice is also to have all the drivers for the same piece of hardware in a single file, see e.g.
thunderx_edac.c. I don't know how detailed this was discussed already, but I would prefer to join the code.
This is no longer needed anymore. Check out this thread:
https://lkml.kernel.org/r/[email protected]
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.Re: [PATCH v3 4/4] edac: Add support for Amazon's Annapurna Labs L2 EDAC
Quoted 9 lines · Borislav Petkov
Quoted 4 lines · Robert Richter
This is good, but recent practice is also to have all the drivers for the same piece of hardware in a single file, see e.g.
thunderx_edac.c. I don't know how detailed this was discussed already, but I would prefer to join the code.This is no longer needed anymore. Check out this thread:
Thanks for the pointer, looks good to me.
-Robert