fsl_rio: move machine_check handler into machine_check_e500 & machine_check_e500mc
PATCH v2 3/4 fsl_rio: move machine_check handler into machine_check_e500 & machine_check_e500mc
--- arch/powerpc/kernel/traps.c | 14 +++++++++++++- arch/powerpc/sysdev/fsl_rio.c | 15 +++------------ include/linux/rio.h | 1 + 3 files changed, 17 insertions(+), 13 deletions(-)
arch/powerpc/kernel/traps.c +13 -1
@@ -55,6 +55,7 @@#endif #include <asm/kexec.h> #include <asm/ppc-opcode.h> +#include <linux/rio.h> #if defined(CONFIG_DEBUGGER ) || defined(CONFIG_KEXEC )int (*__debugger)(struct pt_regs *regs)__read_mostly ;
@@ -500,6 +501,13 @@ int machine_check_e500mc(struct pt_regs *regs) reason & MCSR_MEA ? "Effective" : "Physical", addr); } +if (reason &MCSR_BUS_RBERR ) { +printk ("Bus - Read Data Bus Error\n" ); +#ifdef CONFIG_RAPIDIO + recoverable =fsl_rio_mcheck_exception (regs); +#endif + } +mtspr (SPRN_MCSR , mcsr);return mfspr (SPRN_MCSR ) ==0 && recoverable; }
@@ -527,8 +535,12 @@ int machine_check_e500(struct pt_regs *regs)printk ("Bus - Write Address Error\n" );if (reason &MCSR_BUS_IBERR )printk ("Bus - Instruction Data Error\n" ); -if (reason &MCSR_BUS_RBERR ) +if (reason &MCSR_BUS_RBERR ) {printk ("Bus - Read Data Bus Error\n" ); +#ifdef CONFIG_RAPIDIO +fsl_rio_mcheck_exception (regs); +#endif + }if (reason &MCSR_BUS_WBERR )printk ("Bus - Read Data Bus Error\n" );if (reason &MCSR_BUS_IPERR )
arch/powerpc/sysdev/fsl_rio.c +3 -12
@@ -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);
include/linux/rio.h +1 -0
@@ -365,5 +365,6 @@ extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);extern void rio_close_inb_mbox (struct rio_mport *,int );extern int rio_open_outb_mbox (struct rio_mport *,void *,int ,int );extern void rio_close_outb_mbox (struct rio_mport *,int ); +extern int fsl_rio_mcheck_exception (struct pt_regs *);#endif /* LINUX_RIO_H */
Signature · 1 line
1.6.4
Quoted 14 lines · Shaohui Xie
=20
arch/powerpc/kernel/traps.c +1
-0@@ -55,6 +55,7 @@#endif #include <asm/kexec.h> #include <asm/ppc-opcode.h> +#include <linux/rio.h> =20
#ifdefined(CONFIG_DEBUGGER)||defined(CONFIG_KEXEC)int (*__debugger)(structpt_regs*regs)__read_mostly;
arch/powerpc/kernel/traps.c int machine_check_e500mc(struct pt_regs *regs) · line 501
Quoted 1 line
arch/powerpc/kernel/traps.c +0
-0@@ -500,6 +501,13 @@ int machine_check_e500mc(struct pt_regs *regs) reason & MCSR_MEA ? "Effective" : "Physical",
addr);
Quoted 16 lines
arch/powerpc/kernel/traps.c +0
-0}=20
arch/powerpc/kernel/traps.c +7
-0+if (reason &MCSR_BUS_RBERR ) { +printk ("Bus - Read Data Bus Error\n" ); +#ifdef CONFIG_RAPIDIO + recoverable =3D fsl_rio_mcheck_exception(regs); +#endif + } +mtspr (SPRN_MCSR , mcsr); return mfspr(SPRN_MCSR) =3D=3D 0 && recoverable; }@@ -527,8 +535,12 @@ int machine_check_e500(struct pt_regs *regs)printk ("Bus - Write Address Error\n" );if (reason &MCSR_BUS_IBERR )printk ("Bus - Instruction Data Error\n" );
arch/powerpc/kernel/traps.c int machine_check_e500(struct pt_regs *regs) · line 546
Quoted 10 lines
arch/powerpc/kernel/traps.c +5
-1-if (reason &MCSR_BUS_RBERR ) +if (reason &MCSR_BUS_RBERR ) {printk ("Bus - Read Data Bus Error\n" ); +#ifdef CONFIG_RAPIDIO +fsl_rio_mcheck_exception (regs); +#endif + }if (reason &MCSR_BUS_WBERR )printk ("Bus - Read Data Bus Error\n" );if (reason &MCSR_BUS_IPERR )
This implementation breaks an intended use of fsl_rio_mcheck_exception():=20
1. for e500 it does not check the return value of the rio handler and crashes the system even after RIO Mchk was serviced. Looks like e500mc version handles it better but I have no HW to test it.
2. the RIO Mchk is expected to be handled quietly but here it has many printk's. May be it is better to call the fsl_rio_mcheck_exception() handler in very beginning and simply exit if it returns 1.
Alex.
=20
=20
Best Regards,
Shaohui Xie
Quoted 5 lines
-----Original Message-----
From: Bounine, Alexandre [mailto:[email protected]]
Sent: Thursday, November 11, 2010 6:55 AM
To: Xie Shaohui-B21989; [email protected]
Cc: [email protected]; [email protected]; Li
Yang-
Quoted 7 lines
R58472; Gala Kumar-B11780; Zang Roy-R61911
Subject: RE: [PATCH 3/4][v2]fsl_rio: movemachine_checkhandler intomachine_check_e500&machine_check_e500mcReview
Quoted 2 lines · Shaohui Xie
(quoted diff) +0
-0
b/arch/powerpc/kernel/traps.c
Quoted 14 lines
Quoted 10 lines
index a45a63c..2a5fb9d 100644
arch/powerpc/kernel/traps.c +1
-0@@ -55,6 +55,7 @@#endif #include <asm/kexec.h> #include <asm/ppc-opcode.h> +#include <linux/rio.h> #if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC) intQuoted 3 lines
(*__debugger)(struct
pt_regs*regs)__read_mostly; @@ -500,6 +501,13 @@ intmachine_check_e500mc(struct pt_regs *regs)
reason &MCSR_MEA? "Effective" : "Physical",addr);
Quoted 4 lines
arch/powerpc/kernel/traps.c int machine_check_e500mc(struct pt_regs *regs)
Quoted 4 lines
arch/powerpc/kernel/traps.c +2
-0} +if (reason &MCSR_BUS_RBERR ) { + printk("Bus - Read Data Bus Error\n"); #ifdef
CONFIG_RAPIDIO
Quoted 5 lines
arch/powerpc/kernel/traps.c int machine_check_e500mc(struct pt_regs *regs)
Quoted 5 lines
arch/powerpc/kernel/traps.c +3
-0+ recoverable =fsl_rio_mcheck_exception (regs);#endif + } +mtspr (SPRN_MCSR , mcsr); return mfspr(SPRN_MCSR) == 0 && recoverable; } @@ -527,8
+535,12
Quoted 25 lines
@@
Quoted 4 lines
int
machine_check_e500(struct pt_regs *regs)arch/powerpc/kernel/traps.c +0
-0printk ("Bus - Write Address Error\n" );if (reason &MCSR_BUS_IBERR )printk ("Bus - Instruction Data Error\n" );arch/powerpc/kernel/traps.c int machine_check_e500(struct pt_regs *regs) · line 546
Quoted 10 lines
arch/powerpc/kernel/traps.c +5
-1-if (reason &MCSR_BUS_RBERR ) +if (reason &MCSR_BUS_RBERR ) {printk ("Bus - Read Data Bus Error\n" ); +#ifdef CONFIG_RAPIDIO +fsl_rio_mcheck_exception (regs); +#endif + }if (reason &MCSR_BUS_WBERR )printk ("Bus - Read Data Bus Error\n" );if (reason &MCSR_BUS_IPERR )This implementation breaks an intended use of
fsl_rio_mcheck_exception():
1. for e500 it does not check the return value of the rio handler and crashes the system even after RIO Mchk was serviced. Looks like e500mc version handles it better but I have no HW to test it.
2. the RIO Mchk is expected to be handled quietly but here it has many printk's. May be it is better to call thefsl_rio_mcheck_exception()handler in very beginning and simply exit if it returns 1.
Quoted 1 line
Alex.
[Xie Shaohui-B21989] Hi Alex, seems your suggestion is some kind of conflict with Kumar, you can have a look at
http://patchwork.ozlabs.org/patch/67774/
Thanks
Shaohui
Quoted 2 lines
Quoted 40 lines · On Nov 11, 2010, at 4:19 AM, Xie Shaohui-B21989 wrote:
=20
=20
=20
Best Regards,=20
Shaohui Xie=20
=20
=20Quoted 5 lines
-----Original Message-----
From: Bounine, Alexandre [mailto:[email protected]]
Sent: Thursday, November 11, 2010 6:55 AM
To: Xie Shaohui-B21989; [email protected]
Cc: [email protected]; [email protected]; LiYang-
Quoted 7 lines
R58472; Gala Kumar-B11780; Zang Roy-R61911
Subject: RE: [PATCH 3/4][v2]fsl_rio: movemachine_checkhandler intomachine_check_e500&machine_check_e500mc
=20Review
Quoted 2 lines · Shaohui Xie
=20
(quoted diff) +0
-0
b/arch/powerpc/kernel/traps.cQuoted 14 lines
Quoted 8 lines
index a45a63c..2a5fb9d 100644
arch/powerpc/kernel/traps.c +1
-0@@ -55,6 +55,7 @@#endif #include <asm/kexec.h> #include <asm/ppc-opcode.h> +#include <linux/rio.h> Quoted 5 lines
=20
#ifdefined(CONFIG_DEBUGGER)||defined(CONFIG_KEXEC)int (*__debugger)(structpt_regs*regs)__read_mostly; @@ -500,6 +501,13 @@ intmachine_check_e500mc(struct pt_regs *regs)
reason &MCSR_MEA? "Effective" : "Physical",addr);
Quoted 4 lines
arch/powerpc/kernel/traps.c
Quoted 4 lines
}=20
arch/powerpc/kernel/traps.c +2
-0+if (reason &MCSR_BUS_RBERR ) { + printk("Bus - Read Data Bus Error\n"); #ifdef
CONFIG_RAPIDIO
Quoted 26 lines
Quoted 5 lines
Quoted 5 lines
arch/powerpc/kernel/traps.c +3
-0+ recoverable =3D fsl_rio_mcheck_exception(regs); #endif + } +mtspr(SPRN_MCSR, mcsr); return mfspr(SPRN_MCSR) =3D=3D 0 && recoverable; } @@ -527,8+535,12
Quoted 20 lines
@@
Quoted 11 lines
int
machine_check_e500(struct pt_regs *regs)printk("Bus - Write Address Error\n"); if (reason & MCSR_BUS_IBERR) printk("Bus - Instruction Data Error\n");arch/powerpc/kernel/traps.c +1
-1-if (reason &MCSR_BUS_RBERR ) +if (reason &MCSR_BUS_RBERR ) {printk("Bus - Read Data Bus Error\n");arch/powerpc/kernel/traps.c +4
-0+#ifdef CONFIG_RAPIDIO +fsl_rio_mcheck_exception (regs); +#endif + }Quoted 3 lines
if (reason &
MCSR_BUS_WBERR)
printk("Bus - Read Data Bus Error\n");
if (reason &MCSR_BUS_IPERR)=20
This implementation breaks an intended use offsl_rio_mcheck_exception():
1. for e500 it does not check the return value of the rio handler and crashes the system even after RIO Mchk was serviced. Looks like =
e500mc
Quoted 2 lines
Quoted 2 lines
version handles it better but I have no HW to test it.
2. the RIO Mchk is expected to be handled quietly but here it has =
many
Quoted 7 lines
Quoted 4 lines
printk's. May be it is better to call the
fsl_rio_mcheck_exception()handler in very beginning and simply exit if it returns 1. =20
Alex.[Xie Shaohui-B21989] Hi Alex, seems your suggestion is some kind of conflict with Kumar, you can have a look at=20
http://patchwork.ozlabs.org/patch/67774/
I think Alex's comment is the fact we ignore the 'return' value in the = machine_check_e500 case.
- k=
Quoted 5 lines · Kumar Gala
Quoted 3 lines
[Xie Shaohui-B21989] Hi Alex, seems your suggestion is some kind of conflict with Kumar, you can have a look at
http://patchwork.ozlabs.org/patch/67774/=20
I think Alex's comment is the fact we ignore the 'return' value in the
machine_check_e500 case.
Yes, this one and plus the fact that Mchk exception messages are printed even if it was handled successfully (by RIO handler). Messages are printed in both: e500 and e500mc handlers.
Alex.
=20
arch/powerpc/kernel/traps.c int machine_check_e500(struct pt_regs *regs)
Quoted 38 lines · Shaohui Xie
Signed-off-by Shaohui Xie <[email protected]>Cc Li Yang <[email protected]>Cc Kumar Gala <[email protected]>Cc Roy Zang <[email protected]>Cc Alexandre Bounine <[email protected]>---
arch/powerpc/kernel/traps.c | 14 +++++++++++++- arch/powerpc/sysdev/fsl_rio.c | 15 +++------------ include/linux/rio.h | 1 + 3 files changed, 17 insertions(+), 13 deletions(-)arch/powerpc/kernel/traps.c +8
-0@@ -55,6 +55,7 @@#endif #include <asm/kexec.h> #include <asm/ppc-opcode.h> +#include <linux/rio.h> #if defined(CONFIG_DEBUGGER ) || defined(CONFIG_KEXEC )int (*__debugger)(struct pt_regs *regs)__read_mostly ;@@ -500,6 +501,13 @@ int machine_check_e500mc(struct pt_regs *regs) reason & MCSR_MEA ? "Effective" : "Physical", addr); } +if (reason &MCSR_BUS_RBERR ) { +printk ("Bus - Read Data Bus Error\n" ); +#ifdef CONFIG_RAPIDIO + recoverable =fsl_rio_mcheck_exception (regs); +#endif + } +mtspr (SPRN_MCSR , mcsr);return mfspr (SPRN_MCSR ) ==0 && recoverable; }@@ -527,8 +535,12 @@ int machine_check_e500(struct pt_regs *regs)
To deal w/Alex's comment do:
machine_check_e500(...) {
int ret = 0;
arch/powerpc/kernel/traps.c int machine_check_e500(struct pt_regs *regs) · line 542
Quoted 9 lines
arch/powerpc/kernel/traps.c +4
-1printk ("Bus - Write Address Error\n" );if (reason &MCSR_BUS_IBERR )printk ("Bus - Instruction Data Error\n" ); -if (reason &MCSR_BUS_RBERR ) +if (reason &MCSR_BUS_RBERR ) {printk ("Bus - Read Data Bus Error\n" ); +#ifdef CONFIG_RAPIDIO +fsl_rio_mcheck_exception (regs); +#endif
make this like 'ret = fsl_rio...
arch/powerpc/kernel/traps.c int machine_check_e500(struct pt_regs *regs) · line 546
Quoted 4 lines
arch/powerpc/kernel/traps.c +1
-0+ }if (reason &MCSR_BUS_WBERR )printk ("Bus - Read Data Bus Error\n" );if (reason &MCSR_BUS_IPERR )
return ret
Quoted 46 lines
arch/powerpc/sysdev/fsl_rio.c +3
-12@@ -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);include/linux/rio.h +0
-0
include/linux/rio.h extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int); · line 368
Quoted 4 lines
include/linux/rio.h +1
-0@@ -365,5 +365,6 @@ extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);extern void rio_close_inb_mbox (struct rio_mport *,int );extern int rio_open_outb_mbox (struct rio_mport *,void *,int ,int );extern void rio_close_outb_mbox (struct rio_mport *,int ); +extern int fsl_rio_mcheck_exception (struct pt_regs *);
This should be in asm/rio.h not linux/rio.h and:
Make it look like:
#ifdef CONFIG_RAPIDIO
extern int fsl_rio_mcheck_exception(struct pt_regs *); #else
static inline int fsl_rio_mcheck_exception(struct pt_regs *) { } #endif
Quoted 10 lines
include/linux/rio.h +0
-0#endif /* LINUX_RIO_H */ Signature · 7 lines
1.6.4 _______________________________________________ Linuxppc-dev mailing list [email protected] https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 9 lines · Kumar Gala
Review int machine_check_e500(struct pt_regs *regs)
Quoted 1 line
(quoted diff) +0
-0@@ -527,8 +535,12 @@ int machine_check_e500(struct pt_regs *regs)=20
To deal w/Alex's comment do:
=20machine_check_e500(...){
=20int ret =3D 0;=20
=20
Quoted 12 lines
arch/powerpc/kernel/traps.c int machine_check_e500(struct pt_regs *regs) · line 542
Quoted 9 lines
arch/powerpc/kernel/traps.c +4
-1printk ("Bus - Write Address Error\n" );if (reason &MCSR_BUS_IBERR )printk ("Bus - Instruction Data Error\n" ); -if (reason &MCSR_BUS_RBERR ) +if (reason &MCSR_BUS_RBERR ) {printk ("Bus - Read Data Bus Error\n" ); +#ifdef CONFIG_RAPIDIO +fsl_rio_mcheck_exception (regs); +#endif =20
make this like 'ret =3Dfsl_rio...
=20
Please, place it in the beginning of the machine_check_e500[mc](...) as well to avoid any 'printk' if RIO exception was handled properly.
Alex.=20