mbox series

[v8,00/10] EDAC: Enhancements to Synopsys EDAC driver

Message ID 1538667328-9465-1-git-send-email-manish.narani@xilinx.com
Headers show
Series EDAC: Enhancements to Synopsys EDAC driver | expand

Message

Manish Narani Oct. 4, 2018, 3:35 p.m. UTC
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

Changes in v6:
	- Splitted the patches according to functionalities
	- Addressed code style comments from v5 review
	- Moved the Error Injection to CONFIG_EDAC_DEBUG mode

Changes in v7:
	- Included DTS patch (6/7) which was missed in v6 patch set

Changes in v8:
	- patch (1/7) from v7 is split in to 3 different logically different patches
		1. functional changes like code cleanup
		2. functions renaming
		3. comments cleanup
	- Added a separate patch (4) for making always successful functions as void
	- Corrected 'Too many parentheses' review comment in patch (5)
	- Corrected comments as per the v7 review feedback
	- Made dedicated functions for IRQ setup, IRQ enable and IRQ disable in patch (8)
	- Addressed review comments in patch (10)

Manish Narani (10):
  edac: synopsys: Update the driver code for better readability
  edac: synopsys: Rename the static functions to a shorter name
  edac: synopsys: Modify the comments in the driver
  edac: synopsys: Make return type void for functions always returning 0
  edac: synps: Add platform specific structures for ddrc controller
  dt: bindings: Document ZynqMP DDRC in Synopsys documentation
  edac: synopsys: Add macro defines for ZynqMP DDRC
  edac: synopsys: Add EDAC ECC support for ZynqMP DDRC
  arm64: zynqmp: Add DDRC node
  edac: synopsys: Add Error Injection support for ZynqMP DDRC

 .../bindings/memory-controllers/synopsys.txt       |   27 +-
 arch/arm64/boot/dts/xilinx/zynqmp.dtsi             |    7 +
 drivers/edac/Kconfig                               |    2 +-
 drivers/edac/synopsys_edac.c                       | 1194 +++++++++++++++++---
 4 files changed, 1072 insertions(+), 158 deletions(-)

Comments

Borislav Petkov Oct. 5, 2018, 4:53 p.m. UTC | #1
On Thu, Oct 04, 2018 at 09:05:23PM +0530, Manish Narani wrote:
> Add platform specific structures, so that we can add different IP
> support later using quirks.
> 
> Signed-off-by: Manish Narani <manish.narani@xilinx.com>
> ---
>  drivers/edac/synopsys_edac.c | 91 +++++++++++++++++++++++++++++++-------------
>  1 file changed, 65 insertions(+), 26 deletions(-)

...

> @@ -423,6 +465,7 @@ static void edac_mc_init(struct mem_ctl_info *mci,
>   */
>  static int synps_edac_mc_probe(struct platform_device *pdev)
>  {
> +	const struct synps_platform_data *p_data;
>  	struct edac_mc_layer layers[2];
>  	struct synps_edac_priv *priv;
>  	struct mem_ctl_info *mci;
> @@ -435,7 +478,8 @@ static int synps_edac_mc_probe(struct platform_device *pdev)
>  	if (IS_ERR(baseaddr))
>  		return PTR_ERR(baseaddr);
>  
> -	if (!edac_get_eccstate(baseaddr)) {
> +	p_data = of_device_get_match_data(&pdev->dev);

That of_device_get_match_data()  does return NULL...

> +	if (!p_data->get_eccstate(baseaddr)) {

... I'm sure you can imagine what happens here if so.

Anyway, I've pushed what I've applied so far, here:

https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git/log/?h=edac-for-4.20-synps

Please add the error handling ontop of the top patch on that branch and
send the diff to me.

Thx.
Manish Narani Oct. 8, 2018, 1:45 p.m. UTC | #2
Hi Boris,

Thanks a lot for the review.

> -----Original Message-----
> From: Borislav Petkov [mailto:bp@alien8.de]
> Sent: Friday, October 5, 2018 2:06 AM
> Subject: Re: [PATCH v8 02/10] edac: synopsys: Rename the static functions to a
> shorter name
> 
> On Thu, Oct 04, 2018 at 09:05:20PM +0530, Manish Narani wrote:
> > Rename the static functions to a shorter name. Since this is Synopsys
> > EDAC driver, better to remove unnecessary 'synps_' prefix in function
> > names.
> >
> > Signed-off-by: Manish Narani <manish.narani@xilinx.com>
> > ---
> >  drivers/edac/synopsys_edac.c | 56 ++++++++++++++++++++++-------------------
> ---
> >  1 file changed, 28 insertions(+), 28 deletions(-)
> 
> Ok, let's flip the roles - now you get to review what I've committed:

Okay. Few minor nits below. :)

> 
> ---
> From: Manish Narani <manish.narani@xilinx.com>
> Date: Thu, 4 Oct 2018 21:05:20 +0530
> Subject: [PATCH 1/2] EDAC, synopsys: Shorten static function names
> 
> Shorten static function names, remove the unnecessary 'synps_' prefix in
> function names.
> 
>  [ bp: Drop the "edac_" prefix too as that prefix is reserved for
>    EDAC core functions. ]
> 
> Signed-off-by: Manish Narani <manish.narani@xilinx.com>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> CC: Mauro Carvalho Chehab <mchehab@kernel.org>
> CC: Michal Simek <michal.simek@xilinx.com>
> CC: amit.kucheria@linaro.org
> CC: devicetree@vger.kernel.org
> CC: leoyang.li@nxp.com
> CC: linux-arm-kernel@lists.infradead.org
> CC: linux-edac <linux-edac@vger.kernel.org>
> CC: mark.rutland@arm.com
> CC: robh+dt@kernel.org
> CC: sudeep.holla@arm.com
> Link: http://lkml.kernel.org/r/1538667328-9465-3-git-send-email-
> manish.narani@xilinx.com
> ---
>  drivers/edac/synopsys_edac.c | 79 +++++++++++++++++-------------------
>  1 file changed, 38 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c
> index 1936c73f1d15..fbaf33540ce3 100644
> --- a/drivers/edac/synopsys_edac.c
> +++ b/drivers/edac/synopsys_edac.c
> @@ -142,7 +142,7 @@ struct synps_edac_priv {
>  };
> 
>  /**
> - * synps_edac_geterror_info - Get the current ecc error info
> + * get_error_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
>   *
> @@ -150,8 +150,7 @@ struct synps_edac_priv {
>   *
>   * 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 get_error_info(void __iomem *base, struct synps_ecc_status *p)
>  {
>  	u32 regval, clearval = 0;
> 
> @@ -196,14 +195,13 @@ static int synps_edac_geterror_info(void __iomem
> *base,
>  }
> 
>  /**
> - * synps_edac_handle_error - Handle controller error types CE and UE
> + * handle_error - Handle controller error types CE and UE
>   * @mci:	Pointer to the edac memory controller instance
>   * @p:		Pointer to the synopsys ecc status structure
>   *
> - * Handles the controller ECC correctable and un correctable error.
> + * Handles the controller ECC correctable and uncorrectable error.

Nit: This can be moved to Comments Correction patch

>   */
> -static void synps_edac_handle_error(struct mem_ctl_info *mci,
> -				    struct synps_ecc_status *p)
> +static void handle_error(struct mem_ctl_info *mci, struct synps_ecc_status
> *p)
>  {
>  	struct synps_edac_priv *priv = mci->pvt_info;
>  	struct ecc_error_info *pinf;
> @@ -232,30 +230,30 @@ static void synps_edac_handle_error(struct
> mem_ctl_info *mci,
>  }
> 
>  /**
> - * synps_edac_check - Check controller for ECC errors
> + * check_errors - Check controller for ECC errors
>   * @mci:	Pointer to the edac memory controller instance
>   *
>   * Used to check and post ECC errors. Called by the polling thread
>   */
> -static void synps_edac_check(struct mem_ctl_info *mci)
> +static void check_errors(struct mem_ctl_info *mci)
>  {
>  	struct synps_edac_priv *priv = mci->pvt_info;
>  	int status;
> 
> -	status = synps_edac_geterror_info(priv->baseaddr, &priv->stat);
> +	status = get_error_info(priv->baseaddr, &priv->stat);
>  	if (status)
>  		return;
> 
>  	priv->ce_cnt += priv->stat.ce_cnt;
>  	priv->ue_cnt += priv->stat.ue_cnt;
> -	synps_edac_handle_error(mci, &priv->stat);
> +	handle_error(mci, &priv->stat);
> 
>  	edac_dbg(3, "Total error count CE %d UE %d\n",
>  		 priv->ce_cnt, priv->ue_cnt);
>  }
> 
>  /**
> - * synps_edac_get_dtype - Return the controller memory width
> + * get_dtype - Return the controller memory width
>   * @base:	Pointer to the ddr memory controller base address
>   *
>   * Get the EDAC device type width appropriate for the current controller
> @@ -263,7 +261,7 @@ static void synps_edac_check(struct mem_ctl_info
> *mci)
>   *
>   * Return: a device type width enumeration.
>   */
> -static enum dev_type synps_edac_get_dtype(const void __iomem *base)
> +static enum dev_type get_dtype(const void __iomem *base)
>  {
>  	enum dev_type dt;
>  	u32 width;
> @@ -286,20 +284,20 @@ static enum dev_type synps_edac_get_dtype(const
> void __iomem *base)
>  }
> 
>  /**
> - * synps_edac_get_eccstate - Return the controller ecc enable/disable status
> - * @base:	Pointer to the ddr memory controller base address
> + * get_ecc_state - Return the controller ECC enable/disable status

Nit: ecc --> ECC correction can be moved to Comments correction patch. Minor. Can keep it here too. 

> + * @base:	Pointer to the DDR memory controller base address

Nit: This should be moved to Comments correction patch.

>   *
> - * Get the ECC enable/disable status for the controller
> + * Get the ECC enable/disable status for the controller.

Nit: This should be moved to Comments correction patch.

>   *
> - * Return: a ecc status boolean i.e true/false - enabled/disabled.
> + * Return: a ECC status boolean i.e true/false - enabled/disabled.

Nit: Can move to Comments correction patch.

>   */


Thanks,
Manish
Borislav Petkov Oct. 8, 2018, 6:03 p.m. UTC | #3
On Mon, Oct 08, 2018 at 01:45:28PM +0000, Manish Narani wrote:
> >  /**
> > - * synps_edac_get_eccstate - Return the controller ecc enable/disable status
> > - * @base:	Pointer to the ddr memory controller base address
> > + * get_ecc_state - Return the controller ECC enable/disable status
> 
> Nit: ecc --> ECC correction can be moved to Comments correction patch. Minor. Can keep it here too. 
> 

All fixed except this one - this one can remain here because the patch
is touching the line anyway.

Thx.