linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 0/2] Improve CPC925 EDAC handling code on Maple
@ 2011-06-17 12:51 Dmitry Eremin-Solenikov
  2011-06-17 12:51 ` [PATCH V3 1/2] Maple: register CPC925 EDAC device on all boards with CPC925 Dmitry Eremin-Solenikov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-06-17 12:51 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

Hello, colleagues,

Another respin of this patchset.

Changes since previous version:
* Fix comments in cpc925_edac.c
* Rename cpc925_cpu_getmask() to cpc925_cpu_mask_disabled()
* Don't return an error from init code if it's a U3 and not U3H

 arch/powerpc/platforms/maple/setup.c |   41 +++++++++------------
 drivers/edac/cpc925_edac.c           |   67 +++++++++++++++++++++++++++++++++--
 2 files changed, 83 insertions(+), 25 deletions(-)

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH V3 1/2] Maple: register CPC925 EDAC device on all boards with CPC925
  2011-06-17 12:51 [PATCH V3 0/2] Improve CPC925 EDAC handling code on Maple Dmitry Eremin-Solenikov
@ 2011-06-17 12:51 ` Dmitry Eremin-Solenikov
  2011-06-17 12:51 ` [PATCH V3 2/2] cpc925_edac: support single-processor configurations Dmitry Eremin-Solenikov
  2011-06-27 14:07 ` [PATCH V3 0/2] Improve CPC925 EDAC handling code on Maple Dmitry Eremin-Solenikov
  2 siblings, 0 replies; 8+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-06-17 12:51 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

Currently Maple setup code creates cpc925_edac device only on
Motorola ATCA-6101 blade. Make setup code check bridge revision
and enable EDAC on all U3H bridges.

