Re: [PATCH v2 5/7] powerpc/85xx: Add MChk handler for SRIO port

Previous thread: SIIG DP CyberSerial 4S PCIe Support by James Lamanna on Monday, March 8, 2010 - 12:07 pm. (11 messages)

Next thread: Re: [PATCH] Security: key: keyring: fix code style issues by James Kosin on Monday, March 8, 2010 - 12:15 pm. (3 messages)
From: Alexandre Bounine
Date: Monday, March 8, 2010 - 12:10 pm

From: Alexandre Bounine <alexandre.bounine@idt.com>

Add Machine Check exception handling into RapidIO port driver
for Freescale SoCs (MPC85xx).

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Tested-by: Thomas Moll <thomas.moll@sysgo.com>
---

 fsl_rio.c |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 70 insertions(+), 4 deletions(-)

diff -x '*.pj' -X dontdiff_2.6.32-rc5 -pNur w33a/arch/powerpc/sysdev/fsl_rio.c w33b/arch/powerpc/sysdev/fsl_rio.c
--- w33a/arch/powerpc/sysdev/fsl_rio.c	2010-03-08 10:38:10.121013000 -0500
+++ w33b/arch/powerpc/sysdev/fsl_rio.c	2010-03-08 11:23:03.274215000 -0500
@@ -31,6 +31,8 @@
 #include <linux/kfifo.h>
 
 #include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/uaccess.h>
 
 #undef DEBUG_PW	/* Port-Write debugging */
 
@@ -46,6 +48,8 @@
 #define RIO_ESCSR		0x158
 #define RIO_CCSR		0x15c
 #define RIO_LTLEDCSR		0x0608
+#define  RIO_LTLEDCSR_IER	0x80000000
+#define  RIO_LTLEDCSR_PRT	0x01000000
 #define RIO_LTLEECSR		0x060c
 #define RIO_EPWISR		0x10010
 #define RIO_ISR_AACR		0x10120
@@ -213,6 +217,54 @@ struct rio_priv {
 	spinlock_t pw_fifo_lock;
 };
 
