aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2009-04-29 16:58:01 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-05-21 01:44:21 -0400
commit60dbf4385130136847ea73657da329f8e7dbe16e (patch)
tree66bb7e72105f416bcbe4be725fb5b97d9a965380 /arch/powerpc
parentaf20aeb1a3292ae7ecfc492a4dc059e35465e016 (diff)
powerpc: Add 2.06 tlbie mnemonics
This adds the PowerPC 2.06 tlbie mnemonics and keeps backwards compatibilty for CPUs before 2.06. Only useful for bare metal systems. Signed-off-by: Milton Miller <miltonm@bga.com> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/mmu.h5
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h4
-rw-r--r--arch/powerpc/kernel/cputable.c6
-rw-r--r--arch/powerpc/mm/hash_native_64.c13
4 files changed, 24 insertions, 4 deletions
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index cbf154387091..325b7208a146 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -52,6 +52,11 @@
52 */ 52 */
53#define MMU_FTR_NEED_DTLB_SW_LRU ASM_CONST(0x00200000) 53#define MMU_FTR_NEED_DTLB_SW_LRU ASM_CONST(0x00200000)
54 54
55/* This indicates that the processor uses the ISA 2.06 server tlbie
56 * mnemonics
57 */
58#define MMU_FTR_TLBIE_206 ASM_CONST(0x00400000)
59
55#ifndef __ASSEMBLY__ 60#ifndef __ASSEMBLY__
56#include <asm/cputable.h> 61#include <asm/cputable.h>
57 62
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 39bcc9f9ff62..b74f16d45cb4 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -45,12 +45,14 @@
45#define PPC_INST_STSWI 0x7c0005aa 45#define PPC_INST_STSWI 0x7c0005aa
46#define PPC_INST_STSWX 0x7c00052a 46#define PPC_INST_STSWX 0x7c00052a
47#define PPC_INST_STXVD2X 0x7c000798 47#define PPC_INST_STXVD2X 0x7c000798
48#define PPC_INST_TLBIE 0x7c000264
48#define PPC_INST_TLBILX 0x7c000024 49#define PPC_INST_TLBILX 0x7c000024
49#define PPC_INST_WAIT 0x7c00007c 50#define PPC_INST_WAIT 0x7c00007c
50 51
51/* macros to insert fields into opcodes */ 52/* macros to insert fields into opcodes */
52#define __PPC_RA(a) (((a) & 0x1f) << 16) 53#define __PPC_RA(a) (((a) & 0x1f) << 16)
53#define __PPC_RB(b) (((b) & 0x1f) << 11) 54#define __PPC_RB(b) (((b) & 0x1f) << 11)
55#define __PPC_RS(s) (((s) & 0x1f) << 21)
54#define __PPC_XS(s) ((((s) & 0x1f) << 21) | (((s) & 0x20) >> 5)) 56#define __PPC_XS(s) ((((s) & 0x1f) << 21) | (((s) & 0x20) >> 5))
55#define __PPC_T_TLB(t) (((t) & 0x3) << 21) 57#define __PPC_T_TLB(t) (((t) & 0x3) << 21)
56#define __PPC_WC(w) (((w) & 0x3) << 21) 58#define __PPC_WC(w) (((w) & 0x3) << 21)
@@ -72,6 +74,8 @@
72#define PPC_TLBILX_VA(a, b) PPC_TLBILX(3, a, b) 74#define PPC_TLBILX_VA(a, b) PPC_TLBILX(3, a, b)
73#define PPC_WAIT(w) stringify_in_c(.long PPC_INST_WAIT | \ 75#define PPC_WAIT(w) stringify_in_c(.long PPC_INST_WAIT | \
74 __PPC_WC(w)) 76 __PPC_WC(w))
77#define PPC_TLBIE(lp,a) stringify_in_c(.long PPC_INST_TLBIE | \
78 __PPC_RB(a) | __PPC_RS(lp))
75 79
76/* 80/*
77 * Define what the VSX XX1 form instructions will look like, then add 81 * Define what the VSX XX1 form instructions will look like, then add
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 3e33fb933d99..4a24a2fc4574 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -427,7 +427,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
427 .cpu_name = "POWER7 (architected)", 427 .cpu_name = "POWER7 (architected)",
428 .cpu_features = CPU_FTRS_POWER7, 428 .cpu_features = CPU_FTRS_POWER7,
429 .cpu_user_features = COMMON_USER_POWER7, 429 .cpu_user_features = COMMON_USER_POWER7,
430 .mmu_features = MMU_FTR_HPTE_TABLE, 430 .mmu_features = MMU_FTR_HPTE_TABLE |
431 MMU_FTR_TLBIE_206,
431 .icache_bsize = 128, 432 .icache_bsize = 128,
432 .dcache_bsize = 128, 433 .dcache_bsize = 128,
433 .machine_check = machine_check_generic, 434 .machine_check = machine_check_generic,
@@ -441,7 +442,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
441 .cpu_name = "POWER7 (raw)", 442 .cpu_name = "POWER7 (raw)",
442 .cpu_features = CPU_FTRS_POWER7, 443 .cpu_features = CPU_FTRS_POWER7,
443 .cpu_user_features = COMMON_USER_POWER7, 444 .cpu_user_features = COMMON_USER_POWER7,
444 .mmu_features = MMU_FTR_HPTE_TABLE, 445 .mmu_features = MMU_FTR_HPTE_TABLE |
446 MMU_FTR_TLBIE_206,
445 .icache_bsize = 128, 447 .icache_bsize = 128,
446 .dcache_bsize = 128, 448 .dcache_bsize = 128,
447 .num_pmcs = 6, 449 .num_pmcs = 6,
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c
index 34e5c0b219b9..056d23a1b105 100644
--- a/arch/powerpc/mm/hash_native_64.c
+++ b/arch/powerpc/mm/hash_native_64.c
@@ -27,6 +27,7 @@
27#include <asm/cputable.h> 27#include <asm/cputable.h>
28#include <asm/udbg.h> 28#include <asm/udbg.h>
29#include <asm/kexec.h> 29#include <asm/kexec.h>
30#include <asm/ppc-opcode.h>
30 31
31#ifdef DEBUG_LOW 32#ifdef DEBUG_LOW
32#define DBG_LOW(fmt...) udbg_printf(fmt) 33#define DBG_LOW(fmt...) udbg_printf(fmt)
@@ -49,14 +50,21 @@ static inline void __tlbie(unsigned long va, int psize, int ssize)
49 case MMU_PAGE_4K: 50 case MMU_PAGE_4K:
50 va &= ~0xffful; 51 va &= ~0xffful;
51 va |= ssize << 8; 52 va |= ssize << 8;
52 asm volatile("tlbie %0,0" : : "r" (va) : "memory"); 53 asm volatile(ASM_MMU_FTR_IFCLR("tlbie %0,0", PPC_TLBIE(%1,%0),
54 %2)
55 : : "r" (va), "r"(0), "i" (MMU_FTR_TLBIE_206)
56 : "memory");
53 break; 57 break;
54 default: 58 default:
55 penc = mmu_psize_defs[psize].penc; 59 penc = mmu_psize_defs[psize].penc;
56 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 60 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
57 va |= penc << 12; 61 va |= penc << 12;
58 va |= ssize << 8; 62 va |= ssize << 8;
59 asm volatile("tlbie %0,1" : : "r" (va) : "memory"); 63 va |= 1; /* L */
64 asm volatile(ASM_MMU_FTR_IFCLR("tlbie %0,1", PPC_TLBIE(%1,%0),
65 %2)
66 : : "r" (va), "r"(0), "i" (MMU_FTR_TLBIE_206)
67 : "memory");
60 break; 68 break;
61 } 69 }
62} 70}
@@ -80,6 +88,7 @@ static inline void __tlbiel(unsigned long va, int psize, int ssize)
80 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 88 va &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
81 va |= penc << 12; 89 va |= penc << 12;
82 va |= ssize << 8; 90 va |= ssize << 8;
91 va |= 1; /* L */
83 asm volatile(".long 0x7c000224 | (%0 << 11) | (1 << 21)" 92 asm volatile(".long 0x7c000224 | (%0 << 11) | (1 << 21)"
84 : : "r"(va) : "memory"); 93 : : "r"(va) : "memory");
85 break; 94 break;