Verified on Momentum MapleD (ppc970fx kit) board.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 arch/powerpc/platforms/maple/setup.c |   41 +++++++++++++++------------------
 1 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index fe34c3d..5b3388b 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -338,35 +338,16 @@ define_machine(maple) {
 #ifdef CONFIG_EDAC
 /*
  * Register a platform device for CPC925 memory controller on
- * Motorola ATCA-6101 blade.
+ * all boards with U3H (CPC925) bridge.
  */
-#define MAPLE_CPC925_MODEL	"Motorola,ATCA-6101"
 static int __init maple_cpc925_edac_setup(void)
 {
 	struct platform_device *pdev;
 	struct device_node *np = NULL;
 	struct resource r;
-	const unsigned char *model;
 	int ret;
-
-	np = of_find_node_by_path("/");
-	if (!np) {
-		printk(KERN_ERR "%s: Unable to get root node\n", __func__);
-		return -ENODEV;
-	}
-
-	model = (const unsigned char *)of_get_property(np, "model", NULL);
-	if (!model) {
-		printk(KERN_ERR "%s: Unabel to get model info\n", __func__);
-		of_node_put(np);
-		return -ENODEV;
-	}
-
-	ret = strcmp(model, MAPLE_CPC925_MODEL);
-	of_node_put(np);
-
-	if (ret != 0)
-		return 0;
+	volatile void __iomem *mem;
+	u32 rev;
 
 	np = of_find_node_by_type(NULL, "memory-controller");
 	if (!np) {
@@ -384,6 +365,22 @@ static int __init maple_cpc925_edac_setup(void)
 		return -ENODEV;
 	}
 
+	mem = ioremap(r.start, resource_size(&r));
+	if (!mem) {
+		printk(KERN_ERR "%s: Unable to map memory-controller memory\n",
+				__func__);
+		return -ENOMEM;
+	}
+
+	rev = __raw_readl(mem);
+	iounmap(mem);
+
+	if (rev < 0x34 || rev > 0x3f) { /* U3H */
+		printk(KERN_ERR "%s: Non-CPC925(U3H) bridge revision: %02x\n",
+			__func__, rev);
+		return 0;
+	}
+
 	pdev = platform_device_register_simple("cpc925_edac", 0, &r, 1);
 	if (IS_ERR(pdev))
 		return PTR_ERR(pdev);
-- 
1.7.5.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH V3 2/2] cpc925_edac: support single-processor configurations
  2011-06-17 12:51 [PATCH V3 0/2] Improve CPC925 EDAC handling code on Maple Dmitry Eremin-Solenikov
  2011-06-17 12:51 ` [PATCH V3 1/2] Maple: register CPC925 EDAC device on all boards with CPC925 Dmitry Eremin-Solenikov
@ 2011-06-17 12:51 ` Dmitry Eremin-Solenikov
  2011-06-29  3:35   ` Benjamin Herrenschmidt
  2011-06-27 14:07 ` [PATCH V3 0/2] Improve CPC925 EDAC handling code on Maple Dmitry Eremin-Solenikov
  2 siblings, 1 reply; 8+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-06-17 12:51 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Harry Ciao, Paul Mackerras, Doug Thompson

If second CPU is not enabled, CPC925 EDAC driver will spill out warnings
about errors on second Processor Interface. Support masking that out,
by detecting at runtime which CPUs are present in device tree.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Harry Ciao <qingtao.cao@windriver.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/edac/cpc925_edac.c |   67 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 64 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
index a687a0d..a774c0d 100644
--- a/drivers/edac/cpc925_edac.c
+++ b/drivers/edac/cpc925_edac.c
@@ -90,6 +90,7 @@ enum apimask_bits {
 	ECC_MASK_ENABLE = (APIMASK_ECC_UE_H | APIMASK_ECC_CE_H |
 			   APIMASK_ECC_UE_L | APIMASK_ECC_CE_L),
 };
+#define APIMASK_ADI(n)		CPC925_BIT(((n)+1))
 
 /************************************************************
  *	Processor Interface Exception Register (APIEXCP)
@@ -581,16 +582,73 @@ static void cpc925_mc_check(struct mem_ctl_info *mci)
 }
 
 /******************** CPU err device********************************/
+static u32 cpc925_cpu_mask_disabled(void)
+{
+	struct device_node *cpus;
+	struct device_node *cpunode = NULL;
+	static u32 mask = 0;
+
+	/* use cached value if available */
+	if (mask != 0)
+		return mask;
+
+	mask = APIMASK_ADI0 | APIMASK_ADI1;
+
+	cpus = of_find_node_by_path("/cpus");
+	if (cpus == NULL) {
+		cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
+		return 0;
+	}
+
+	while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
+		const u32 *reg = of_get_property(cpunode, "reg", NULL);
+
+		if (strcmp(cpunode->type, "cpu")) {
+			cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name);
+			continue;
+		}
+
+		if (reg == NULL || *reg > 2) {
+			cpc925_printk(KERN_ERR, "Bad reg value at %s\n", cpunode->full_name);
+			continue;
+		}
+
+		mask &= ~APIMASK_ADI(*reg);
+	}
+
+	if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) {
+		/* We assume that each CPU sits on it's own PI and that
+		 * for present CPUs the reg property equals to the PI
+		 * interface id */
+		cpc925_printk(KERN_WARNING,
+				"Assuming PI id is equal to CPU MPIC id!\n");
+	}
+
+	of_node_put(cpunode);
+	of_node_put(cpus);
+
+	return mask;
+}
+
 /* Enable CPU Errors detection */
 static void cpc925_cpu_init(struct cpc925_dev_info *dev_info)
 {
 	u32 apimask;
+	u32 cpumask;
 
 	apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
-	if ((apimask & CPU_MASK_ENABLE) == 0) {
-		apimask |= CPU_MASK_ENABLE;
-		__raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
+
+	cpumask = cpc925_cpu_mask_disabled();
+	if (apimask & cpumask) {
+		cpc925_printk(KERN_WARNING, "CPU(s) not present, "
+				"but enabled in APIMASK, disabling\n");
+		apimask &= ~cpumask;
 	}
+
+	if ((apimask & CPU_MASK_ENABLE) == 0)
+		apimask |= CPU_MASK_ENABLE;
+
+	__raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
 }
 
 /* Disable CPU Errors detection */
@@ -622,6 +680,9 @@ static void cpc925_cpu_check(struct edac_device_ctl_info *edac_dev)
 	if ((apiexcp & CPU_EXCP_DETECTED) == 0)
 		return;
 
+	if ((apiexcp & ~cpc925_cpu_mask_disabled()) == 0)
+		return;
+
 	apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
 	cpc925_printk(KERN_INFO, "Processor Interface Fault\n"
 				 "Processor Interface register dump:\n");
-- 
1.7.5.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH V3 0/2] Improve CPC925 EDAC handling code on Maple
  2011-06-17 12:51 [PATCH V3 0/2] Improve CPC925 EDAC handling code on Maple Dmitry Eremin-Solenikov
  2011-06-17 12:51 ` [PATCH V3 1/2] Maple: register CPC925 EDAC device on all boards with CPC925 Dmitry Eremin-Solenikov
  2011-06-17 12:51 ` [PATCH V3 2/2] cpc925_edac: support single-processor configurations Dmitry Eremin-Solenikov
@ 2011-06-27 14:07 ` Dmitry Eremin-Solenikov
  2 siblings, 0 replies; 8+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-06-27 14:07 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

Hello,

On 6/17/11, Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> wrote:
> Hello, colleagues,
>
> Another respin of this patchset.
>
> Changes since previous version:
> * Fix comments in cpc925_edac.c
> * Rename cpc925_cpu_getmask() to cpc925_cpu_mask_disabled()
> * Don't return an error from init code if it's a U3 and not U3H
>
>  arch/powerpc/platforms/maple/setup.c |   41 +++++++++------------
>  drivers/edac/cpc925_edac.c           |   67
> +++++++++++++++++++++++++++++++++--
>  2 files changed, 83 insertions(+), 25 deletions(-)

Any chance to get this version reviewed/merged? Sorry for being noisy.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V3 2/2] cpc925_edac: support single-processor configurations
  2011-06-17 12:51 ` [PATCH V3 2/2] cpc925_edac: support single-processor configurations Dmitry Eremin-Solenikov
@ 2011-06-29  3:35   ` Benjamin Herrenschmidt
  2011-07-22 21:56     ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2011-06-29  3:35 UTC (permalink / raw)
  To: Doug Thompson
  Cc: Harry Ciao, Paul Mackerras, Dmitry Eremin-Solenikov, linuxppc-dev

On Fri, 2011-06-17 at 16:51 +0400, Dmitry Eremin-Solenikov wrote:
> If second CPU is not enabled, CPC925 EDAC driver will spill out warnings
> about errors on second Processor Interface. Support masking that out,
> by detecting at runtime which CPUs are present in device tree.

Doug ? Are you going to carry this or should I via powerpc.git ? There's
a dependency on another patch that's going into powerpc-next ...

Cheers,
Ben.

> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Harry Ciao <qingtao.cao@windriver.com>
> Cc: Doug Thompson <dougthompson@xmission.com>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
>  drivers/edac/cpc925_edac.c |   67 ++++++++++++++++++++++++++++++++++++++++++--
>  1 files changed, 64 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
> index a687a0d..a774c0d 100644
> --- a/drivers/edac/cpc925_edac.c
> +++ b/drivers/edac/cpc925_edac.c
> @@ -90,6 +90,7 @@ enum apimask_bits {
>  	ECC_MASK_ENABLE = (APIMASK_ECC_UE_H | APIMASK_ECC_CE_H |
>  			   APIMASK_ECC_UE_L | APIMASK_ECC_CE_L),
>  };
> +#define APIMASK_ADI(n)		CPC925_BIT(((n)+1))
>  
>  /************************************************************
>   *	Processor Interface Exception Register (APIEXCP)
> @@ -581,16 +582,73 @@ static void cpc925_mc_check(struct mem_ctl_info *mci)
>  }
>  
>  /******************** CPU err device********************************/
> +static u32 cpc925_cpu_mask_disabled(void)
> +{
> +	struct device_node *cpus;
> +	struct device_node *cpunode = NULL;
> +	static u32 mask = 0;
> +
> +	/* use cached value if available */
> +	if (mask != 0)
> +		return mask;
> +
> +	mask = APIMASK_ADI0 | APIMASK_ADI1;
> +
> +	cpus = of_find_node_by_path("/cpus");
> +	if (cpus == NULL) {
> +		cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
> +		return 0;
> +	}
> +
> +	while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
> +		const u32 *reg = of_get_property(cpunode, "reg", NULL);
> +
> +		if (strcmp(cpunode->type, "cpu")) {
> +			cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n", cpunode->name);
> +			continue;
> +		}
> +
> +		if (reg == NULL || *reg > 2) {
> +			cpc925_printk(KERN_ERR, "Bad reg value at %s\n", cpunode->full_name);
> +			continue;
> +		}
> +
> +		mask &= ~APIMASK_ADI(*reg);
> +	}
> +
> +	if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) {
> +		/* We assume that each CPU sits on it's own PI and that
> +		 * for present CPUs the reg property equals to the PI
> +		 * interface id */
> +		cpc925_printk(KERN_WARNING,
> +				"Assuming PI id is equal to CPU MPIC id!\n");
> +	}
> +
> +	of_node_put(cpunode);
> +	of_node_put(cpus);
> +
> +	return mask;
> +}
> +
>  /* Enable CPU Errors detection */
>  static void cpc925_cpu_init(struct cpc925_dev_info *dev_info)
>  {
>  	u32 apimask;
> +	u32 cpumask;
>  
>  	apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
> -	if ((apimask & CPU_MASK_ENABLE) == 0) {
> -		apimask |= CPU_MASK_ENABLE;
> -		__raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
> +
> +	cpumask = cpc925_cpu_mask_disabled();
> +	if (apimask & cpumask) {
> +		cpc925_printk(KERN_WARNING, "CPU(s) not present, "
> +				"but enabled in APIMASK, disabling\n");
> +		apimask &= ~cpumask;
>  	}
> +
> +	if ((apimask & CPU_MASK_ENABLE) == 0)
> +		apimask |= CPU_MASK_ENABLE;
> +
> +	__raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
>  }
>  
>  /* Disable CPU Errors detection */
> @@ -622,6 +680,9 @@ static void cpc925_cpu_check(struct edac_device_ctl_info *edac_dev)
>  	if ((apiexcp & CPU_EXCP_DETECTED) == 0)
>  		return;
>  
> +	if ((apiexcp & ~cpc925_cpu_mask_disabled()) == 0)
> +		return;
> +
>  	apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
>  	cpc925_printk(KERN_INFO, "Processor Interface Fault\n"
>  				 "Processor Interface register dump:\n");

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V3 2/2] cpc925_edac: support single-processor configurations
  2011-06-29  3:35   ` Benjamin Herrenschmidt
