Amazon's Annapurna Labs Memory Controller EDAC
Talel Shenhar
maintainerv6 cover Amazon's Annapurna Labs Memory Controller EDAC
This series introduces support for Amazon's Annapurna Labs Memory Controller EDAC driver.
Changes since v5:
=================
- rebased and retested for tag Linux 5.6-rc2
- added Reviewed-By for dt-binding (Rob Herring <[email protected]>)
- added Reviewed-By for driver (James Morse <[email protected]>)
Changes since v4:
=================
- fixed dt-binding interrupt to have min of 1
- updated dt-binding GPL-2.0 to GPL-2.0-only
- changed writel to relaxed flavor
- added managed device driver unwind
Changes since v3:
=================
- removed quotation marks and hyphen from compatible dt-binding
- added interrupts and interrupt-names description to dt-binding
- added missing include to dt-binding
Changes since v2:
=================
- added missing includes
- aggregated variables to same line
- removed ranks read
- added spinlock to mc reporting
- made irq handler clearer
- freed irq before freeing device memory
- changed Kconfig to tristate
- added COMPILE_TEST to Kconfig
- converted dt binding to new scheme
- used devm_platform_ioremap_resource instead of get&ioremap
Changes since v1:
=================
- updated dt binding node name and added Rob Reviewed-By
- removed auto selecting of this driver
Talel Shenhar (2):
dt-bindings: edac: al-mc-edac: Amazon's Annapurna Labs Memory
Controller EDAC
EDAC: al-mc-edac: Introduce Amazon's Annapurna Labs Memory Controller
EDAC
.../bindings/edac/amazon,al-mc-edac.yaml | 52 +++ MAINTAINERS | 7 + drivers/edac/Kconfig | 7 + drivers/edac/Makefile | 1 + drivers/edac/al_mc_edac.c | 355 ++++++++++++++++++ 5 files changed, 422 insertions(+) create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml create mode 100644 drivers/edac/al_mc_edac.c
Signature · 1 line
2.17.1
Talel Shenhar
maintainerPATCH v6 2/2 EDAC: al-mc-edac: Introduce Amazon's Annapurna Labs Memory Controller EDAC
The Amazon's Annapurna Labs Memory Controller EDAC supports ECC capability for error detection and correction (Single bit error correction, Double detection). This driver introduces EDAC driver for that capability.
--- MAINTAINERS | 7 + drivers/edac/Kconfig | 7 + drivers/edac/Makefile | 1 + drivers/edac/al_mc_edac.c | 355 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 370 insertions(+) create mode 100644 drivers/edac/al_mc_edac.c
MAINTAINERS +7 -0
@@ -757,6 +757,13 @@ F: drivers/tty/serial/altera_jtaguart.c F: include/linux/altera_uart.h F: include/linux/altera_jtaguart.h +AMAZON ANNAPURNA LABS MEMORY CONTROLLER EDAC +M: Talel Shenhar <[email protected]> +M: Talel Shenhar <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml +F: drivers/edac/al_mc_edac.c + AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER M: Talel Shenhar <[email protected]> S: Maintained
drivers/edac/Kconfig +7 -0
@@ -100,6 +100,13 @@ config EDAC_AMD64_ERROR_INJECTION In addition, there are two control files, inject_read and inject_write, which trigger the DRAM ECC Read and Write respectively. +config EDAC_AL_MC + tristate "Amazon's Annapurna Lab EDAC Memory Controller" + depends on (ARCH_ALPINE || COMPILE_TEST) + help + Support for error detection and correction for Amazon's Annapurna + Labs Alpine chips which allows 1 bit correction and 2 bits detection. + config EDAC_AMD76X tristate "AMD 76x (760, 762, 768)" depends on PCI && X86_32
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_MC) += al_mc_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_mc_edac.c new file +355 -0
355 lines not on this page · raw message
Signature · 1 line
2.17.1
Talel Shenhar
maintainerPATCH v6 1/2 dt-bindings: edac: al-mc-edac: Amazon's Annapurna Labs Memory Controller EDAC
In reply to Talel ShenharDocument Amazon's Annapurna Labs Memory Controller EDAC SoC binding.
--- .../bindings/edac/amazon,al-mc-edac.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml new file +52 -0
@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0-only +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/edac/amazon,al-mc-edac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amazon's Annapurna Labs Memory Controller EDAC + +maintainers: + - Talel Shenhar <[email protected]> + - Talel Shenhar <[email protected]> + +description: | + EDAC node is defined to describe on-chip error detection and correction for + Amazon's Annapurna Labs Memory Controller. + +properties: + + compatible: + const: amazon,al-mc-edac + + reg: + maxItems: 1 + + interrupts: + minItems: 1 + maxItems: 2 + items: + - description: uncorrectable error interrupt + - description: correctable error interrupt + + interrupt-names: + minItems: 1 + maxItems: 2 + items: + - const: ue + - const: ce + +required: + - compatible + - reg + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + edac@f0080000 { + compatible = "amazon,al-mc-edac"; + reg = <0x0 0xf0080000 0x0 0x00010000>; + interrupt-parent = <&amazon_al_system_fabric>; + interrupt-names = "ue"; + interrupts = <20 IRQ_TYPE_LEVEL_HIGH>; + };
Signature · 1 line
2.17.1
Borislav Petkov
maintainerRe: [PATCH v6 1/2] dt-bindings: edac: al-mc-edac: Amazon's Annapurna Labs Memory Controller EDAC
Quoted 15 lines · Talel Shenhar
Document Amazon's Annapurna Labs Memory Controller EDAC SoC binding.
Signed-off-by Talel Shenhar <[email protected]>Reviewed-by Rob Herring <[email protected]>--- .../bindings/edac/amazon,al-mc-edac.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yamlDocumentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml new file +0
-0
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml line 1
Quoted 1 line
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml new file +1
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0-only
WARNING: DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause) #36: FILE: Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml:1:
+# SPDX-License-Identifier: GPL-2.0-only
Hi Rob, should I listen to checkpatch or ignore it?
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteBorislav Petkov
maintainerRe: [PATCH v6 2/2] EDAC: al-mc-edac: Introduce Amazon's Annapurna Labs Memory Controller EDAC
In reply to Talel ShenharQuoted 72 lines · Talel Shenhar
The Amazon's Annapurna Labs Memory Controller EDAC supports ECC capability for error detection and correction (Single bit error correction, Double detection). This driver introduces EDAC driver for that capability.
Signed-off-by Talel Shenhar <[email protected]>Reviewed-by James Morse <[email protected]>--- MAINTAINERS | 7 + drivers/edac/Kconfig | 7 + drivers/edac/Makefile | 1 + drivers/edac/al_mc_edac.c | 355 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 370 insertions(+) create mode 100644 drivers/edac/al_mc_edac.cMAINTAINERS +7
-0@@ -757,6 +757,13 @@ F: drivers/tty/serial/altera_jtaguart.c F: include/linux/altera_uart.h F: include/linux/altera_jtaguart.h +AMAZON ANNAPURNA LABS MEMORY CONTROLLER EDAC +M: Talel Shenhar <[email protected]> +M: Talel Shenhar <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml +F: drivers/edac/al_mc_edac.c + AMAZON ANNAPURNA LABS THERMAL MMIO DRIVER M: Talel Shenhar <[email protected]> S: Maintaineddrivers/edac/Kconfig +7
-0@@ -100,6 +100,13 @@ config EDAC_AMD64_ERROR_INJECTION In addition, there are two control files, inject_read and inject_write, which trigger the DRAM ECC Read and Write respectively. +config EDAC_AL_MC + tristate "Amazon's Annapurna Lab EDAC Memory Controller" + depends on (ARCH_ALPINE || COMPILE_TEST) + help + Support for error detection and correction for Amazon's Annapurna + Labs Alpine chips which allows 1 bit correction and 2 bits detection. + config EDAC_AMD76X tristate "AMD 76x (760, 762, 768)" depends on PCI && X86_32drivers/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_MC) += al_mc_edac.o obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o obj-$(CONFIG_EDAC_CPC925) += cpc925_edac.o obj-$(CONFIG_EDAC_I5000) += i5000_edac.odrivers/edac/al_mc_edac.c new file +4
-0@@ -0,0 +1,355 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. +*/
drivers/edac/al_mc_edac.c line 14
Quoted 10 lines
drivers/edac/al_mc_edac.c new file +10
-0+#include <linux/bitfield.h> +#include <linux/bitops.h> +#include <linux/edac.h> +#include <linux/of_irq.h> +#include <linux/platform_device.h> +#include <linux/spinlock.h> +#include "edac_module.h" + +/* Registers Offset */ +#define AL_MC_MSTR 0x00
That define looks unused, pls remove. Check the others too - I found a couple more unused at a quick scan.
Quoted 13 lines
drivers/edac/al_mc_edac.c new file +13
-0+#define AL_MC_ECC_CFG 0x70 +#define AL_MC_ECC_CLEAR 0x7c +#define AL_MC_ECC_ERR_COUNT 0x80 +#define AL_MC_ECC_CE_ADDR0 0x84 +#define AL_MC_ECC_CE_ADDR1 0x88 +#define AL_MC_ECC_UE_ADDR0 0xa4 +#define AL_MC_ECC_UE_ADDR1 0xa8 +#define AL_MC_ECC_CE_SYND0 0x8c +#define AL_MC_ECC_CE_SYND1 0x90 +#define AL_MC_ECC_CE_SYND2 0x94 +#define AL_MC_ECC_UE_SYND0 0xac +#define AL_MC_ECC_UE_SYND1 0xb0 +#define AL_MC_ECC_UE_SYND2 0xb4
...
drivers/edac/al_mc_edac.c line 77
Quoted 7 lines
drivers/edac/al_mc_edac.c new file +7
-0+#define AL_MC_EDAC_MSG (message, buffer_size, type, \ + rank, row, bg, bank, column, syn0, syn1, syn2) \ + snprintf(message, buffer_size, \ + "%s rank=0x%x row=0x%x bg=0x%x bank=0x%x col=0x%x " \ + "syn0: 0x%x syn1: 0x%x syn2: 0x%x", \ + type == HW_EVENT_ERR_UNCORRECTED ? "UE" : "CE", \ + rank, row, bg, bank, column, syn0, syn1, syn2)
Yuck, why is that a macro and not a normal function?
...
Quoted 20 lines
drivers/edac/al_mc_edac.c new file +20
-0+static void al_mc_edac_check (struct mem_ctl_info *mci) +{ +struct al_mc_edac *al_mc = mci->pvt_info; + +if (al_mc->irq_ue <=0 ) +al_mc_edac_handle_ue (mci); + +if (al_mc->irq_ce <=0 ) +al_mc_edac_handle_ce (mci); +} + +static irqreturn_t al_mc_edac_irq_handler_ue (int irq,void *info) +{ +struct platform_device *pdev = info; +struct mem_ctl_info *mci =platform_get_drvdata (pdev); + +if (al_mc_edac_handle_ue (mci)) +return IRQ_HANDLED ; +return IRQ_NONE ; +}
drivers/edac/al_mc_edac.c line 205
Quoted 10 lines
drivers/edac/al_mc_edac.c new file +10
-0+ +static irqreturn_t al_mc_edac_irq_handler_ce (int irq,void *info) +{ +struct platform_device *pdev = info; +struct mem_ctl_info *mci =platform_get_drvdata (pdev); + +if (al_mc_edac_handle_ce (mci)) +return IRQ_HANDLED ; +return IRQ_NONE ; +}
Why do you need two interrupt handlers? You can have only one and call al_mc_edac_check() in it and it will do all the work needed.
Or does the thing fire two independent IRQs - one for CEs and another for UEs - and they can fire in parallel?
Quoted 14 lines
drivers/edac/al_mc_edac.c new file +14
-0+ +static enum scrub_type al_mc_edac_get_scrub_mode (void __iomem *mmio_base) +{ +u32 ecccfg0; + + ecccfg0 =readl (mmio_base +AL_MC_ECC_CFG ); + +if (FIELD_GET (AL_MC_ECC_CFG_SCRUB_DISABLED , ecccfg0)) +return SCRUB_NONE ; +else +return SCRUB_HW_SRC ; +} + +static void devm_al_mc_edac_free (void *data)
drivers/edac/al_mc_edac.c line 229
Quoted 10 lines
drivers/edac/al_mc_edac.c new file +10
-0+{ +edac_mc_free (data); +} + +static void devm_al_mc_edac_del (void *data) +{ +edac_mc_del_mc (data); +} + +static int al_mc_edac_probe (struct platform_device *pdev)
Drop the "al_mc_edac_" prefix from most of the static functions. You can leave it in the probe function or the IRQ handler so that it is visible in stack traces but all those small functions don't need that prefix.
drivers/edac/al_mc_edac.c line 235
Quoted 6 lines
drivers/edac/al_mc_edac.c new file +6
-0+{ +void __iomem *mmio_base; +struct edac_mc_layer layers[1 ]; +struct mem_ctl_info *mci; +struct al_mc_edac *al_mc; +int ret;
Please sort function local variables declaration in a reverse christmas tree order:
<type A> longest_variable_name; <type B> shorter_var_name; <type C> even_shorter; <type D> i;
Check your other functions too pls.
drivers/edac/al_mc_edac.c line 248
Quoted 13 lines
drivers/edac/al_mc_edac.c new file +13
-0+ + mmio_base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (mmio_base)) { +dev_err (&pdev->dev,"failed to ioremap memory (%ld)\n" , +PTR_ERR (mmio_base)); +return PTR_ERR (mmio_base); + } + + layers[0 ].type =EDAC_MC_LAYER_CHIP_SELECT ; + layers[0 ].size =1 ; + layers[0 ].is_virt_csrow = false; + mci =edac_mc_alloc (0 ,ARRAY_SIZE (layers), layers, +sizeof (struct al_mc_edac ));
You can let that line stick out.
Quoted 8 lines
drivers/edac/al_mc_edac.c new file +8
-0+if (!mci) +return -ENOMEM ; + + ret =devm_add_action (&pdev->dev, devm_al_mc_edac_free, mci); +if (ret) { +edac_mc_free (mci); +return ret; + }
drivers/edac/al_mc_edac.c line 266
Quoted 10 lines
drivers/edac/al_mc_edac.c new file +10
-0+ +platform_set_drvdata (pdev, mci); + al_mc = mci->pvt_info; + + al_mc->mmio_base = mmio_base; + + al_mc->irq_ue =of_irq_get_byname (pdev->dev.of_node,"ue" ); +if (al_mc->irq_ue <=0 ) +dev_dbg (&pdev->dev, +"no irq defined for ue - falling back to polling\n" );
s/irq/IRQ/g in user-visible strings.
Also,
s/ue/UE/g
s/ce/CE/g
drivers/edac/al_mc_edac.c line 273
Quoted 7 lines
drivers/edac/al_mc_edac.c new file +7
-0+ + al_mc->irq_ce =of_irq_get_byname (pdev->dev.of_node,"ce" ); +if (al_mc->irq_ce <=0 ) +dev_dbg (&pdev->dev, +"no irq defined for ce - falling back to polling\n" ); + +if (al_mc->irq_ue <=0 || al_mc->irq_ce <=0 )
Shouldn't this be && here?
I mean, you want to poll when neither of the IRQs can be found. But then if you find one of them and not the other, what do you do? Poll and interrupt? Is that case even possible?
drivers/edac/al_mc_edac.c line 280
Quoted 7 lines
drivers/edac/al_mc_edac.c new file +7
-0+ edac_op_state =EDAC_OPSTATE_POLL ; + else + edac_op_state =EDAC_OPSTATE_INT ; + +spin_lock_init (&al_mc->lock); + + mci->edac_check = al_mc_edac_check;
Set the ->edac_check pointer only when you poll, i.e. EDAC_OPSTATE_POLL.
Quoted 4 lines
drivers/edac/al_mc_edac.c new file +4
-0+ mci->mtype_cap =MEM_FLAG_DDR3 |MEM_FLAG_DDR4 ; + mci->edac_ctl_cap =EDAC_FLAG_NONE |EDAC_FLAG_SECDED ; + mci->edac_cap =EDAC_FLAG_SECDED ; + mci->mod_name =DRV_NAME ;
drivers/edac/al_mc_edac.c line 294
Quoted 10 lines
drivers/edac/al_mc_edac.c new file +10
-0+ mci->ctl_name ="al_mc" ; + mci->pdev = &pdev->dev; + mci->scrub_mode =al_mc_edac_get_scrub_mode (mmio_base); + + ret =edac_mc_add_mc (mci); +if (ret <0 ) { +dev_err (&pdev->dev, +"fail to add memory controller device (%d)\n" , + ret); +return ret;
I'm assuming here devm_al_mc_edac_free() will be called eventually so that mci is freed?
drivers/edac/al_mc_edac.c line 300
Quoted 6 lines
drivers/edac/al_mc_edac.c new file +6
-0+ } + + ret =devm_add_action (&pdev->dev, devm_al_mc_edac_del, &pdev->dev); +if (ret) { +edac_mc_del_mc (&pdev->dev); +return ret;
Here too?
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteShenhar, Talel
maintainerRe: [PATCH v6 1/2] dt-bindings: edac: al-mc-edac: Amazon's Annapurna Labs Memory Controller EDAC
In reply to Borislav PetkovQuoted 21 lines · Borislav Petkov
Quoted 15 lines · Talel Shenhar
Document Amazon's Annapurna Labs Memory Controller EDAC SoC binding.
Signed-off-by Talel Shenhar <[email protected]>Reviewed-by Rob Herring <[email protected]>--- .../bindings/edac/amazon,al-mc-edac.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+)create mode 100644
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yamlDocumentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml new file +0
-0Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml line 1
Quoted 1 line
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml new file +1
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0-onlyWARNING: DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause) #36: FILE:
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml:1:
+# SPDX-License-Identifier: GPL-2.0-only
Quoted 1 line
Hi Rob, should I listen to checkpatch or ignore it?
Thank you Boris for the review,
I now see this recent addition in checkpatch - https://lore.kernel.org/lkml/[email protected]/
Will add that license as part of v7.
Quoted 6 lines
--
Regards/Gruss,
Boris.
Thanks,
Talel.
Borislav Petkov
maintainerRe: [PATCH v6 2/2] EDAC: al-mc-edac: Introduce Amazon's Annapurna Labs Memory Controller EDAC
In reply to a message not in the archiveQuoted 6 lines · Talel
Quoted 3 lines
drivers/edac/al_mc_edac.c line 248
Quoted 2 lines
drivers/edac/al_mc_edac.c new file +2
-0+ mci =edac_mc_alloc (0 ,ARRAY_SIZE (layers), layers, +sizeof (struct al_mc_edac ));You can let that line stick out.
I rather avoid having this as a checkpatch warnning... (automation and stuff...)
checkpatch.pl - while useful - should not be taken to the letter and human brain should be applied to sanity check it what it warns about.
Quoted 3 lines
This line break does seems to my eye as too hard to read.
Let me know if you feel strongly about it.
I'm just sayin' - in the end of the day you'll be staring at that code - not me - so whatever *you* prefer. :-)
Just don't follow tools blindly.
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
+ if (
al_mc->irq_ue<= 0 ||al_mc->irq_ce<= 0)Shouldn't this be && here?
I mean, you want to poll when neither of the IRQs can be found. But then if you find one of them and not the other, what do you do? Poll and interrupt? Is that case even possible?
Quoted 5 lines
Correct.
In case dt defined interrupt line only for one type and not for the other, than the interrupt mode shall be used for one of them while polling mode for the other.
That warrants a comment above it.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteShenhar, Talel
maintainerPATCH v6 1/2 dt-bindings: edac: al-mc-edac: Amazon's Annapurna Labs Memory Controller EDAC
In reply to Borislav PetkovRob and other DT folks,
Can you please help with below query?
Quoted 21 lines · Borislav Petkov
Quoted 15 lines · Talel Shenhar
Document Amazon's Annapurna Labs Memory Controller EDAC SoC binding.
Signed-off-by Talel Shenhar <[email protected]>Reviewed-by Rob Herring <[email protected]>--- .../bindings/edac/amazon,al-mc-edac.yaml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+)create mode 100644
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yamlDocumentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml new file +0
-0Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml line 1
Quoted 1 line
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml new file +1
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0-onlyWARNING: DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause) #36: FILE:
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml:1:
+# SPDX-License-Identifier: GPL-2.0-only
Quoted 1 line
Hi Rob, should I listen to checkpatch or ignore it?
Rob and other dt folks,
In continue to disscussion with Boris below, Looking at the checkpatch check:
if ($realfile =~ m@^Documentation/devicetree/bindings/@ &&
not $spdx_license =~/GPL-2\.0.*BSD-2-Clause/) {It wants the whole string "GPL-2.0-only OR BSD-2-Clause" and my oatch has only "GPL-2.0-only".
Now, looking at a bunch of .yaml DT files, there are all kinds of formatting:
$ git grep -h SPDX *.yaml | sort | uniq -c
3 1:# SPDX-License-Identifier: (GPL-2.0)
313 1:# SPDX-License-Identifier: GPL-2.0
9 1:# SPDX-License-Identifier: GPL-2.0+
1 1:# SPDX-License-Identifier: (GPL-2.0-only)
43 1:# SPDX-License-Identifier: GPL-2.0-only
4 1:# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause)
1 1:# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
148 1:# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
25 1:# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
104 1:# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
3 1:# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
2 1:# SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)
1 1:# SPDX-License-Identifier: (GPL-2.0-or-later)
5 1:# SPDX-License-Identifier: GPL-2.0-or-later
3 1:# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
2 1:# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
3 1:# SPDX-License-Identifier: (GPL-2.0 OR MIT)
3 1:# SPDX-License-Identifier: (GPL-2.0+ OR MIT)
3 1:# SPDX-License-Identifier: (GPL-2.0+ OR X11)And the patch which did rule is:
commit 50c92900214dd9a55bcecc3c53e90d072aff6560
Author: Lubomir Rintel<[email protected]> Date: Mon Apr 6 20:11:13 2020 -0700
checkpatch: check proper licensing of Devicetree bindings
According to Devicetree maintainers (see Link: below), the Devicetree binding documents are preferrably licensed (GPL-2.0-only OR BSD-2-Clause).
Let's check that. The actual check is a bit more relaxed, to allow more liberal but compatible licensing (e.g. GPL-2.0-or-later OR BSD-2-Clause).
Will love your help.
This patch already have your (Rob) Reviewed-by so Boris and myself are unsure what is the right thing to do now.
Thanks,
Talel.
Quoted 6 lines
--
Regards/Gruss,
Boris.
Shenhar, Talel
maintainerRe: [PATCH v6 2/2] EDAC: al-mc-edac: Introduce Amazon's Annapurna Labs Memory Controller EDAC
In reply to Borislav PetkovQuoted 10 lines · Borislav Petkov
Quoted 5 lines · Talel
Quoted 3 lines
drivers/edac/al_mc_edac.c line 248
Quoted 2 lines
drivers/edac/al_mc_edac.c new file +2
-0+ mci =edac_mc_alloc (0 ,ARRAY_SIZE (layers), layers, +sizeof (struct al_mc_edac ));You can let that line stick out.
I rather avoid having this as a checkpatch warnning... (automation and stuff...)
checkpatch.pl - while useful - should not be taken to the letter and human brain should be applied to sanity check it what it warns about.
Quoted 7 lines
Quoted 3 lines
This line break does seems to my eye as too hard to read.
Let me know if you feel strongly about it.
I'm just sayin' - in the end of the day you'll be staring at that code - not me - so whatever *you* prefer. :-)
Just don't follow tools blindly.
Thanks, I will leave it that way as it will make my life easier (with automatic vim tools and automation) and doesn't really break code understanding.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
+ if (
al_mc->irq_ue<= 0 ||al_mc->irq_ce<= 0)Shouldn't this be && here?
I mean, you want to poll when neither of the IRQs can be found. But then if you find one of them and not the other, what do you do? Poll and interrupt? Is that case even possible?
Quoted 6 lines
Quoted 5 lines
Correct.
In case dt defined interrupt line only for one type and not for the other, than the interrupt mode shall be used for one of them while polling mode for the other.
That warrants a comment above it.
Shall be part of v7.
Quoted 8 lines
Thx.
--
Regards/Gruss,
Boris.
Shenhar, Talel
maintainerRe: [PATCH v6 1/2] dt-bindings: edac: al-mc-edac: Amazon's Annapurna Labs Memory Controller EDAC
In reply to Shenhar, TalelQuoted 69 lines · Talel
Quoted 22 lines · Borislav Petkov
Quoted 16 lines · Talel Shenhar
Document Amazon's Annapurna Labs Memory Controller EDAC SoC binding.
Signed-off-by Talel Shenhar <[email protected]>Reviewed-by Rob Herring <[email protected]>---
.../bindings/edac/amazon,al-mc-edac.yaml | 52
+++++++++++++++++++1 file changed, 52 insertions(+)create mode 100644
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yamlDocumentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml new file +0
-0Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml line 1
Quoted 1 line
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml new file +1
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0-onlyWARNING: DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause) #36: FILE:
Documentation/devicetree/bindings/edac/amazon,al-mc-edac.yaml:1:
+# SPDX-License-Identifier: GPL-2.0-onlyQuoted 1 line
Hi Rob, should I listen to checkpatch or ignore it?
Rob and other dt folks,
In continue to disscussion with Boris below, Looking at the checkpatch check:
if ($realfile =~ m@^Documentation/devicetree/bindings/@ && not $spdx_license =~/GPL-2\.0.*BSD-2-Clause/) {
It wants the whole string "GPL-2.0-only OR BSD-2-Clause" and my oatch has only "GPL-2.0-only".
Now, looking at a bunch of .yaml DT files, there are all kinds of formatting:
$ git grep -h SPDX *.yaml | sort | uniq -c 3 1:# SPDX-License-Identifier: (GPL-2.0) 313 1:# SPDX-License-Identifier: GPL-2.0 9 1:# SPDX-License-Identifier: GPL-2.0+ 1 1:# SPDX-License-Identifier: (GPL-2.0-only) 43 1:# SPDX-License-Identifier: GPL-2.0-only 4 1:# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) 1 1:# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause 148 1:# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 25 1:# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 104 1:# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 3 1:# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause 2 1:# SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause) 1 1:# SPDX-License-Identifier: (GPL-2.0-or-later) 5 1:# SPDX-License-Identifier: GPL-2.0-or-later 3 1:# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) 2 1:# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause 3 1:# SPDX-License-Identifier: (GPL-2.0 OR MIT) 3 1:# SPDX-License-Identifier: (GPL-2.0+ OR MIT) 3 1:# SPDX-License-Identifier: (GPL-2.0+ OR X11)And the patch which did rule is:
commit
50c92900214dd9a55bcecc3c53e90d072aff6560
Author: Lubomir Rintel<[email protected]>
Date: Mon Apr 6 20:11:13 2020 -0700checkpatch: check proper licensing of Devicetree bindings
According to Devicetree maintainers (see Link: below), the Devicetree binding documents are preferrably licensed (GPL-2.0-only OR BSD-2-Clause).
Quoted 6 lines
Let's check that. The actual check is a bit more relaxed, to allow more liberal but compatible licensing (e.g. GPL-2.0-or-later OR BSD-2-Clause).
Will love your help.
This patch already have your (Rob) Reviewed-by so Boris and myself are unsure what is the right thing to do now.
Borislav, after internal disscussion, we are good to go with the new license.
This shall be part of v7.
Quoted 10 lines
Thanks,
Talel.Quoted 6 lines
Signature · 5 lines
-- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette