linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][v3] fsl_rio: move machine_check handler into machine_check_e500 & machine_check_e500mc
@ 2010-11-12  7:55 Shaohui Xie
  2010-11-12 16:30 ` Bounine, Alexandre
  0 siblings, 1 reply; 4+ messages in thread
From: Shaohui Xie @ 2010-11-12  7:55 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Shaohui Xie, Kumar Gala, Alexandre Bounine, akpm

Signed-off-by: Shaohui Xie <b21989@freescale.com>
Cc: Li Yang <leoli@freescale.com>
Cc: Kumar Gala <kumar.gala@freescale.com>
Cc: Roy Zang <tie-fei.zang@freescale.com>
Cc: Alexandre Bounine <alexandre.bounine@idt.com>
---
 arch/powerpc/include/asm/rio.h |    5 +++++
 arch/powerpc/kernel/traps.c    |   17 ++++++++++++++++-
 arch/powerpc/sysdev/fsl_rio.c  |   15 +++------------
 3 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/include/asm/rio.h b/arch/powerpc/include/asm/rio.h
index 0018bf8..3b16364 100644
--- a/arch/powerpc/include/asm/rio.h
+++ b/arch/powerpc/include/asm/rio.h
@@ -14,5 +14,10 @@
 #define ASM_PPC_RIO_H
 
 extern void platform_rio_init(void);
+#ifdef CONFIG_RAPIDIO
+extern int fsl_rio_mcheck_exception(struct pt_regs *);
+#else
+static inline int fsl_rio_mcheck_exception(struct pt_regs *regs){return 0;}
+#endif
 
 #endif				/* ASM_PPC_RIO_H */
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index a45a63c..9ab7b97 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -55,6 +55,7 @@
 #endif
 #include <asm/kexec.h>
 #include <asm/ppc-opcode.h>
+#include <asm/rio.h>
 
 #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
 int (*__debugger)(struct pt_regs *regs) __read_mostly;
@@ -425,6 +426,12 @@ int machine_check_e500mc(struct pt_regs *regs)
 	unsigned long reason = mcsr;
 	int recoverable = 1;
 
+	if (reason & MCSR_BUS_RBERR) {
+		recoverable = fsl_rio_mcheck_exception(regs);
+		if (recoverable == 1)
+			goto silent_out;
+	}
+
 	printk("Machine check in kernel mode.\n");
 	printk("Caused by (from MCSR=%lx): ", reason);
 
@@ -500,6 +507,7 @@ int machine_check_e500mc(struct pt_regs *regs)
 		       reason & MCSR_MEA ? "Effective" : "Physical", addr);
 	}
 
+silent_out:
 	mtspr(SPRN_MCSR, mcsr);
 	return mfspr(SPRN_MCSR) == 0 && recoverable;
 }
@@ -507,6 +515,13 @@ int machine_check_e500mc(struct pt_regs *regs)
 int machine_check_e500(struct pt_regs *regs)
 {
 	unsigned long reason = get_mc_reason(regs);
+	int ret = 0;
+
+	if (reason & MCSR_BUS_RBERR) {
+		ret = fsl_rio_mcheck_exception(regs);
+		if (ret == 1)
+			return ret;
+	}
 
 	printk("Machine check in kernel mode.\n");
 	printk("Caused by (from MCSR=%lx): ", reason);
@@ -536,7 +551,7 @@ int machine_check_e500(struct pt_regs *regs)
 	if (reason & MCSR_BUS_RPERR)
 		printk("Bus - Read Parity Error\n");
 
-	return 0;
+	return ret;
 }
 #elif defined(CONFIG_E200)
 int machine_check_e200(struct pt_regs *regs)
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 1143c93..a9bc1e8 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -256,9 +256,7 @@ struct rio_priv {
 static void __iomem *rio_regs_win;
 
 #ifdef CONFIG_E500
-static int (*saved_mcheck_exception)(struct pt_regs *regs);
-
-static int fsl_rio_mcheck_exception(struct pt_regs *regs)
+int fsl_rio_mcheck_exception(struct pt_regs *regs)
 {
 	const struct exception_table_entry *entry = NULL;
 	unsigned long reason = mfspr(SPRN_MCSR);
@@ -280,11 +278,9 @@ static int fsl_rio_mcheck_exception(struct pt_regs *regs)
 		}
 	}
 
-	if (saved_mcheck_exception)
-		return saved_mcheck_exception(regs);
-	else
-		return cur_cpu_spec->machine_check(regs);
+	return 0;
 }
+EXPORT_SYMBOL_GPL(fsl_rio_mcheck_exception);
 #endif
 
 /**
@@ -1534,11 +1530,6 @@ int fsl_rio_setup(struct platform_device *dev)
 	fsl_rio_doorbell_init(port);
 	fsl_rio_port_write_init(port);
 
-#ifdef CONFIG_E500
-	saved_mcheck_exception = ppc_md.machine_check_exception;
-	ppc_md.machine_check_exception = fsl_rio_mcheck_exception;
-#endif
-
 	return 0;
 err:
 	iounmap(priv->regs_win);
-- 
1.6.4

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

* RE: [PATCH][v3] fsl_rio: move machine_check handler into machine_check_e500 & machine_check_e500mc
  2010-11-12  7:55 [PATCH][v3] fsl_rio: move machine_check handler into machine_check_e500 & machine_check_e500mc Shaohui Xie
@ 2010-11-12 16:30 ` Bounine, Alexandre
  2010-11-16  2:42   ` Xie Shaohui-B21989
  0 siblings, 1 reply; 4+ messages in thread
From: Bounine, Alexandre @ 2010-11-12 16:30 UTC (permalink / raw)
  To: Shaohui Xie, linuxppc-dev; +Cc: akpm, Kumar Gala

Shaohui Xie <b21989@freescale.com> wrote:
> diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
> index a45a63c..9ab7b97 100644
> --- a/arch/powerpc/kernel/traps.c
> +++ b/arch/powerpc/kernel/traps.c
> @@ -55,6 +55,7 @@
>  #endif
>  #include <asm/kexec.h>
>  #include <asm/ppc-opcode.h>
> +#include <asm/rio.h>
>=20
>  #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
>  int (*__debugger)(struct pt_regs *regs) __read_mostly;
> @@ -425,6 +426,12 @@ int machine_check_e500mc(struct pt_regs *regs)
>  	unsigned long reason =3D mcsr;
>  	int recoverable =3D 1;
>=20
> +	if (reason & MCSR_BUS_RBERR) {
> +		recoverable =3D fsl_rio_mcheck_exception(regs);
> +		if (recoverable =3D=3D 1)
> +			goto silent_out;
> +	}
> +
>  	printk("Machine check in kernel mode.\n");
>  	printk("Caused by (from MCSR=3D%lx): ", reason);
>=20
> @@ -500,6 +507,7 @@ int machine_check_e500mc(struct pt_regs *regs)
>  		       reason & MCSR_MEA ? "Effective" : "Physical",
addr);
>  	}
>=20
> +silent_out:
>  	mtspr(SPRN_MCSR, mcsr);
>  	return mfspr(SPRN_MCSR) =3D=3D 0 && recoverable;
>  }
> @@ -507,6 +515,13 @@ int machine_check_e500mc(struct pt_regs *regs)
>  int machine_check_e500(struct pt_regs *regs)
>  {
>  	unsigned long reason =3D get_mc_reason(regs);
> +	int ret =3D 0;
> +
> +	if (reason & MCSR_BUS_RBERR) {
> +		ret =3D fsl_rio_mcheck_exception(regs);
> +		if (ret =3D=3D 1)
> +			return ret;
> +	}

Do we really need 'ret' variable here?
There is no further use of it by the rest of the code.
Maybe just return 1 here if fsl_rio_mcheck_exception() returns 1 ?

>=20
>  	printk("Machine check in kernel mode.\n");
>  	printk("Caused by (from MCSR=3D%lx): ", reason);
> @@ -536,7 +551,7 @@ int machine_check_e500(struct pt_regs *regs)
>  	if (reason & MCSR_BUS_RPERR)
>  		printk("Bus - Read Parity Error\n");
>=20
> -	return 0;
> +	return ret;
>  }
>  #elif defined(CONFIG_E200)
>  int machine_check_e200(struct pt_regs *regs)

Works for RapidIO as expected now.

Thank you,

Alex.

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

* RE: [PATCH][v3] fsl_rio: move machine_check handler into machine_check_e500 & machine_check_e500mc
  2010-11-12 16:30 ` Bounine, Alexandre
