powerpc/8xx: Fix user space TLB walk in dcbX fixup
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>
Fri, 8 Jan 2010 06:46:26 +0000 (06:46 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 15 Jan 2010 02:26:16 +0000 (13:26 +1100)
The newly added fixup for buggy dcbX insn's has
a bug that always trigger a kernel TLB walk so a user space
dcbX insn will cause a Kernel Machine Check if it hits DTLB error.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/head_8xx.S

index a2ed342..3ef743f 100644 (file)
@@ -542,11 +542,11 @@ DARFixed:/* Return from dcbx instruction bug workaround, r10 holds value of DAR
 FixupDAR:/* Entry point for dcbx workaround. */
        /* fetch instruction from memory. */
        mfspr   r10, SPRN_SRR0
 FixupDAR:/* Entry point for dcbx workaround. */
        /* fetch instruction from memory. */
        mfspr   r10, SPRN_SRR0
+       andis.  r11, r10, 0x8000        /* Address >= 0x80000000 */
        DO_8xx_CPU6(0x3780, r3)
        mtspr   SPRN_MD_EPN, r10
        mfspr   r11, SPRN_M_TWB /* Get level 1 table entry address */
        DO_8xx_CPU6(0x3780, r3)
        mtspr   SPRN_MD_EPN, r10
        mfspr   r11, SPRN_M_TWB /* Get level 1 table entry address */
-       cmplwi  cr0, r11, 0x0800
-       blt-    3f              /* Branch if user space */
+       beq-    3f              /* Branch if user space */
        lis     r11, (swapper_pg_dir-PAGE_OFFSET)@h
        ori     r11, r11, (swapper_pg_dir-PAGE_OFFSET)@l
        rlwimi  r11, r10, 32-20, 0xffc /* r11 = r11&~0xffc|(r10>>20)&0xffc */
        lis     r11, (swapper_pg_dir-PAGE_OFFSET)@h
        ori     r11, r11, (swapper_pg_dir-PAGE_OFFSET)@l
        rlwimi  r11, r10, 32-20, 0xffc /* r11 = r11&~0xffc|(r10>>20)&0xffc */