EDAC: Enhancements to Synopsys EDAC driver
v5 cover EDAC: Enhancements to Synopsys EDAC driver
This patch series enhances the current EDAC driver to support different platforms. This series adds support for ZynqMP DDRC controller in synopsys EDAC driver. This series also adds Device tree properties and relevant binding documentation.
Changes in v2:
- Moved checking of DDR_ECC_INTR_SUPPORT from (1/4) to (3/4) as it is a feature of ZynqMP DDRC
- The Binding Documentation in (2/4) is modified as per the review comments
Changes in v3:
- The commit message in (2/4) is modified (Synopsys EDAC Driver --> ZynqMP DDRC)
Changes in v4:
- Updated the commit message in (1/4)
- Renamed function pointer names removing 'synps_' in (1/4)
- Shortened unnecessary long lines as per the review comment on (1/4)
Changes in v5:
- Updated the commit message in (2/4) and (4/4).
- Removed the unnecessary check for match data in probe() in (1/4)
- Some Indentation changes for better readability in (1/4) and (3/4)
- Removed repeated code in (3/4)
- Used 'zynq' and 'zynqmp' instead of 'synps_enh_edac' in function names
Manish Narani (4):
edac: synps: Add platform specific structures for ddrc controller
dt: bindings: Document ZynqMP DDRC in Synopsys documentation
edac: synopsys: Add EDAC ECC support for ZynqMP DDRC
arm64: zynqmp: Add DDRC node
.../bindings/memory-controllers/synopsys.txt | 27 +- arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 7 + drivers/edac/Kconfig | 2 +- drivers/edac/synopsys_edac.c | 1086 ++++++++++++++++++-- 4 files changed, 1002 insertions(+), 120 deletions(-)
Signature · 1 line
2.1.1
PATCH v5 1/4 edac: synps: Add platform specific structures for ddrc controller
Add platform specific structures, so that we can add different IP support later using quirks.
--- drivers/edac/synopsys_edac.c | 78 +++++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 19 deletions(-)
drivers/edac/synopsys_edac.c +59 -19
@@ -22,6 +22,8 @@#include <linux/edac.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/of.h> +#include <linux/of_device.h> #include "edac_module.h"
@@ -130,6 +132,7 @@ struct synps_ecc_status {* @baseaddr: Base address of the DDR controller * @message: Buffer for framing the event specific info * @stat: ECC status information +* @p_data: Pointer to platform data * @ce_cnt: Correctable Error count * @ue_cnt: Uncorrectable Error count */
@@ -137,24 +140,47 @@ struct synps_edac_priv {void __iomem *baseaddr;char message[SYNPS_EDAC_MSG_SIZE ];struct synps_ecc_status stat; +const struct synps_platform_data *p_data;u32 ce_cnt;u32 ue_cnt; };/** +* struct synps_platform_data - synps platform data structure +* @edac_geterror_info: function pointer to synps edac error info +* @edac_get_mtype: function pointer to synps edac mtype +* @edac_get_dtype: function pointer to synps edac dtype +* @edac_get_eccstate: function pointer to synps edac eccstate +* @quirks: to differentiate IPs +*/ +struct synps_platform_data { +int (*edac_geterror_info)(struct synps_edac_priv *priv); +enum mem_type (*edac_get_mtype)(const void __iomem *base); +enum dev_type (*edac_get_dtype)(const void __iomem *base); +bool (*edac_get_eccstate)(void __iomem *base); +int quirks; +}; + +/** * synps_edac_geterror_info - Get the current ecc error info -* @base: Pointer to the base address of the ddr memory controller -* @p: Pointer to the synopsys ecc status structure +* @priv: Pointer to DDR memory controller private instance data * * Determines there is any ecc error or not * * Return: one if there is no error otherwise returns zero */ -static int synps_edac_geterror_info (void __iomem *base, -struct synps_ecc_status *p) +static int synps_edac_geterror_info (struct synps_edac_priv *priv) { +void __iomem *base; +struct synps_ecc_status *p;u32 regval, clearval =0 ; +if (!priv) +return 1 ; + + base = priv->baseaddr; + p = &priv->stat; + regval =readl (base +STAT_OFST );if (!regval)return 1 ;
@@ -240,9 +266,10 @@ static void synps_edac_handle_error(struct mem_ctl_info *mci,static void synps_edac_check (struct mem_ctl_info *mci) {struct synps_edac_priv *priv = mci->pvt_info; +const struct synps_platform_data *p_data = priv->p_data;int status; - status =synps_edac_geterror_info (priv->baseaddr, &priv->stat); + status = p_data->edac_geterror_info (priv);if (status)return ;
@@ -362,6 +389,7 @@ static int synps_edac_init_csrows(struct mem_ctl_info *mci)struct csrow_info *csi;struct dimm_info *dimm;struct synps_edac_priv *priv = mci->pvt_info; +const struct synps_platform_data *p_data = priv->p_data;u32 size;int row, j;
@@ -370,12 +398,12 @@ static int synps_edac_init_csrows(struct mem_ctl_info *mci) size =synps_edac_get_memsize ();for (j =0 ; j < csi->nr_channels; j++) { - dimm = csi->channels[j]->dimm; - dimm->edac_mode =EDAC_FLAG_SECDED ; - dimm->mtype =synps_edac_get_mtype (priv->baseaddr); - dimm->nr_pages = (size >>PAGE_SHIFT ) / csi->nr_channels; - dimm->grain =SYNPS_EDAC_ERR_GRAIN ; - dimm->dtype =synps_edac_get_dtype (priv->baseaddr); + dimm = csi->channels[j]->dimm; + dimm->edac_mode =EDAC_FLAG_SECDED ; + dimm->mtype = p_data->edac_get_mtype (priv->baseaddr); + dimm->nr_pages = (size >>PAGE_SHIFT ) / csi->nr_channels; + dimm->grain =SYNPS_EDAC_ERR_GRAIN ; + dimm->dtype = p_data->edac_get_dtype (priv->baseaddr); } }
@@ -423,6 +451,21 @@ static int synps_edac_mc_init(struct mem_ctl_info *mci,return status; } +static const struct synps_platform_data zynq_edac_def = { + .edac_geterror_info = synps_edac_geterror_info, + .edac_get_mtype = synps_edac_get_mtype, + .edac_get_dtype = synps_edac_get_dtype, + .edac_get_eccstate = synps_edac_get_eccstate, + .quirks =0 , +}; + +static const struct of_device_id synps_edac_match[] = { + { .compatible ="xlnx,zynq-ddrc-a05" , .data = (void *)&zynq_edac_def }, + {/* end of table */ } +}; + +MODULE_DEVICE_TABLE (of, synps_edac_match); +/** * synps_edac_mc_probe - Check controller and bind driver * @pdev: Pointer to the platform_device struct
@@ -440,13 +483,15 @@ static int synps_edac_mc_probe(struct platform_device *pdev)int rc;struct resource *res;void __iomem *baseaddr; +const struct synps_platform_data *p_data; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); baseaddr =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (baseaddr))return PTR_ERR (baseaddr); -if (!synps_edac_get_eccstate (baseaddr)) { + p_data =of_device_get_match_data (&pdev->dev); +if (!(p_data->edac_get_eccstate (baseaddr))) {edac_printk (KERN_INFO ,EDAC_MC ,"ECC not enabled\n" );return -ENXIO ; }
@@ -468,6 +513,8 @@ static int synps_edac_mc_probe(struct platform_device *pdev) priv = mci->pvt_info; priv->baseaddr = baseaddr; + priv->p_data = p_data; + rc =synps_edac_mc_init (mci, pdev);if (rc) { edac_printk(KERN_ERR, EDAC_MC,
@@ -511,13 +558,6 @@ static int synps_edac_mc_remove(struct platform_device *pdev)return 0 ; } -static const struct of_device_id synps_edac_match[] = { - { .compatible ="xlnx,zynq-ddrc-a05" , }, - {/* end of table */ } -}; - -MODULE_DEVICE_TABLE (of, synps_edac_match); -static struct platform_driver synps_edac_mc_driver = { .driver = { .name ="synopsys-edac" ,
Signature · 1 line
2.1.1
Borislav Petkov
maintainerRe: [PATCH v5 1/4] edac: synps: Add platform specific structures for ddrc controller
Quoted 35 lines · Manish Narani
Add platform specific structures, so that we can add different IP support later using quirks.
Signed-off-by Manish Narani <[email protected]>--- drivers/edac/synopsys_edac.c | 78 +++++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 19 deletions(-)drivers/edac/synopsys_edac.c +4
-0@@ -22,6 +22,8 @@#include <linux/edac.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/of.h> +#include <linux/of_device.h> #include "edac_module.h" @@ -130,6 +132,7 @@ struct synps_ecc_status {* @baseaddr: Base address of the DDR controller * @message: Buffer for framing the event specific info * @stat: ECC status information +* @p_data: Pointer to platform data * @ce_cnt: Correctable Error count * @ue_cnt: Uncorrectable Error count */ @@ -137,24 +140,47 @@ struct synps_edac_priv {void __iomem *baseaddr;char message[SYNPS_EDAC_MSG_SIZE ];struct synps_ecc_status stat; +const struct synps_platform_data *p_data;u32 ce_cnt;
drivers/edac/synopsys_edac.c struct synps_edac_priv { · line 154
Quoted 10 lines
drivers/edac/synopsys_edac.c +6
-0u32 ue_cnt; };/** +* struct synps_platform_data - synps platform data structure +* @edac_geterror_info: function pointer to synps edac error info +* @edac_get_mtype: function pointer to synps edac mtype +* @edac_get_dtype: function pointer to synps edac dtype +* @edac_get_eccstate: function pointer to synps edac eccstate +* @quirks: to differentiate IPs
Kill all that "function pointer" fluff. Here's how I've changed it:
/**
* struct synps_platform_data - synps platform data structure
* @edac_geterror_info: edac error info
* @edac_get_mtype: get mtype * @edac_get_dtype: get dtype * @edac_get_eccstate: get ECC state * @quirks: to differentiate IPs
*/
Shorter, quicker to read/scan/etc...
Quoted 6 lines
drivers/edac/synopsys_edac.c +6
-0+*/ +struct synps_platform_data { +int (*edac_geterror_info)(struct synps_edac_priv *priv); +enum mem_type (*edac_get_mtype)(const void __iomem *base); +enum dev_type (*edac_get_dtype)(const void __iomem *base); +bool (*edac_get_eccstate)(void __iomem *base);
drivers/edac/synopsys_edac.c struct synps_edac_priv { · line 168
Quoted 10 lines
drivers/edac/synopsys_edac.c +5
-2+int quirks; +}; + +/** * synps_edac_geterror_info - Get the current ecc error info -* @base: Pointer to the base address of the ddr memory controller -* @p: Pointer to the synopsys ecc status structure +* @priv: Pointer to DDR memory controller private instance data * * Determines there is any ecc error or not
All sentences end with a fullstop. Check all your patches.
Also, it is not "ecc" it is "ECC". Also go over all your patches.
drivers/edac/synopsys_edac.c struct synps_edac_priv { · line 176
Quoted 10 lines
drivers/edac/synopsys_edac.c +3
-2* * Return: one if there is no error otherwise returns zero */ -static int synps_edac_geterror_info (void __iomem *base, -struct synps_ecc_status *p) +static int synps_edac_geterror_info (struct synps_edac_priv *priv) { +void __iomem *base; +struct synps_ecc_status *p;u32 regval, clearval =0 ;
Please sort function local variables declaration in a reverse christmas tree order:
<type> longest_variable_name; <type> shorter_var_name; <type> even_shorter; <type> i;
drivers/edac/synopsys_edac.c struct synps_edac_priv { · line 179
Quoted 3 lines
drivers/edac/synopsys_edac.c +2
-0+if (!priv) +return 1 ;
Why are you even checking this here?
synps_edac_check() is merrily dereferencing it - if anything we will explode there already.
drivers/edac/synopsys_edac.c static int synps_edac_init_csrows(struct mem_ctl_info *mci)
Quoted 28 lines
drivers/edac/synopsys_edac.c +7
-1+ + base = priv->baseaddr; + p = &priv->stat; + regval =readl (base +STAT_OFST );if (!regval)return 1 ;@@ -240,9 +266,10 @@ static void synps_edac_handle_error(struct mem_ctl_info *mci,static void synps_edac_check (struct mem_ctl_info *mci) {struct synps_edac_priv *priv = mci->pvt_info; +const struct synps_platform_data *p_data = priv->p_data;int status; - status =synps_edac_geterror_info (priv->baseaddr, &priv->stat); + status = p_data->edac_geterror_info (priv);if (status)return ;@@ -362,6 +389,7 @@ static int synps_edac_init_csrows(struct mem_ctl_info *mci)struct csrow_info *csi;struct dimm_info *dimm;struct synps_edac_priv *priv = mci->pvt_info; +const struct synps_platform_data *p_data = priv->p_data;u32 size;int row, j;@@ -370,12 +398,12 @@ static int synps_edac_init_csrows(struct mem_ctl_info *mci)
That function returns 0 unconditionally. Make it a void in a prepatch.
Quoted 41 lines
drivers/edac/synopsys_edac.c +21
-6size =synps_edac_get_memsize ();for (j =0 ; j < csi->nr_channels; j++) { - dimm = csi->channels[j]->dimm; - dimm->edac_mode =EDAC_FLAG_SECDED ; - dimm->mtype =synps_edac_get_mtype (priv->baseaddr); - dimm->nr_pages = (size >>PAGE_SHIFT ) / csi->nr_channels; - dimm->grain =SYNPS_EDAC_ERR_GRAIN ; - dimm->dtype =synps_edac_get_dtype (priv->baseaddr); + dimm = csi->channels[j]->dimm; + dimm->edac_mode =EDAC_FLAG_SECDED ; + dimm->mtype = p_data->edac_get_mtype (priv->baseaddr); + dimm->nr_pages = (size >>PAGE_SHIFT ) / csi->nr_channels; + dimm->grain =SYNPS_EDAC_ERR_GRAIN ; + dimm->dtype = p_data->edac_get_dtype (priv->baseaddr); } }@@ -423,6 +451,21 @@ static int synps_edac_mc_init(struct mem_ctl_info *mci,return status; } +static const struct synps_platform_data zynq_edac_def = { + .edac_geterror_info = synps_edac_geterror_info, + .edac_get_mtype = synps_edac_get_mtype, + .edac_get_dtype = synps_edac_get_dtype, + .edac_get_eccstate = synps_edac_get_eccstate, + .quirks =0 , +}; + +static const struct of_device_id synps_edac_match[] = { + { .compatible ="xlnx,zynq-ddrc-a05" , .data = (void *)&zynq_edac_def }, + {/* end of table */ } +}; + +MODULE_DEVICE_TABLE (of, synps_edac_match); +/** * synps_edac_mc_probe - Check controller and bind driver * @pdev: Pointer to the platform_device struct
drivers/edac/synopsys_edac.c static int synps_edac_mc_probe(struct platform_device *pdev) · line 486
Quoted 4 lines
drivers/edac/synopsys_edac.c +1
-0@@ -440,13 +483,15 @@ static int synps_edac_mc_probe(struct platform_device *pdev)int rc;struct resource *res;void __iomem *baseaddr; +const struct synps_platform_data *p_data;
Please sort function local variables declaration in a reverse christmas tree order:
<type> longest_variable_name; <type> shorter_var_name; <type> even_shorter; <type> i;
drivers/edac/synopsys_edac.c static int synps_edac_mc_probe(struct platform_device *pdev) · line 494
Quoted 9 lines
drivers/edac/synopsys_edac.c +2
-1res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); baseaddr =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (baseaddr))return PTR_ERR (baseaddr); -if (!synps_edac_get_eccstate (baseaddr)) { + p_data =of_device_get_match_data (&pdev->dev); +if (!(p_data->edac_get_eccstate (baseaddr))) {
Too many parentheses:
if (!p_data->...
is enough.
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.RE: [PATCH v5 1/4] edac: synps: Add platform specific structures for ddrc controller
Hi Boris,
Thanks a lot for the review. Please see my comments inline.
Quoted 41 lines
-----Original Message-----
From: Borislav Petkov [mailto:bp at alien8.de]
Sent: Tuesday, September 4, 2018 10:28 PM
To: Manish Narani <[email protected]>
Cc: robh+dt at kernel.org; mark.rutland at arm.com; Michal Simek <[email protected]>; mchehab at kernel.org; leoyang.li at nxp.com; amit.kucheria at linaro.org; olof at lixom.net; Srinivas Goud <[email protected]>; Anirudha Sarangi <[email protected]>; linux-kernel at vger.kernel.org; devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- edac at vger.kernel.org
Subject: Re: [PATCH v5 1/4] edac: synps: Add platform specific structures for ddrc controllerQuoted 13 lines · Manish Narani
Add platform specific structures, so that we can add different IP support later using quirks.
Signed-off-by Manish Narani <[email protected]>--- drivers/edac/synopsys_edac.c | 78 +++++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 19 deletions(-)(quoted diff) +0
-0
b/drivers/edac/synopsys_edac.cindex 0c9c59e..2470d35 100644drivers/edac/synopsys_edac.c struct synps_edac_priv { · line 154
Quoted 8 lines
drivers/edac/synopsys_edac.c +6
-0/** +* struct synps_platform_data - synps platform data structure +* @edac_geterror_info: function pointer to synps edac error info +* @edac_get_mtype: function pointer to synps edac mtype +* @edac_get_dtype: function pointer to synps edac dtype +* @edac_get_eccstate: function pointer to synps edac eccstate +* @quirks: to differentiate IPs Kill all that "function pointer" fluff. Here's how I've changed it:
/**
* structsynps_platform_data- synps platform data structure
* @edac_geterror_info: edac error info
Quoted 7 lines
* @edac_get_mtype: get mtype * @edac_get_dtype: get dtype * @edac_get_eccstate: get ECC state * @quirks: to differentiate IPs*/
Shorter, quicker to read/scan/etc...
Okay. I will update this way throughout all the patches.
Quoted 10 lines
Quoted 8 lines
+/**
*synps_edac_geterror_info- Get the current ecc error info
- * @base: Pointer to the base address of the ddr memory controller
- * @p: Pointer to the synopsys ecc status structure
+ * @priv: Pointer to DDR memory controller private instance data
*
* Determines there is any ecc error or notAll sentences end with a fullstop. Check all your patches.
Okay.
Quoted 2 lines
Also, it is not "ecc" it is "ECC". Also go over all your patches.
Okay. I updated this in (3/4), but I will update this as a separate patch in v6.
Quoted 15 lines
drivers/edac/synopsys_edac.c struct synps_edac_priv { · line 176
Quoted 11 lines
*
* Return: one if there is no error otherwise returns zero */drivers/edac/synopsys_edac.c +3
-2-static int synps_edac_geterror_info (void __iomem *base, -struct synps_ecc_status *p) +static int synps_edac_geterror_info (struct synps_edac_priv *priv) { +void __iomem *base; +struct synps_ecc_status *p;u32 regval, clearval =0 ;Please sort function local variables declaration in a reverse christmas tree order:
Quoted 5 lines
<type> longest_variable_name; <type> shorter_var_name; <type> even_shorter; <type> i;
Okay.
Quoted 8 lines
drivers/edac/synopsys_edac.c struct synps_edac_priv { · line 179
Quoted 3 lines
drivers/edac/synopsys_edac.c +2
-0+if (!priv) +return 1 ;Why are you even checking this here?
synps_edac_check()is merrily dereferencing it - if anything we will explode there already.
Okay. I will remove this in v6.
Quoted 6 lines
drivers/edac/synopsys_edac.c static int synps_edac_init_csrows(struct · line 398
Quoted 4 lines
drivers/edac/synopsys_edac.c +0
-0@@ -370,12 +398,12 @@ static int synps_edac_init_csrows(struct mem_ctl_info *mci)That function returns 0 unconditionally. Make it a void in a prepatch.
Sure.
Quoted 10 lines
drivers/edac/synopsys_edac.c static int synps_edac_mc_probe(struct platform_device *pdev) · line 494
Quoted 4 lines
drivers/edac/synopsys_edac.c +2
-1-if (!synps_edac_get_eccstate (baseaddr)) { + p_data =of_device_get_match_data (&pdev->dev); +if (!(p_data->edac_get_eccstate (baseaddr))) {Too many parentheses:
if (!p_data->...is enough.
Okay.
Thanks,
Manish Narani
PATCH v5 2/4 dt: bindings: Document ZynqMP DDRC in Synopsys documentation
In reply to Manish NaraniAdd information of ZynqMP DDRC which reports the single bit errors that are corrected and the double bit errors that are detected.
--- .../bindings/memory-controllers/synopsys.txt | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/memory-controllers/synopsys.txt +22 -5
@@ -1,15 +1,32 @@ Binding for Synopsys IntelliDDR Multi Protocol Memory Controller -This controller has an optional ECC support in half-bus width (16-bit) -configuration. The ECC controller corrects one bit error and detects -two bit errors. +The ZynqMP DDR ECC controller has an optional ECC support in 64-bit and 32-bit +bus width configurations. + +The Zynq DDR ECC controller has an optional ECC support in half-bus width +(16-bit) configuration. + +These both ECC controllers correct single bit ECC errors and detect double bit +ECC errors. Required properties: - - compatible: Should be 'xlnx,zynq-ddrc-a05' - - reg: Base address and size of the controllers memory area + - compatible: One of: + - 'xlnx,zynq-ddrc-a05' : Zynq DDR ECC controller + - 'xlnx,zynqmp-ddrc-2.40a' : ZynqMP DDR ECC controller + - reg: Should contain DDR controller registers location and length. + +Required properties for "xlnx,zynqmp-ddrc-2.40a": + - interrupts: Property with a value describing the interrupt number. Example: memory-controller at f8006000 { compatible = "xlnx,zynq-ddrc-a05"; reg = <0xf8006000 0x1000>; }; + + mc: memory-controller at fd070000 { + compatible = "xlnx,zynqmp-ddrc-2.40a"; + reg = <0x0 0xfd070000 0x0 0x30000>; + interrupt-parent = <&gic>; + interrupts = <0 112 4>; + };
Signature · 1 line
2.1.1
Rob Herring
maintainerRe: [PATCH v5 2/4] dt: bindings: Document ZynqMP DDRC in Synopsys documentation
Quoted 7 lines · Manish Narani
Add information of ZynqMP DDRC which reports the single bit errors that are corrected and the double bit errors that are detected.
Signed-off-by Manish Narani <[email protected]>--- .../bindings/memory-controllers/synopsys.txt | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-)
Please add acks/reviewed-bys when posting new versions.
Rob
RE: [PATCH v5 2/4] dt: bindings: Document ZynqMP DDRC in Synopsys documentation
Hi Rob,
Quoted 17 lines
-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Tuesday, September 4, 2018 7:46 PM
To: Manish Narani <[email protected]>
Cc: mark.rutland at arm.com; Michal Simek <[email protected]>;
bp at alien8.de; mchehab at kernel.org; leoyang.li at nxp.com; amit.kucheria at linaro.org; olof at lixom.net; Srinivas Goud <[email protected]>; Anirudha Sarangi <[email protected]>; linux-kernel at vger.kernel.org; devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- edac at vger.kernel.org
Subject: Re: [PATCH v5 2/4] dt: bindings: Document ZynqMP DDRC in Synopsys documentationQuoted 3 lines · Manish Narani
Add information of ZynqMP DDRC which reports the single bit errors that are corrected and the double bit errors that are detected.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Manish Narani <[email protected]>--- .../bindings/memory-controllers/synopsys.txt | 27 ++++++++++++++++++----
Quoted 1 line
1 file changed, 22 insertions(+), 5 deletions(-)Please add acks/reviewed-bys when posting new versions.
Sure. I will include it in v6.
Thanks,
Manish Narani
PATCH v5 3/4 edac: synopsys: Add EDAC ECC support for ZynqMP DDRC
In reply to Manish NaraniAdd EDAC ECC support for ZynqMP DDRC IP. Also add support for ECC Error Injection in ZynqMP. The corrected and uncorrected error interrupts support is added. The Row, Column, Bank, Bank Group and Rank bits positions are determined via Address Map registers of Synopsys DDRC. Minor indentation changes are also done for better readability.
--- drivers/edac/Kconfig | 2 +- drivers/edac/synopsys_edac.c | 1054 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 937 insertions(+), 119 deletions(-)
drivers/edac/Kconfig +1 -1
@@ -441,7 +441,7 @@ config EDAC_ALTERA_SDMMC config EDAC_SYNOPSYS tristate "Synopsys DDR Memory Controller" - depends on ARCH_ZYNQ + depends on ARCH_ZYNQ || ARM64 help Support for error detection and correction on the Synopsys DDR memory controller.
drivers/edac/synopsys_edac.c +936 -118
1,305 lines not on this page · raw message
Signature · 1 line
2.1.1
Borislav Petkov
maintainerRe: [PATCH v5 3/4] edac: synopsys: Add EDAC ECC support for ZynqMP DDRC
Quoted 11 lines · Manish Narani
Add EDAC ECC support for ZynqMP DDRC IP. Also add support for ECC Error Injection in ZynqMP. The corrected and uncorrected error interrupts support is added. The Row, Column, Bank, Bank Group and Rank bits positions are determined via Address Map registers of Synopsys DDRC. Minor indentation changes are also done for better readability.
Signed-off-by Manish Narani <[email protected]>--- drivers/edac/Kconfig | 2 +- drivers/edac/synopsys_edac.c | 1054 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 937 insertions(+), 119 deletions(-)
...
Quoted 10 lines
drivers/edac/synopsys_edac.c +6
-0@@ -222,11 +408,77 @@ static int synps_edac_geterror_info(struct synps_edac_priv *priv) }/** +* zynqmp_geterror_info - Get the current ECC error info +* @priv: DDR memory controller private instance data +* +* Get the ECC error information from the ECC registers and clear the error +* status bits in the ECC registers. +*
drivers/edac/synopsys_edac.c static int synps_edac_geterror_info(struct synps_edac_priv *priv) · line 426
Quoted 10 lines
drivers/edac/synopsys_edac.c +10
-0+* Return: 0 if there is no error, otherwise return 1 +*/ +static int zynqmp_geterror_info (struct synps_edac_priv *priv) +{ +void __iomem *base; +struct synps_ecc_status *p; +u32 regval, clearval =0 ; + +if (!priv) +return 1 ;
Same as for the previous patch: why are you testing this since you're dereferencing it before calling this function?
...
drivers/edac/synopsys_edac.c static void synps_edac_handle_error(struct mem_ctl_info *mci, · line 543
Quoted 9 lines
drivers/edac/synopsys_edac.c +5
-0@@ -258,10 +536,46 @@ static void synps_edac_handle_error(struct mem_ctl_info *mci, }/** +* synps_edac_intr_handler - Interrupt Handler for ECC interrupts +* @irq: irq number +* @dev_id: device id pointer +* +* This is the ISR called by EDAC core interrupt thread.
There's an "EDAC core interrupt thread"?!? This is the first time I hear of it.
Try again.
Quoted 15 lines
drivers/edac/synopsys_edac.c +15
-0+* This is used to check and post ECC errors. +* +* Return: IRQ_NONE, if interrupt not set or IRQ_HANDLED otherwise. +*/ +static irqreturn_t synps_edac_intr_handler (int irq,void *dev_id) +{ +struct mem_ctl_info *mci = dev_id; +struct synps_edac_priv *priv = mci->pvt_info; +const struct synps_platform_data *p_data = priv->p_data; +int status, regval; + + regval =readl (priv->baseaddr +DDR_QOS_IRQ_STAT_OFST ); + regval &= (DDR_QOSCE_MASK |DDR_QOSUE_MASK ); +if (!(regval &ECC_CE_UE_INTR_MASK )) +return IRQ_NONE ;
drivers/edac/synopsys_edac.c static void synps_edac_handle_error(struct mem_ctl_info *mci, · line 568
Quoted 10 lines
drivers/edac/synopsys_edac.c +10
-0+ + status = p_data->geterror_info (priv); +if (status) +return IRQ_NONE ; + + priv->ce_cnt += priv->stat.ce_cnt; + priv->ue_cnt += priv->stat.ue_cnt; +synps_edac_handle_error (mci, &priv->stat); + + edac_dbg(3, "Total error count ce %d ue %d\n",
"ce" and "ue" are also abbreviations and should be in caps.
...
Quoted 5 lines
drivers/edac/synopsys_edac.c +5
-0+static DEVICE_ATTR_RW (inject_data_error); +static DEVICE_ATTR_RW (inject_data_poison); + +static int synps_edac_create_sysfs_attributes (struct mem_ctl_info *mci) +{
drivers/edac/synopsys_edac.c static int synps_edac_mc_init(struct mem_ctl_info *mci, · line 1025
Quoted 10 lines
drivers/edac/synopsys_edac.c +10
-0+int rc; + + rc =device_create_file (&mci->dev, &dev_attr_inject_data_error); +if (rc <0 ) +return rc; + rc =device_create_file (&mci->dev, &dev_attr_inject_data_poison); +if (rc <0 ) +return rc; +return 0 ; +}
I think I'm having a deja-vu:
Last time I said:
"More importantly, you need to put all that injection functionality behind CONFIG_EDAC_DEBUG - you don't want to expose the injection capabilities on a production machine."
and you said:
"I agree. I will update the same by keeping the above mentioned macro."
But maybe you've misunderstood me.
Grep the other EDAC drivers to find out how to hide the injection functionality behind CONFIG_EDAC_DEBUG.
And maybe this patch is becoming huuge and too unwieldy to review properly and for you to incorporate all the feedback.
Therefore, please split it in single patches, each of which is doing different things:
1. fixup/change comments
2. add defines
3. add functionality X
4. add functionality Y
...
5. add injection
6. tie it all together
Apply some common sense and put yourself in the reviewer's shoes when doing so.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.RE: [PATCH v5 3/4] edac: synopsys: Add EDAC ECC support for ZynqMP DDRC
Hi Boris,
Thanks for the review.
Quoted 44 lines
-----Original Message-----
From: Borislav Petkov [mailto:bp at alien8.de]
Sent: Wednesday, September 5, 2018 3:50 PM
To: Manish Narani <[email protected]>
Cc: robh+dt at kernel.org; mark.rutland at arm.com; Michal Simek <[email protected]>; mchehab at kernel.org; leoyang.li at nxp.com; amit.kucheria at linaro.org; olof at lixom.net; Srinivas Goud <[email protected]>; Anirudha Sarangi <[email protected]>; linux-kernel at vger.kernel.org; devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux- edac at vger.kernel.org
Subject: Re: [PATCH v5 3/4] edac: synopsys: Add EDAC ECC support for ZynqMP DDRCQuoted 4 lines · Manish Narani
Add EDAC ECC support for ZynqMP DDRC IP. Also add support for ECC Error Injection in ZynqMP. The corrected and uncorrected error interrupts support is added. The Row, Column, Bank, Bank Group and Rank bits positions are determined via Address Map registers of Synopsys
DDRC.
Quoted 8 lines
Minor indentation changes are also done for better readability.
Signed-off-by Manish Narani <[email protected]>--- drivers/edac/Kconfig | 2 +- drivers/edac/synopsys_edac.c | 1054 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 937 insertions(+), 119 deletions(-)...
Quoted 14 lines
drivers/edac/synopsys_edac.c +10
-0@@ -222,11 +408,77 @@ static int synps_edac_geterror_info(struct synps_edac_priv *priv) }/** +* zynqmp_geterror_info - Get the current ECC error info +* @priv: DDR memory controller private instance data +* +* Get the ECC error information from the ECC registers and clear the +error +* status bits in the ECC registers. +* +* Return: 0 if there is no error, otherwise return 1 */ static int +zynqmp_geterror_info (struct synps_edac_priv *priv) { +void __iomem *base;
Quoted 8 lines
drivers/edac/synopsys_edac.c static int synps_edac_geterror_info(struct synps_edac_priv *priv) · line 426
Quoted 5 lines
drivers/edac/synopsys_edac.c +5
-0+struct synps_ecc_status *p; +u32 regval, clearval =0 ; + +if (!priv) +return 1 ;Same as for the previous patch: why are you testing this since you're dereferencing it before calling this function?
Okay.
Quoted 15 lines
...
drivers/edac/synopsys_edac.c static void synps_edac_handle_error(struct · line 543
Quoted 9 lines
drivers/edac/synopsys_edac.c +5
-0@@ -258,10 +536,46 @@ static void synps_edac_handle_error(struct mem_ctl_info *mci, }/** +* synps_edac_intr_handler - Interrupt Handler for ECC interrupts +* @irq: irq number +* @dev_id: device id pointer +* +* This is the ISR called by EDAC core interrupt thread. There's an "EDAC core interrupt thread"?!? This is the first time I hear of it.
Quoted 1 line
Try again.
Okay. I will update this in v6.
Quoted 19 lines
Quoted 19 lines
drivers/edac/synopsys_edac.c +18
-0+* This is used to check and post ECC errors. +* +* Return: IRQ_NONE, if interrupt not set or IRQ_HANDLED otherwise. +*/ +static irqreturn_t synps_edac_intr_handler (int irq,void *dev_id) { +struct mem_ctl_info *mci = dev_id; +struct synps_edac_priv *priv = mci->pvt_info; +const struct synps_platform_data *p_data = priv->p_data; +int status, regval; + + regval =readl (priv->baseaddr +DDR_QOS_IRQ_STAT_OFST ); + regval &= (DDR_QOSCE_MASK |DDR_QOSUE_MASK ); +if (!(regval &ECC_CE_UE_INTR_MASK )) +return IRQ_NONE ; + + status = p_data->geterror_info (priv); +if (status) +return IRQ_NONE ;
Quoted 8 lines
drivers/edac/synopsys_edac.c static void synps_edac_handle_error(struct mem_ctl_info *mci, · line 568
Quoted 6 lines
drivers/edac/synopsys_edac.c +6
-0+ + priv->ce_cnt += priv->stat.ce_cnt; + priv->ue_cnt += priv->stat.ue_cnt; +synps_edac_handle_error (mci, &priv->stat); + + edac_dbg(3, "Total error count ce %d ue %d\n","ce" and "ue" are also abbreviations and should be in caps.
Okay. Will be taken care in v6.
Quoted 27 lines
...
Quoted 5 lines
drivers/edac/synopsys_edac.c +5
-0+static DEVICE_ATTR_RW (inject_data_error); +static DEVICE_ATTR_RW (inject_data_poison); + +static int synps_edac_create_sysfs_attributes (struct mem_ctl_info +*mci) {drivers/edac/synopsys_edac.c static int synps_edac_mc_init(struct mem_ctl_info *mci, · line 1025
Quoted 10 lines
drivers/edac/synopsys_edac.c +10
-0+int rc; + + rc =device_create_file (&mci->dev, &dev_attr_inject_data_error); +if (rc <0 ) +return rc; + rc =device_create_file (&mci->dev, &dev_attr_inject_data_poison); +if (rc <0 ) +return rc; +return 0 ; +}I think I'm having a deja-vu:
Last time I said:
"More importantly, you need to put all that injection functionality behind
CONFIG_EDAC_DEBUG- you don't want to expose the injection capabilities on a production machine."
Quoted 5 lines
and you said:
"I agree. I will update the same by keeping the above mentioned macro."
But maybe you've misunderstood me.
I missed it in v5. Sorry for the inconvenience. Will update that in v6.
Quoted 10 lines
Grep the other EDAC drivers to find out how to hide the injection functionality behind
CONFIG_EDAC_DEBUG.And maybe this patch is becoming huuge and too unwieldy to review properly and for you to incorporate all the feedback.
Therefore, please split it in single patches, each of which is doing different things:
Quoted 7 lines
1. fixup/change comments
2. add defines
3. add functionality X
4. add functionality Y
...
5. add injection
6. tie it all together
Will do the same in v6.
Thanks,
Manish Narani
PATCH v5 4/4 arm64: zynqmp: Add DDRC node
In reply to Manish NaraniAdd ddrc memory controller node in dts. The size mentioned in dts is 0x30000, because we need to access DDR_QOS INTR registers located at 0xFD090208 from this driver.
--- arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +7 -0
@@ -355,6 +355,13 @@ xlnx,bus-width = <64>; }; + mc: memory-controller at fd070000 { + compatible = "xlnx,zynqmp-ddrc-2.40a"; + reg = <0x0 0xfd070000 0x0 0x30000>; + interrupt-parent = <&gic>; + interrupts = <0 112 4>; + }; + gem0: ethernet at ff0b0000 { compatible = "cdns,zynqmp-gem", "cdns,gem"; status = "disabled";
Signature · 1 line
2.1.1
Borislav Petkov
maintainerRe: [PATCH v5 4/4] arm64: zynqmp: Add DDRC node
Quoted 18 lines · Manish Narani
Add ddrc memory controller node in dts. The size mentioned in dts is
0x30000, because we need to accessDDR_QOSINTR registers located at0xFD090208from this driver.Signed-off-by Manish Narani <[email protected]>--- arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm64/boot/dts/xilinx/zynqmp.dtsi +0
-0@@ -355,6 +355,13 @@ xlnx,bus-width = <64>; };
arch/arm64/boot/dts/xilinx/zynqmp.dtsi line 367
Quoted 10 lines
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +7
-0+ mc: memory-controller at fd070000 { + compatible = "xlnx,zynqmp-ddrc-2.40a"; + reg = <0x0 0xfd070000 0x0 0x30000>; + interrupt-parent = <&gic>; + interrupts = <0 112 4>; + }; + gem0: ethernet at ff0b0000 { compatible = "cdns,zynqmp-gem", "cdns,gem"; status = "disabled";
This still needs Rob's ACK.
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.