@ 2011-07-22 21:56     ` Dmitry Eremin-Solenikov
  2011-07-22 22:06       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-07-22 21:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Harry Ciao, Paul Mackerras, linuxppc-dev, Doug Thompson

On 6/29/11, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Fri, 2011-06-17 at 16:51 +0400, Dmitry Eremin-Solenikov wrote:
>> If second CPU is not enabled, CPC925 EDAC driver will spill out warnings
>> about errors on second Processor Interface. Support masking that out,
>> by detecting at runtime which CPUs are present in device tree.
>
> Doug ? Are you going to carry this or should I via powerpc.git ? There's
> a dependency on another patch that's going into powerpc-next ...

I'm sorry. It's been a month ago. Is there any consensus regarding these two
patches? Are they going in in the 3.1 merge window?

>
> Cheers,
> Ben.
>
>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>> Cc: Harry Ciao <qingtao.cao@windriver.com>
>> Cc: Doug Thompson <dougthompson@xmission.com>
>> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
>> ---
>>  drivers/edac/cpc925_edac.c |   67
>> ++++++++++++++++++++++++++++++++++++++++++--
>>  1 files changed, 64 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
>> index a687a0d..a774c0d 100644
>> --- a/drivers/edac/cpc925_edac.c
>> +++ b/drivers/edac/cpc925_edac.c
>> @@ -90,6 +90,7 @@ enum apimask_bits {
>>  	ECC_MASK_ENABLE = (APIMASK_ECC_UE_H | APIMASK_ECC_CE_H |
>>  			   APIMASK_ECC_UE_L | APIMASK_ECC_CE_L),
>>  };
>> +#define APIMASK_ADI(n)		CPC925_BIT(((n)+1))
>>
>>  /************************************************************
>>   *	Processor Interface Exception Register (APIEXCP)
>> @@ -581,16 +582,73 @@ static void cpc925_mc_check(struct mem_ctl_info
>> *mci)
>>  }
>>
>>  /******************** CPU err device********************************/
>> +static u32 cpc925_cpu_mask_disabled(void)
>> +{
>> +	struct device_node *cpus;
>> +	struct device_node *cpunode = NULL;
>> +	static u32 mask = 0;
>> +
>> +	/* use cached value if available */
>> +	if (mask != 0)
>> +		return mask;
>> +
>> +	mask = APIMASK_ADI0 | APIMASK_ADI1;
>> +
>> +	cpus = of_find_node_by_path("/cpus");
>> +	if (cpus == NULL) {
>> +		cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
>> +		return 0;
>> +	}
>> +
>> +	while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
>> +		const u32 *reg = of_get_property(cpunode, "reg", NULL);
>> +
>> +		if (strcmp(cpunode->type, "cpu")) {
>> +			cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n",
>> cpunode->name);
>> +			continue;
>> +		}
>> +
>> +		if (reg == NULL || *reg > 2) {
>> +			cpc925_printk(KERN_ERR, "Bad reg value at %s\n", cpunode->full_name);
>> +			continue;
>> +		}
>> +
>> +		mask &= ~APIMASK_ADI(*reg);
>> +	}
>> +
>> +	if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) {
>> +		/* We assume that each CPU sits on it's own PI and that
>> +		 * for present CPUs the reg property equals to the PI
>> +		 * interface id */
>> +		cpc925_printk(KERN_WARNING,
>> +				"Assuming PI id is equal to CPU MPIC id!\n");
>> +	}
>> +
>> +	of_node_put(cpunode);
>> +	of_node_put(cpus);
>> +
>> +	return mask;
>> +}
>> +
>>  /* Enable CPU Errors detection */
>>  static void cpc925_cpu_init(struct cpc925_dev_info *dev_info)
>>  {
>>  	u32 apimask;
>> +	u32 cpumask;
>>
>>  	apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
>> -	if ((apimask & CPU_MASK_ENABLE) == 0) {
>> -		apimask |= CPU_MASK_ENABLE;
>> -		__raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
>> +
>> +	cpumask = cpc925_cpu_mask_disabled();
>> +	if (apimask & cpumask) {
>> +		cpc925_printk(KERN_WARNING, "CPU(s) not present, "
>> +				"but enabled in APIMASK, disabling\n");
>> +		apimask &= ~cpumask;
>>  	}
>> +
>> +	if ((apimask & CPU_MASK_ENABLE) == 0)
>> +		apimask |= CPU_MASK_ENABLE;
>> +
>> +	__raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
>>  }
>>
>>  /* Disable CPU Errors detection */
>> @@ -622,6 +680,9 @@ static void cpc925_cpu_check(struct
>> edac_device_ctl_info *edac_dev)
>>  	if ((apiexcp & CPU_EXCP_DETECTED) == 0)
>>  		return;
>>
>> +	if ((apiexcp & ~cpc925_cpu_mask_disabled()) == 0)
>> +		return;
>> +
>>  	apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
>>  	cpc925_printk(KERN_INFO, "Processor Interface Fault\n"
>>  				 "Processor Interface register dump:\n");
>
>
>


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V3 2/2] cpc925_edac: support single-processor configurations
  2011-07-22 21:56     ` Dmitry Eremin-Solenikov
