diff mbox series

EDAC/synopsys: Fix the injection of the errors

Message ID 20240603051638.22332-1-shubhrajyoti.datta@amd.com (mailing list archive)
State New
Headers show
Series EDAC/synopsys: Fix the injection of the errors | expand

Commit Message

Datta, Shubhrajyoti June 3, 2024, 5:16 a.m. UTC
The Zynq UltraScale+ MPSoC DDR has a disjoint memory from 2GB to 32GB.
However the DDR host interface has a contiguous memory. So while
injecting the errors the address has to remove the hole.
Introduce get_mem_info function pointer and set it for zu+ platform
to return host interface address.

Fixes: 1a81361f75d8 ("EDAC, synopsys: Add Error Injection support for ZynqMP DDR controller")
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
---

 drivers/edac/synopsys_edac.c | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

Comments

kernel test robot June 3, 2024, 11:16 a.m. UTC | #1
Hi Shubhrajyoti,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.10-rc2 next-20240603]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shubhrajyoti-Datta/EDAC-synopsys-Fix-the-injection-of-the-errors/20240603-131853
base:   linus/master
patch link:    https://lore.kernel.org/r/20240603051638.22332-1-shubhrajyoti.datta%40amd.com
patch subject: [PATCH] EDAC/synopsys: Fix the injection of the errors
config: arm64-randconfig-001-20240603 (https://download.01.org/0day-ci/archive/20240603/202406031857.80s6OP7c-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240603/202406031857.80s6OP7c-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406031857.80s6OP7c-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/edac/synopsys_edac.c: In function 'zynqmp_get_mem_info':
>> drivers/edac/synopsys_edac.c:419:27: error: 'struct synps_edac_priv' has no member named 'poison_addr'
     419 |         linear_addr = priv->poison_addr;
         |                           ^~


vim +419 drivers/edac/synopsys_edac.c

   407	
   408	/**
   409	 * zynqmp_get_mem_info - Get the current memory info.
   410	 * @priv:	DDR memory controller private instance data.
   411	 *
   412	 * Return: host interface address.
   413	 */
   414	static ulong zynqmp_get_mem_info(struct synps_edac_priv *priv)
   415	{
   416		ulong hif_addr = 0;
   417		ulong linear_addr;
   418	
 > 419		linear_addr = priv->poison_addr;
   420		if (linear_addr >= SZ_32G)
   421			linear_addr = linear_addr - SZ_32G + SZ_2G;
   422		hif_addr = linear_addr >> 3;
   423		return hif_addr;
   424	}
   425
diff mbox series

Patch

diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c
index ea7a9a342dd3..2e54a81c5d4d 100644
--- a/drivers/edac/synopsys_edac.c
+++ b/drivers/edac/synopsys_edac.c
@@ -10,6 +10,7 @@ 
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
+#include <linux/sizes.h>
 #include <linux/interrupt.h>
 #include <linux/of.h>
 
@@ -337,6 +338,7 @@  struct synps_edac_priv {
  * @get_mtype:		Get mtype.
  * @get_dtype:		Get dtype.
  * @get_ecc_state:	Get ECC state.
+ * @get_mem_info:	Get EDAC memory info
  * @quirks:		To differentiate IPs.
  */
 struct synps_platform_data {
@@ -344,6 +346,7 @@  struct synps_platform_data {
 	enum mem_type (*get_mtype)(const void __iomem *base);
 	enum dev_type (*get_dtype)(const void __iomem *base);
 	bool (*get_ecc_state)(void __iomem *base);
+	ulong (*get_mem_info)(struct synps_edac_priv *priv);
 	int quirks;
 };
 
@@ -402,6 +405,24 @@  static int zynq_get_error_info(struct synps_edac_priv *priv)
 	return 0;
 }
 
+/**
+ * zynqmp_get_mem_info - Get the current memory info.
+ * @priv:	DDR memory controller private instance data.
+ *
+ * Return: host interface address.
+ */
+static ulong zynqmp_get_mem_info(struct synps_edac_priv *priv)
+{
+	ulong hif_addr = 0;
+	ulong linear_addr;
+
+	linear_addr = priv->poison_addr;
+	if (linear_addr >= SZ_32G)
+		linear_addr = linear_addr - SZ_32G + SZ_2G;
+	hif_addr = linear_addr >> 3;
+	return hif_addr;
+}
+
 /**
  * zynqmp_get_error_info - Get the current ECC error info.
  * @priv:	DDR memory controller private instance data.
@@ -922,6 +943,7 @@  static const struct synps_platform_data zynqmp_edac_def = {
 	.get_mtype	= zynqmp_get_mtype,
 	.get_dtype	= zynqmp_get_dtype,
 	.get_ecc_state	= zynqmp_get_ecc_state,
+	.get_mem_info	= zynqmp_get_mem_info,
 	.quirks         = (DDR_ECC_INTR_SUPPORT
 #ifdef CONFIG_EDAC_DEBUG
 			  | DDR_ECC_DATA_POISON_SUPPORT
@@ -975,10 +997,16 @@  MODULE_DEVICE_TABLE(of, synps_edac_match);
 static void ddr_poison_setup(struct synps_edac_priv *priv)
 {
 	int col = 0, row = 0, bank = 0, bankgrp = 0, rank = 0, regval;
+	const struct synps_platform_data *p_data;
 	int index;
 	ulong hif_addr = 0;
 
-	hif_addr = priv->poison_addr >> 3;
+	p_data = priv->p_data;
+
+	if (p_data->get_mem_info)
+		hif_addr = p_data->get_mem_info(priv);
+	else
+		hif_addr = priv->poison_addr >> 3;
 
 	for (index = 0; index < DDR_MAX_ROW_SHIFT; index++) {
 		if (priv->row_shift[index])