All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Sergey Rogozhkin <rogozhkin@niisi.msk.ru>
Cc: Linux MIPS List <linux-mips@linux-mips.org>,
	"Gleb O. Raiko" <raiko@niisi.msk.ru>, Kumba <kumba@gentoo.org>
Subject: Re: O2 RM7000 Issues
Date: Tue, 17 Jul 2007 13:27:11 +0100	[thread overview]
Message-ID: <20070717122711.GA19977@linux-mips.org> (raw)
In-Reply-To: <469C8600.7090208@niisi.msk.ru>

On Tue, Jul 17, 2007 at 01:04:00PM +0400, Sergey Rogozhkin wrote:

> >for E9000 platforms.
> 
> Are you really sure RM7000 has this bug? Workaround mentioned above 
> breaks gcc signal frame unwinding mechanism: it search for sigcontext 
> struct at fixed offset from signal trampoline.
> 
> And one another known RM7000 bug, maybe not taken into account by linux: 
> errata 38. r4k_wait is not suitable for RM7000 on some systems. I don't 
> know if "O2" is affected.

The fingerprint of this bug would be write data getting corrupted to
contain its physical address instead.  I haven't seen such bug reports
ever but a hand full cycles of latency to the idle loop sounds like the
safe thing.  Untested fix below.

What's really astonishing about this is that affects basically the entire
QED family of processors - R4600, R4700, R4640, R5000, RM52xx and RM7000.

Which also is yet again empirical proof for the WAIT instruction being
hard to get right ...

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index f599e79..7ee0cb0 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -75,6 +75,26 @@ static void r4k_wait_irqoff(void)
 	local_irq_enable();
 }
 
+/*
+ * The RM7000 variant has to handle erratum 38.  The workaround is to not
+ * have any pending stores when the WAIT instruction is executed.
+ */
+static void rm7k_wait_irqoff(void)
+{
+	local_irq_disable();
+	if (!need_resched())
+		__asm__(
+		"	.set	push		\n"
+		"	.set	mips3		\n"
+		"	.set	noat		\n"
+		"	mfc0	$1, $12		\n"
+		"	sync			\n"
+		"	mtc0	$1, $12		\n"
+		"	wait			\n"
+		"	.set	pop		\n");
+	local_irq_enable();
+}
+
 /* The Au1xxx wait is available only if using 32khz counter or
  * external timer source, but specifically not CP0 Counter. */
 int allow_au1k_wait;
@@ -132,7 +152,6 @@ static inline void check_wait(void)
 	case CPU_R4700:
 	case CPU_R5000:
 	case CPU_NEVADA:
-	case CPU_RM7000:
 	case CPU_4KC:
 	case CPU_4KEC:
 	case CPU_4KSC:
@@ -142,6 +161,10 @@ static inline void check_wait(void)
 		cpu_wait = r4k_wait;
 		break;
 
+	case CPU_RM7000:
+		cpu_wait = rm7k_wait_irqoff;
+		break;
+
 	case CPU_24K:
 	case CPU_34K:
 		cpu_wait = r4k_wait;

  parent reply	other threads:[~2007-07-17 12:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-01 16:57 O2 RM7000 Issues Kumba
2007-07-01 22:07 ` freshy98
2007-07-02 13:08   ` sknauert
2007-07-02 13:08   ` sknauert
2007-07-04 15:27     ` Ralf Baechle
2007-07-04 19:22       ` Ralf Baechle
2007-07-16 11:53         ` Sergey Rogozhkin
2007-07-16 12:33           ` Ralf Baechle
2007-07-16 17:38             ` Andrew Sharp
2007-07-17 14:01               ` Kumba
2007-07-19 18:58                 ` Andrew Sharp
2007-07-19 22:26                   ` Shane McDonald
2007-07-17  7:54             ` Gleb O. Raiko
2007-07-17  9:04         ` Sergey Rogozhkin
2007-07-17 10:14           ` Ralf Baechle
2007-07-17 12:27           ` Ralf Baechle [this message]
2007-09-17 23:04             ` Steve Graham
2007-09-18  8:52               ` Ralf Baechle
2007-09-17 23:20             ` David Daney
2007-09-18  8:47               ` Ralf Baechle
2007-07-02 14:34 ` Maciej W. Rozycki
2007-09-21  6:27 ` Sagar Borikar
2007-09-21 13:47   ` Ralf Baechle
2007-09-22  3:20     ` Steve Graham
2007-09-24 11:58       ` Ralf Baechle
2007-09-26 17:06         ` Steve Graham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070717122711.GA19977@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=kumba@gentoo.org \
    --cc=linux-mips@linux-mips.org \
    --cc=raiko@niisi.msk.ru \
    --cc=rogozhkin@niisi.msk.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.