@ 2011-07-22 22:06       ` Benjamin Herrenschmidt
  2011-07-22 22:34         ` Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 8+ messages in thread
From: Benjamin Herrenschmidt @ 2011-07-22 22:06 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Harry Ciao, Paul Mackerras, linuxppc-dev, Doug Thompson

On Sat, 2011-07-23 at 01:56 +0400, Dmitry Eremin-Solenikov wrote:
> On 6/29/11, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> > On Fri, 2011-06-17 at 16:51 +0400, Dmitry Eremin-Solenikov wrote:
> >> If second CPU is not enabled, CPC925 EDAC driver will spill out warnings
> >> about errors on second Processor Interface. Support masking that out,
> >> by detecting at runtime which CPUs are present in device tree.
> >
> > Doug ? Are you going to carry this or should I via powerpc.git ? There's
> > a dependency on another patch that's going into powerpc-next ...
> 
> I'm sorry. It's been a month ago. Is there any consensus regarding these two
> patches? Are they going in in the 3.1 merge window?

There have been no response from the Doug, but I just realized we
haven't CCing their mailing list... oh well, I'll probably send them to
Linux myself some time next week.

Ben.

> > Cheers,
> > Ben.
> >
> >> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> >> Cc: Harry Ciao <qingtao.cao@windriver.com>
> >> Cc: Doug Thompson <dougthompson@xmission.com>
> >> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> >> ---
> >>  drivers/edac/cpc925_edac.c |   67
> >> ++++++++++++++++++++++++++++++++++++++++++--
> >>  1 files changed, 64 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c
> >> index a687a0d..a774c0d 100644
> >> --- a/drivers/edac/cpc925_edac.c
> >> +++ b/drivers/edac/cpc925_edac.c
> >> @@ -90,6 +90,7 @@ enum apimask_bits {
> >>  	ECC_MASK_ENABLE = (APIMASK_ECC_UE_H | APIMASK_ECC_CE_H |
> >>  			   APIMASK_ECC_UE_L | APIMASK_ECC_CE_L),
> >>  };
> >> +#define APIMASK_ADI(n)		CPC925_BIT(((n)+1))
> >>
> >>  /************************************************************
> >>   *	Processor Interface Exception Register (APIEXCP)
> >> @@ -581,16 +582,73 @@ static void cpc925_mc_check(struct mem_ctl_info
> >> *mci)
> >>  }
> >>
> >>  /******************** CPU err device********************************/
> >> +static u32 cpc925_cpu_mask_disabled(void)
> >> +{
> >> +	struct device_node *cpus;
> >> +	struct device_node *cpunode = NULL;
> >> +	static u32 mask = 0;
> >> +
> >> +	/* use cached value if available */
> >> +	if (mask != 0)
> >> +		return mask;
> >> +
> >> +	mask = APIMASK_ADI0 | APIMASK_ADI1;
> >> +
> >> +	cpus = of_find_node_by_path("/cpus");
> >> +	if (cpus == NULL) {
> >> +		cpc925_printk(KERN_DEBUG, "No /cpus node !\n");
> >> +		return 0;
> >> +	}
> >> +
> >> +	while ((cpunode = of_get_next_child(cpus, cpunode)) != NULL) {
> >> +		const u32 *reg = of_get_property(cpunode, "reg", NULL);
> >> +
> >> +		if (strcmp(cpunode->type, "cpu")) {
> >> +			cpc925_printk(KERN_ERR, "Not a cpu node in /cpus: %s\n",
> >> cpunode->name);
> >> +			continue;
> >> +		}
> >> +
> >> +		if (reg == NULL || *reg > 2) {
> >> +			cpc925_printk(KERN_ERR, "Bad reg value at %s\n", cpunode->full_name);
> >> +			continue;
> >> +		}
> >> +
> >> +		mask &= ~APIMASK_ADI(*reg);
> >> +	}
> >> +
> >> +	if (mask != (APIMASK_ADI0 | APIMASK_ADI1)) {
> >> +		/* We assume that each CPU sits on it's own PI and that
> >> +		 * for present CPUs the reg property equals to the PI
> >> +		 * interface id */
> >> +		cpc925_printk(KERN_WARNING,
> >> +				"Assuming PI id is equal to CPU MPIC id!\n");
> >> +	}
> >> +
> >> +	of_node_put(cpunode);
> >> +	of_node_put(cpus);
> >> +
> >> +	return mask;
> >> +}
> >> +
> >>  /* Enable CPU Errors detection */
> >>  static void cpc925_cpu_init(struct cpc925_dev_info *dev_info)
> >>  {
> >>  	u32 apimask;
> >> +	u32 cpumask;
> >>
> >>  	apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
> >> -	if ((apimask & CPU_MASK_ENABLE) == 0) {
> >> -		apimask |= CPU_MASK_ENABLE;
> >> -		__raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
> >> +
> >> +	cpumask = cpc925_cpu_mask_disabled();
> >> +	if (apimask & cpumask) {
> >> +		cpc925_printk(KERN_WARNING, "CPU(s) not present, "
> >> +				"but enabled in APIMASK, disabling\n");
> >> +		apimask &= ~cpumask;
> >>  	}
> >> +
> >> +	if ((apimask & CPU_MASK_ENABLE) == 0)
> >> +		apimask |= CPU_MASK_ENABLE;
> >> +
> >> +	__raw_writel(apimask, dev_info->vbase + REG_APIMASK_OFFSET);
> >>  }
> >>
> >>  /* Disable CPU Errors detection */
> >> @@ -622,6 +680,9 @@ static void cpc925_cpu_check(struct
> >> edac_device_ctl_info *edac_dev)
> >>  	if ((apiexcp & CPU_EXCP_DETECTED) == 0)
> >>  		return;
> >>
> >> +	if ((apiexcp & ~cpc925_cpu_mask_disabled()) == 0)
> >> +		return;
> >> +
> >>  	apimask = __raw_readl(dev_info->vbase + REG_APIMASK_OFFSET);
> >>  	cpc925_printk(KERN_INFO, "Processor Interface Fault\n"
> >>  				 "Processor Interface register dump:\n");
> >
> >
> >
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH V3 2/2] cpc925_edac: support single-processor configurations
  2011-07-22 22:06       ` Benjamin Herrenschmidt
@ 2011-07-22 22:34         ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-07-22 22:34 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Harry Ciao, Paul Mackerras, linuxppc-dev, Doug Thompson

On 7/23/11, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> On Sat, 2011-07-23 at 01:56 +0400, Dmitry Eremin-Solenikov wrote:
>> On 6/29/11, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>> > On Fri, 2011-06-17 at 16:51 +0400, Dmitry Eremin-Solenikov wrote:
>> >> If second CPU is not enabled, CPC925 EDAC driver will spill out
>> >> warnings
>> >> about errors on second Processor Interface. Support masking that out,
>> >> by detecting at runtime which CPUs are present in device tree.
>> >
>> > Doug ? Are you going to carry this or should I via powerpc.git ? There's
>> > a dependency on another patch that's going into powerpc-next ...
>>
>> I'm sorry. It's been a month ago. Is there any consensus regarding these
>> two
>> patches? Are they going in in the 3.1 merge window?
>
> There have been no response from the Doug, but I just realized we
> haven't CCing their mailing list... oh well, I'll probably send them to
> Linux myself some time next week.

Thank you very much!

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-07-22 22:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-17 12:51 [PATCH V3 0/2] Improve CPC925 EDAC handling code on Maple Dmitry Eremin-Solenikov
2011-06-17 12:51 ` [PATCH V3 1/2] Maple: register CPC925 EDAC device on all boards with CPC925 Dmitry Eremin-Solenikov
2011-06-17 12:51 ` [PATCH V3 2/2] cpc925_edac: support single-processor configurations Dmitry Eremin-Solenikov
2011-06-29  3:35   ` Benjamin Herrenschmidt
2011-07-22 21:56     ` Dmitry Eremin-Solenikov
2011-07-22 22:06       ` Benjamin Herrenschmidt
2011-07-22 22:34         ` Dmitry Eremin-Solenikov
2011-06-27 14:07 ` [PATCH V3 0/2] Improve CPC925 EDAC handling code on Maple Dmitry Eremin-Solenikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).