Commit c226f260 authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Ralf Baechle

[MIPS] TX49 MFC0 bug workaround

    
If mfc0 $12 follows store and the mfc0 is last instruction of a
page and fetching the next instruction causes TLB miss, the result
of the mfc0 might wrongly contain EXL bit.
    
ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
    
Workaround: mask EXL bit of the result or place a nop before mfc0.  It
doesn't harm to always clear those bits, so we change the code to do so.
Signed-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent dbee90b7
...@@ -47,6 +47,17 @@ static inline void local_irq_enable(void) ...@@ -47,6 +47,17 @@ static inline void local_irq_enable(void)
* R4000/R4400 need three nops, the R4600 two nops and the R10000 needs * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
* no nops at all. * no nops at all.
*/ */
/*
* For TX49, operating only IE bit is not enough.
*
* If mfc0 $12 follows store and the mfc0 is last instruction of a
* page and fetching the next instruction causes TLB miss, the result
* of the mfc0 might wrongly contain EXL bit.
*
* ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
*
* Workaround: mask EXL bit of the result or place a nop before mfc0.
*/
__asm__ ( __asm__ (
" .macro local_irq_disable\n" " .macro local_irq_disable\n"
" .set push \n" " .set push \n"
...@@ -55,8 +66,8 @@ __asm__ ( ...@@ -55,8 +66,8 @@ __asm__ (
" di \n" " di \n"
#else #else
" mfc0 $1,$12 \n" " mfc0 $1,$12 \n"
" ori $1,1 \n" " ori $1,0x1f \n"
" xori $1,1 \n" " xori $1,0x1f \n"
" .set noreorder \n" " .set noreorder \n"
" mtc0 $1,$12 \n" " mtc0 $1,$12 \n"
#endif #endif
...@@ -96,8 +107,8 @@ __asm__ ( ...@@ -96,8 +107,8 @@ __asm__ (
" andi \\result, 1 \n" " andi \\result, 1 \n"
#else #else
" mfc0 \\result, $12 \n" " mfc0 \\result, $12 \n"
" ori $1, \\result, 1 \n" " ori $1, \\result, 0x1f \n"
" xori $1, 1 \n" " xori $1, 0x1f \n"
" .set noreorder \n" " .set noreorder \n"
" mtc0 $1, $12 \n" " mtc0 $1, $12 \n"
#endif #endif
...@@ -136,8 +147,8 @@ __asm__ ( ...@@ -136,8 +147,8 @@ __asm__ (
#else #else
" mfc0 $1, $12 \n" " mfc0 $1, $12 \n"
" andi \\flags, 1 \n" " andi \\flags, 1 \n"
" ori $1, 1 \n" " ori $1, 0x1f \n"
" xori $1, 1 \n" " xori $1, 0x1f \n"
" or \\flags, $1 \n" " or \\flags, $1 \n"
" mtc0 \\flags, $12 \n" " mtc0 \\flags, $12 \n"
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment