From: David Jander <david.jander@protonic.nl>
To: "linuxppc-dev" <linuxppc-dev@ozlabs.org>
Cc: Paul Mackerras <paulus@samba.org>, Wolfgang Denk <wd@denx.de>,
Gunnar Von Boehn <gunnar@genesi-usa.com>
Subject: [RFC] [PATCH v2] MPC5121 TLB errata workaround
Date: Fri, 13 Mar 2009 11:20:59 +0100 [thread overview]
Message-ID: <200903131121.00077.david.jander@protonic.nl> (raw)
Complete workaround for DTLB errata in MPC5121e processors of die M36P and
older (all currently existing versions).
Due to the bug, the hardware-implemented LRU algorythm always goes to way 1 of
the TLB. This fix implements the proposed software workaround in form of a LRW table for chosing the TLB-way.
Signed-off-by: David Jander <david@protonic.nl>
---
arch/powerpc/kernel/head_32.S | 65 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 0f4fac5..a88b3aa 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -540,6 +540,10 @@ DataLoadTLBMiss:
* r2: ptr to linux-style pte
* r3: scratch
*/
+#ifdef CONFIG_PPC_MPC512x
+ b TlbWo /* Code for TLB-errata workaround doesn't fit here */
+RFTlbWo:
+#endif
mfctr r0
/* Get PTE (linux-style) and check access */
mfspr r3,SPRN_DMISS
@@ -612,6 +616,31 @@ DataStoreTLBMiss:
* r2: ptr to linux-style pte
* r3: scratch
*/
+#ifdef CONFIG_PPC_MPC512x
+/* MPC512x: workaround for errata in die M36P and earlier:
+ * Implement LRW for TLB way.
+ */
+ mfspr r3,SPRN_DMISS
+ rlwinm r3,r3,19,25,29 /* Get Address bits 19:15 */
+ lis r2,lrw@ha /* Search index in lrw[] */
+ addi r2,r2,lrw@l
+ tophys(r2,r2)
+ lwzx r1,r3,r2 /* Get item from lrw[] */
+ cmpwi 0,r1,0 /* Was it way 0 last time? */
+ beq- 0,113f /* Then goto 113: */
+
+ mfspr r1,SPRN_SRR1
+ rlwinm r1,r1,0,15,13 /* Mask out SRR1[WAY] */
+ mtspr SPRN_SRR1,r1
+
+ li r0,0
+ stwx r0,r3,r2 /* Make lrw[] entry 0 */
+ b 114f
+113:
+ li r0,1
+ stwx r0,r3,r2 /* Make lrw[] entry 1 */
+114:
+#endif
mfctr r0
/* Get PTE (linux-style) and check access */
mfspr r3,SPRN_DMISS
@@ -688,6 +717,34 @@ DataStoreTLBMiss:
.globl mol_trampoline
.set mol_trampoline, i0x2f00
+#ifdef CONFIG_PPC_MPC512x
+TlbWo:
+/* MPC512x: workaround for errata in die M36P and earlier:
+ * Implement LRW for TLB way.
+ */
+ mfspr r3,SPRN_DMISS
+ rlwinm r3,r3,19,25,29 /* Get Address bits 19:15 */
+ lis r2,lrw@ha /* Search index in lrw[] */
+ addi r2,r2,lrw@l
+ tophys(r2,r2)
+ lwzx r1,r3,r2 /* Get item from lrw[] */
+ cmpwi 0,r1,0 /* Was it way 0 last time? */
+ beq- 0,113f /* Then goto 113: */
+
+ mfspr r1,SPRN_SRR1
+ rlwinm r1,r1,0,15,13 /* Mask out SRR1[WAY] */
+ mtspr SPRN_SRR1,r1
+
+ li r0,0
+ stwx r0,r3,r2 /* Make lrw[] entry 0 */
+ b 114f
+113:
+ li r0,1
+ stwx r0,r3,r2 /* Make lrw[] entry 1 */
+114:
+ b RFTlbWo
+#endif
+
. = 0x3000
AltiVecUnavailable:
@@ -1321,6 +1378,14 @@ intercept_table:
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
.long 0, 0, 0, 0, 0, 0, 0, 0
+
+#ifdef CONFIG_PPC_MPC512x
+lrw:
+ .long 0, 0, 0, 0, 0, 0, 0, 0
+ .long 0, 0, 0, 0, 0, 0, 0, 0
+ .long 0, 0, 0, 0, 0, 0, 0, 0
+ .long 0, 0, 0, 0, 0, 0, 0, 0
+#endif
/* Room for two PTE pointers, usually the kernel and current user pointers
* to their respective root page table.
next reply other threads:[~2009-03-13 10:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-13 10:20 David Jander [this message]
2009-03-13 10:26 ` [RFC] [PATCH v2] MPC5121 TLB errata workaround David Jander
2009-03-13 13:22 ` Kumar Gala
2009-03-13 14:16 ` David Jander
2009-03-13 13:21 ` Kumar Gala
2009-03-13 14:24 ` David Jander
2009-03-13 15:23 ` Kumar Gala
2009-03-16 10:44 ` David Jander
2009-03-16 11:41 ` Kumar Gala
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=200903131121.00077.david.jander@protonic.nl \
--to=david.jander@protonic.nl \
--cc=gunnar@genesi-usa.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
--cc=wd@denx.de \
/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 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).