@ 2010-11-16  2:42   ` Xie Shaohui-B21989
  2010-11-16 13:47     ` Bounine, Alexandre
  0 siblings, 1 reply; 4+ messages in thread
From: Xie Shaohui-B21989 @ 2010-11-16  2:42 UTC (permalink / raw)
  To: Bounine, Alexandre, Xie Shaohui-B21989, linuxppc-dev
  Cc: akpm, Gala Kumar-B11780, Li Yang-R58472, Zang Roy-R61911


> -----Original Message-----
> From: Bounine, Alexandre [mailto:Alexandre.Bounine@idt.com]
> Sent: Saturday, November 13, 2010 12:30 AM
> To: Xie Shaohui-B21989; linuxppc-dev@lists.ozlabs.org
> Cc: akpm@linux-foundation.org; Li Yang-R58472; Gala Kumar-B11780; Zang
> Roy-R61911
> Subject: RE: [PATCH][v3] fsl_rio: move machine_check handler into
> machine_check_e500 & machine_check_e500mc
>=20
> > int machine_check_e500mc(struct pt_regs *regs)  int
> > machine_check_e500(struct pt_regs *regs)  {
> >  	unsigned long reason =3D get_mc_reason(regs);
> > +	int ret =3D 0;
> > +
> > +	if (reason & MCSR_BUS_RBERR) {
> > +		ret =3D fsl_rio_mcheck_exception(regs);
> > +		if (ret =3D=3D 1)
> > +			return ret;
> > +	}
>=20
> Do we really need 'ret' variable here?
> There is no further use of it by the rest of the code.
> Maybe just return 1 here if fsl_rio_mcheck_exception() returns 1 ?
>=20
> >

Ok, I'll remove the ret, do you have any comment for the error handler
patch?
http://patchwork.ozlabs.org/patch/69962/


Thanks & Best Regards,
Shaohui

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

* RE: [PATCH][v3] fsl_rio: move machine_check handler into machine_check_e500 & machine_check_e500mc
  2010-11-16  2:42   ` Xie Shaohui-B21989
@ 2010-11-16 13:47     ` Bounine, Alexandre
  0 siblings, 0 replies; 4+ messages in thread
From: Bounine, Alexandre @ 2010-11-16 13:47 UTC (permalink / raw)
  To: Xie Shaohui-B21989, linuxppc-dev
  Cc: akpm, Gala Kumar-B11780, Li Yang-R58472, Zang Roy-R61911

> From: Xie Shaohui-B21989 [mailto:B21989@freescale.com]
>=20
> Ok, I'll remove the ret, do you have any comment for the error handler
> patch?
> http://patchwork.ozlabs.org/patch/69962/
>=20
>=20
I will reply to the original patch message.

Alex.

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

end of thread, other threads:[~2010-11-16 13:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-12  7:55 [PATCH][v3] fsl_rio: move machine_check handler into machine_check_e500 & machine_check_e500mc Shaohui Xie
2010-11-12 16:30 ` Bounine, Alexandre
2010-11-16  2:42   ` Xie Shaohui-B21989
2010-11-16 13:47     ` Bounine, Alexandre

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).