Re: [PATCH 1/21] [POWERPC] Reworking machine check handling and Fix 440/440A

2007-12-24 Thread Josh Boyer
On Sun, 23 Dec 2007 19:32:10 -0600
Josh Boyer [EMAIL PROTECTED] wrote:

 On Fri, 21 Dec 2007 15:39:21 +1100
 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:
 
  Index: linux-merge/arch/powerpc/kernel/traps.c
  ===
  --- linux-merge.orig/arch/powerpc/kernel/traps.c2007-12-20 
  11:34:43.0 +1100
  +++ linux-merge/arch/powerpc/kernel/traps.c 2007-12-20 11:35:40.0 
  +1100
 
 [snip]
 
  -#elif defined (CONFIG_E500)
  +   return 0;
  +}
  +#elif defined(CONFIG_E500)
  +int machine_check_e500(struct pt_regs *regs)
 
 This...
 
  +{
  +   unsigned long reason = get_mc_reason(regs);
  +
  printk(Machine check in kernel mode.\n);
  printk(Caused by (from MCSR=%lx): , reason);
  
  @@ -403,7 +416,14 @@ static int generic_machine_check_excepti
  printk(Bus - Instruction Parity Error\n);
  if (reason  MCSR_BUS_RPERR)
  printk(Bus - Read Parity Error\n);
  -#elif defined (CONFIG_E200)
  +
  +   return 0;
  +}
  +#elif defined(CONFIG_E200)
  +int machine_check_e200(struct pt_regs *regs)
 
 ... and this cause build failures for most of the mpc8xxx defconfigs.
 The reason is that e200 and e500 are both lumped under CONFIG_FSL_BOOKE
 in cputable.c, but you have them segregated more here.  I've added a
 fix that just does CONFIG_FSL_BOOKE here to match cputable.c.

Actually, reverse that.  There are other places where e200 and e500 are
separated by ifdefs, so I made cputable.c match the rest.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/21] [POWERPC] Reworking machine check handling and Fix 440/440A

2007-12-23 Thread Josh Boyer
On Fri, 21 Dec 2007 15:39:21 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:

 Index: linux-merge/arch/powerpc/kernel/traps.c
 ===
 --- linux-merge.orig/arch/powerpc/kernel/traps.c  2007-12-20 
 11:34:43.0 +1100
 +++ linux-merge/arch/powerpc/kernel/traps.c   2007-12-20 11:35:40.0 
 +1100

[snip]

 -#elif defined (CONFIG_E500)
 + return 0;
 +}
 +#elif defined(CONFIG_E500)
 +int machine_check_e500(struct pt_regs *regs)

This...

 +{
 + unsigned long reason = get_mc_reason(regs);
 +
   printk(Machine check in kernel mode.\n);
   printk(Caused by (from MCSR=%lx): , reason);
 
 @@ -403,7 +416,14 @@ static int generic_machine_check_excepti
   printk(Bus - Instruction Parity Error\n);
   if (reason  MCSR_BUS_RPERR)
   printk(Bus - Read Parity Error\n);
 -#elif defined (CONFIG_E200)
 +
 + return 0;
 +}
 +#elif defined(CONFIG_E200)
 +int machine_check_e200(struct pt_regs *regs)

... and this cause build failures for most of the mpc8xxx defconfigs.
The reason is that e200 and e500 are both lumped under CONFIG_FSL_BOOKE
in cputable.c, but you have them segregated more here.  I've added a
fix that just does CONFIG_FSL_BOOKE here to match cputable.c.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/21] [POWERPC] Reworking machine check handling and Fix 440/440A

2007-12-21 Thread Josh Boyer
On Fri, 21 Dec 2007 15:39:21 +1100
Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:


 Index: linux-merge/include/asm-ppc/reg_booke.h
 ===
 --- linux-merge.orig/include/asm-ppc/reg_booke.h  2007-09-28 
 11:42:10.0 +1000
 +++ linux-merge/include/asm-ppc/reg_booke.h   2007-12-20 11:35:40.0 
 +1100
 @@ -207,7 +207,7 @@
  #define  CCR1_TCS0x0080 /* Timer Clock Select */
 
  /* Bit definitions for the MCSR. */
 -#ifdef CONFIG_440A
 +#ifdef CONFIG_44x

Should be #ifdef CONFIG_4xx as I pointed out last time.  I'll fix it
when I commit.

josh
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/21] [POWERPC] Reworking machine check handling and Fix 440/440A

2007-12-21 Thread Benjamin Herrenschmidt

On Fri, 2007-12-21 at 06:01 -0600, Josh Boyer wrote:
 On Fri, 21 Dec 2007 15:39:21 +1100
 Benjamin Herrenschmidt [EMAIL PROTECTED] wrote:
 
 
  Index: linux-merge/include/asm-ppc/reg_booke.h
  ===
  --- linux-merge.orig/include/asm-ppc/reg_booke.h2007-09-28 
  11:42:10.0 +1000
  +++ linux-merge/include/asm-ppc/reg_booke.h 2007-12-20 11:35:40.0 
  +1100
  @@ -207,7 +207,7 @@
   #defineCCR1_TCS0x0080 /* Timer Clock Select */
  
   /* Bit definitions for the MCSR. */
  -#ifdef CONFIG_440A
  +#ifdef CONFIG_44x
 
 Should be #ifdef CONFIG_4xx as I pointed out last time.  I'll fix it
 when I commit.

