aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-01-20 01:50:21 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-04-19 21:03:22 -0400
commit2dd60d79e0202628a47af9812a84d502cc63628c (patch)
tree03a114dcb4a8c3b75ec689d372abd331aff5a555 /arch/powerpc/kernel
parent24cc67de62eebbda3ce0c46bdd56582c00dccd03 (diff)
powerpc: In HV mode, use HSPRG0 for PACA
When running in Hypervisor mode (arch 2.06 or later), we store the PACA in HSPRG0 instead of SPRG1. The architecture specifies that SPRGs may be lost during a "nap" power management operation (though they aren't currently on POWER7) and this enables use of SPRG1 by KVM guests. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/entry_64.S4
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S8
-rw-r--r--arch/powerpc/kernel/head_64.S4
-rw-r--r--arch/powerpc/kernel/paca.c13
4 files changed, 20 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index d82878c4daa6..dbf5bfafd7bc 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -838,7 +838,7 @@ _GLOBAL(enter_rtas)
838 838
839_STATIC(rtas_return_loc) 839_STATIC(rtas_return_loc)
840 /* relocation is off at this point */ 840 /* relocation is off at this point */
841 mfspr r4,SPRN_SPRG_PACA /* Get PACA */ 841 GET_PACA(r4)
842 clrldi r4,r4,2 /* convert to realmode address */ 842 clrldi r4,r4,2 /* convert to realmode address */
843 843
844 bcl 20,31,$+4 844 bcl 20,31,$+4
@@ -869,7 +869,7 @@ _STATIC(rtas_restore_regs)
869 REST_8GPRS(14, r1) /* Restore the non-volatiles */ 869 REST_8GPRS(14, r1) /* Restore the non-volatiles */
870 REST_10GPRS(22, r1) /* ditto */ 870 REST_10GPRS(22, r1) /* ditto */
871 871
872 mfspr r13,SPRN_SPRG_PACA 872 GET_PACA(r13)
873 873
874 ld r4,_CCR(r1) 874 ld r4,_CCR(r1)
875 mtcr r4 875 mtcr r4
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index aeb739e18769..6784bf7090f6 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -53,7 +53,7 @@ data_access_pSeries:
53 DO_KVM 0x300 53 DO_KVM 0x300
54 mtspr SPRN_SPRG_SCRATCH0,r13 54 mtspr SPRN_SPRG_SCRATCH0,r13
55BEGIN_FTR_SECTION 55BEGIN_FTR_SECTION
56 mfspr r13,SPRN_SPRG_PACA 56 GET_PACA(r13)
57 std r9,PACA_EXSLB+EX_R9(r13) 57 std r9,PACA_EXSLB+EX_R9(r13)
58 std r10,PACA_EXSLB+EX_R10(r13) 58 std r10,PACA_EXSLB+EX_R10(r13)
59 mfspr r10,SPRN_DAR 59 mfspr r10,SPRN_DAR
@@ -82,7 +82,7 @@ data_access_slb_pSeries:
82 HMT_MEDIUM 82 HMT_MEDIUM
83 DO_KVM 0x380 83 DO_KVM 0x380
84 mtspr SPRN_SPRG_SCRATCH0,r13 84 mtspr SPRN_SPRG_SCRATCH0,r13
85 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */ 85 GET_PACA(r13)
86 std r3,PACA_EXSLB+EX_R3(r13) 86 std r3,PACA_EXSLB+EX_R3(r13)
87 mfspr r3,SPRN_DAR 87 mfspr r3,SPRN_DAR
88 std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ 88 std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */
@@ -121,7 +121,7 @@ instruction_access_slb_pSeries:
121 HMT_MEDIUM 121 HMT_MEDIUM
122 DO_KVM 0x480 122 DO_KVM 0x480
123 mtspr SPRN_SPRG_SCRATCH0,r13 123 mtspr SPRN_SPRG_SCRATCH0,r13
124 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */ 124 GET_PACA(r13)
125 std r3,PACA_EXSLB+EX_R3(r13) 125 std r3,PACA_EXSLB+EX_R3(r13)
126 mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ 126 mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
127 std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ 127 std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */
@@ -165,7 +165,7 @@ BEGIN_FTR_SECTION
165 beq- 1f 165 beq- 1f
166END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) 166END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
167 mr r9,r13 167 mr r9,r13
168 mfspr r13,SPRN_SPRG_PACA 168 GET_PACA(r13)
169 mfspr r11,SPRN_SRR0 169 mfspr r11,SPRN_SRR0
170 ld r12,PACAKBASE(r13) 170 ld r12,PACAKBASE(r13)
171 ld r10,PACAKMSR(r13) 171 ld r10,PACAKMSR(r13)
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 3a319f9c9d3e..39a40400f3f2 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -228,7 +228,7 @@ generic_secondary_common_init:
228 mr r3,r24 /* not found, copy phys to r3 */ 228 mr r3,r24 /* not found, copy phys to r3 */
229 b .kexec_wait /* next kernel might do better */ 229 b .kexec_wait /* next kernel might do better */
230 230
2312: mtspr SPRN_SPRG_PACA,r13 /* Save vaddr of paca in an SPRG */ 2312: SET_PACA(r13)
232#ifdef CONFIG_PPC_BOOK3E 232#ifdef CONFIG_PPC_BOOK3E
233 addi r12,r13,PACA_EXTLB /* and TLB exc frame in another */ 233 addi r12,r13,PACA_EXTLB /* and TLB exc frame in another */
234 mtspr SPRN_SPRG_TLB_EXFRAME,r12 234 mtspr SPRN_SPRG_TLB_EXFRAME,r12
@@ -534,7 +534,7 @@ _GLOBAL(pmac_secondary_start)
534 ld r4,0(r4) /* Get base vaddr of paca array */ 534 ld r4,0(r4) /* Get base vaddr of paca array */
535 mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */ 535 mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */
536 add r13,r13,r4 /* for this processor. */ 536 add r13,r13,r4 /* for this processor. */
537 mtspr SPRN_SPRG_PACA,r13 /* Save vaddr of paca in an SPRG*/ 537 SET_PACA(r13) /* Save vaddr of paca in an SPRG*/
538 538
539 /* Mark interrupts soft and hard disabled (they might be enabled 539 /* Mark interrupts soft and hard disabled (they might be enabled
540 * in the PACA when doing hotplug) 540 * in the PACA when doing hotplug)
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 10f0aadee95b..102244edecf0 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -156,11 +156,22 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu)
156/* Put the paca pointer into r13 and SPRG_PACA */ 156/* Put the paca pointer into r13 and SPRG_PACA */
157void setup_paca(struct paca_struct *new_paca) 157void setup_paca(struct paca_struct *new_paca)
158{ 158{
159 /* Setup r13 */
159 local_paca = new_paca; 160 local_paca = new_paca;
160 mtspr(SPRN_SPRG_PACA, local_paca); 161
161#ifdef CONFIG_PPC_BOOK3E 162#ifdef CONFIG_PPC_BOOK3E
163 /* On Book3E, initialize the TLB miss exception frames */
162 mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb); 164 mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb);
165#else
166 /* In HV mode, we setup both HPACA and PACA to avoid problems
167 * if we do a GET_PACA() before the feature fixups have been
168 * applied
169 */
170 if (cpu_has_feature(CPU_FTR_HVMODE_206))
171 mtspr(SPRN_SPRG_HPACA, local_paca);
163#endif 172#endif
173 mtspr(SPRN_SPRG_PACA, local_paca);
174
164} 175}
165 176
166static int __initdata paca_size; 177static int __initdata paca_size;