+#define __fsl_read_rio_config(x, addr, err, op)		\
+	__asm__ __volatile__(				\
+		"1:	"op" %1,0(%2)\n"		\
+		"	eieio\n"			\
+		"2:\n"					\
+		".section .fixup,\"ax\"\n"		\
+		"3:	li %1,-1\n"			\
+		"	li %0,%3\n"			\
+		"	b 2b\n"				\
+		".section __ex_table,\"a\"\n"		\
+		"	.align 2\n"			\
+		"	.long 1b,3b\n"			\
+		".text"					\
+		: "=r" (err), "=r" (x)			\
+		: "b" (addr), "i" (-EFAULT), "0" (err))
+
+static void __iomem *rio_regs_win;
+
+static int (*saved_mcheck_exception)(struct pt_regs *regs);
+
+static int fsl_rio_mcheck_exception(struct pt_regs *regs)
+{
+	const struct exception_table_entry *entry = NULL;
+	unsigned long reason = (mfspr(SPRN_MCSR) & MCSR_MASK);
+
+	if (reason & MCSR_BUS_RBERR) {
+		reason = in_be32((u32 *)(rio_regs_win + RIO_LTLEDCSR));
+		if (reason & (RIO_LTLEDCSR_IER | ...
From: Timur Tabi
Date: Wednesday, June 30, 2010 - 1:55 pm

MCSR_MASK is not defined anywhere, so when I compile this code, I get this:

  CC      arch/powerpc/sysdev/fsl_rio.o
arch/powerpc/sysdev/fsl_rio.c: In function 'fsl_rio_mcheck_exception':
arch/powerpc/sysdev/fsl_rio.c:248: error: 'MCSR_MASK' undeclared
(first use in this function)
arch/powerpc/sysdev/fsl_rio.c:248: error: (Each undeclared identifier
is reported only once
arch/powerpc/sysdev/fsl_rio.c:248: error: for each function it appears in.)

-- 
Timur Tabi
Linux kernel developer at Freescale
--

From: Timur Tabi
Date: Wednesday, June 30, 2010 - 2:00 pm

Never mind.  I see that it's been fixed already, and that the patch
that removed MCSR_MASK was posted around the same time that this patch
was posted.


-- 
Timur Tabi
Linux kernel developer at Freescale
--

From: Michael Neuling
Date: Monday, August 2, 2010 - 11:06 pm

I don't know what happened here but 2.6.35 is broken because of this
problem:

arch/powerpc/sysdev/fsl_rio.c:248: error: 'MCSR_MASK' undeclared (first use in this function)
arch/powerpc/sysdev/fsl_rio.c:248: error: (Each undeclared identifier is reported only once
arch/powerpc/sysdev/fsl_rio.c:248: error: for each function it appears in.)
arch/powerpc/sysdev/fsl_rio.c:250: error: 'MCSR_BUS_RBERR' undeclared (first use in this function)

Mikey
--

From: Bounine, Alexandre
Date: Tuesday, August 3, 2010 - 5:17 am

This happened after change to book-e definitions.
--

From: Timur Tabi
Date: Tuesday, August 3, 2010 - 6:01 am

On Tue, Aug 3, 2010 at 7:17 AM, Bounine, Alexandre

And those patches should have been applied before 2.6.35 was released.
 Someone dropped the ball.  2.6.35 is broken for a number of PowerPC
boards:

$ make mpc85xx_defconfig
...
$ make
...
  CC      arch/powerpc/sysdev/fsl_rio.o
arch/powerpc/sysdev/fsl_rio.c: In function 'fsl_rio_mcheck_exception':
arch/powerpc/sysdev/fsl_rio.c:248: error: 'MCSR_MASK' undeclared
(first use in this function)
arch/powerpc/sysdev/fsl_rio.c:248: error: (Each undeclared identifier
is reported only once
arch/powerpc/sysdev/fsl_rio.c:248: error: for each function it appears in.)
make[1]: *** [arch/powerpc/sysdev/fsl_rio.o] Error 1

-- 
Timur Tabi
Linux kernel developer at Freescale
--

From: Bounine, Alexandre
Date: Tuesday, August 3, 2010 - 6:24 am

Yang Li pointed to these patches in his post from July 23, 2010.
--

From: Michael Neuling
Date: Wednesday, August 4, 2010 - 8:34 pm

This is still broken in Kumar's latest tree.  Do you guys wanna repost
them so Kumar can pick them up easily?

--

From: Bounine, Alexandre
Date: Thursday, August 5, 2010 - 10:25 am

Below is a copy of Leo's message with pointers to the patches.

definitions.

Hi Alex,

Only with your patch, there will still be problem on SRIO platforms
other than MPC85xx.

I have posted a patch series to fix this together with several
compatibility issues a month before.

http://patchwork.ozlabs.org/patch/56135/
http://patchwork.ozlabs.org/patch/56136/
http://patchwork.ozlabs.org/patch/56138/
http://patchwork.ozlabs.org/patch/56137/


Can anyone pick the patch series quickly as currently there is a compile
error when SRIO is enabled.

<0CE8B6BE3C4AD74AB97D9D29BD24E552011430BC@CORPEXCH1.na.ads.idt.com> you
--

From: Kumar Gala
Date: Thursday, August 5, 2010 - 10:53 am

I'm looking at this now and wondering what we added the mcheck handler for in the first place and what its trying to accomplish.

- k
--

From: Bounine, Alexandre
Date: Thursday, August 5, 2010 - 11:17 am

> I'm looking at this now and wondering what we added the mcheck handler

This protects system from hanging if RIO link fails or enters error
state. In some situations following maintenance read may initiate link
recovery from error state.

As it is now, MCheck mostly prevents system from hanging, but it also
adds sense to return status of maintenance read routine. I am using
return status in my new set of patches to check if RIO link is valid
during error recovery.

Alex.

 
--

Previous thread: SIIG DP CyberSerial 4S PCIe Support by James Lamanna on Monday, March 8, 2010 - 12:07 pm. (11 messages)

Next thread: Re: [PATCH] Security: key: keyring: fix code style issues by James Kosin on Monday, March 8, 2010 - 12:15 pm. (3 messages)