Ah weird, I though I fixed it... I must have fixed powerpc and not ppc.

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/21] [POWERPC] Reworking machine check handling and Fix 440/440A

2007-12-20 Thread Benjamin Herrenschmidt
This adds a cputable function pointer for the CPU-side machine
check handling. The semantic is still the same as the old one,
the one in ppc_md. overrides the one in cputable, though
ultimately we'll want to change that so the CPU gets first.

This removes CONFIG_440A which was a problem for multiplatform
kernels and instead fixes up the IVOR at runtime from a setup_cpu
function. The A version of the machine check also tweaks the
regs-trap value to differenciate the 2 versions at the C level.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/cpu_setup_44x.S |9 +++
 arch/powerpc/kernel/cputable.c  |  105 
 arch/powerpc/kernel/head_44x.S  |   14 +++-
 arch/powerpc/kernel/head_booke.h|2 
 arch/powerpc/kernel/traps.c |   62 -
 arch/powerpc/platforms/44x/Kconfig  |5 -
 arch/ppc/kernel/traps.c |   98 ++---
 include/asm-powerpc/cputable.h  |   13 
 include/asm-powerpc/ptrace.h|3 -
 include/asm-powerpc/reg_booke.h |3 -
 include/asm-ppc/reg_booke.h |2 
 11 files changed, 258 insertions(+), 58 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/cpu_setup_44x.S2007-10-15 
11:19:35.0 +1000
+++ linux-merge/arch/powerpc/kernel/cpu_setup_44x.S 2007-12-20 
11:35:40.0 +1100
@@ -23,11 +23,20 @@ _GLOBAL(__setup_cpu_440epx)
mflrr4
bl  __init_fpu_44x
bl  __plb_disable_wrp
+   bl  __fixup_440A_mcheck
mtlrr4
blr
 _GLOBAL(__setup_cpu_440grx)
b   __plb_disable_wrp
+_GLOBAL(__setup_cpu_440gx)
+_GLOBAL(__setup_cpu_440spe)
+   b   __fixup_440A_mcheck
 
+ /* Temporary fixup for arch/ppc until we kill the whole thing */
+#ifndef CONFIG_PPC_MERGE
+_GLOBAL(__fixup_440A_mcheck)
+   blr
+#endif
 
 /* enable APU between CPU and FPU */
 _GLOBAL(__init_fpu_44x)
Index: linux-merge/arch/powerpc/kernel/cputable.c
===
--- linux-merge.orig/arch/powerpc/kernel/cputable.c 2007-12-20 
11:34:43.0 +1100
+++ linux-merge/arch/powerpc/kernel/cputable.c  2007-12-20 11:35:40.0 
+1100
@@ -33,7 +33,9 @@ EXPORT_SYMBOL(cur_cpu_spec);
 #ifdef CONFIG_PPC32
 extern void __setup_cpu_440ep(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec);
+extern void __setup_cpu_440gx(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec);
+extern void __setup_cpu_440spe(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);
@@ -85,6 +87,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type   = PPC_PMC_IBM,
.oprofile_cpu_type  = ppc64/power3,
.oprofile_type  = PPC_OPROFILE_RS64,
+   .machine_check  = machine_check_generic,
.platform   = power3,
},
{   /* Power3+ */
@@ -99,6 +102,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type   = PPC_PMC_IBM,
.oprofile_cpu_type  = ppc64/power3,
.oprofile_type  = PPC_OPROFILE_RS64,
+   .machine_check  = machine_check_generic,
.platform   = power3,
},
{   /* Northstar */
@@ -113,6 +117,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type   = PPC_PMC_IBM,
.oprofile_cpu_type  = ppc64/rs64,
.oprofile_type  = PPC_OPROFILE_RS64,
+   .machine_check  = machine_check_generic,
.platform   = rs64,
},
{   /* Pulsar */
@@ -127,6 +132,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type   = PPC_PMC_IBM,
.oprofile_cpu_type  = ppc64/rs64,
.oprofile_type  = PPC_OPROFILE_RS64,
+   .machine_check  = machine_check_generic,
.platform   = rs64,
},
{   /* I-star */
@@ -141,6 +147,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type   = PPC_PMC_IBM,
.oprofile_cpu_type  = ppc64/rs64,
.oprofile_type  = PPC_OPROFILE_RS64,
+   .machine_check  = machine_check_generic,
.platform   = rs64,
},
{   /* S-star */
@@ -155,6 +162,7 @@ static struct cpu_spec __initdata cpu_sp
.pmc_type   = PPC_PMC_IBM,