diff options
Diffstat (limited to 'arch/powerpc/kernel/exceptions-64s.S')
-rw-r--r-- | arch/powerpc/kernel/exceptions-64s.S | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index db08382e19f1..c2df8150bd7a 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <asm/hw_irq.h> | 15 | #include <asm/hw_irq.h> |
16 | #include <asm/exception-64s.h> | 16 | #include <asm/exception-64s.h> |
17 | #include <asm/ptrace.h> | 17 | #include <asm/ptrace.h> |
18 | #include <asm/cpuidle.h> | ||
18 | 19 | ||
19 | /* | 20 | /* |
20 | * We layout physical memory as follows: | 21 | * We layout physical memory as follows: |
@@ -101,23 +102,34 @@ system_reset_pSeries: | |||
101 | #ifdef CONFIG_PPC_P7_NAP | 102 | #ifdef CONFIG_PPC_P7_NAP |
102 | BEGIN_FTR_SECTION | 103 | BEGIN_FTR_SECTION |
103 | /* Running native on arch 2.06 or later, check if we are | 104 | /* Running native on arch 2.06 or later, check if we are |
104 | * waking up from nap. We only handle no state loss and | 105 | * waking up from nap/sleep/winkle. |
105 | * supervisor state loss. We do -not- handle hypervisor | ||
106 | * state loss at this time. | ||
107 | */ | 106 | */ |
108 | mfspr r13,SPRN_SRR1 | 107 | mfspr r13,SPRN_SRR1 |
109 | rlwinm. r13,r13,47-31,30,31 | 108 | rlwinm. r13,r13,47-31,30,31 |
110 | beq 9f | 109 | beq 9f |
111 | 110 | ||
112 | /* waking up from powersave (nap) state */ | 111 | cmpwi cr3,r13,2 |
113 | cmpwi cr1,r13,2 | 112 | |
114 | /* Total loss of HV state is fatal, we could try to use the | 113 | /* |
115 | * PIR to locate a PACA, then use an emergency stack etc... | 114 | * Check if last bit of HSPGR0 is set. This indicates whether we are |
116 | * OPAL v3 based powernv platforms have new idle states | 115 | * waking up from winkle. |
117 | * which fall in this catagory. | ||
118 | */ | 116 | */ |
119 | bgt cr1,8f | ||
120 | GET_PACA(r13) | 117 | GET_PACA(r13) |
118 | clrldi r5,r13,63 | ||
119 | clrrdi r13,r13,1 | ||
120 | cmpwi cr4,r5,1 | ||
121 | mtspr SPRN_HSPRG0,r13 | ||
122 | |||
123 | lbz r0,PACA_THREAD_IDLE_STATE(r13) | ||
124 | cmpwi cr2,r0,PNV_THREAD_NAP | ||
125 | bgt cr2,8f /* Either sleep or Winkle */ | ||
126 | |||
127 | /* Waking up from nap should not cause hypervisor state loss */ | ||
128 | bgt cr3,. | ||
129 | |||
130 | /* Waking up from nap */ | ||
131 | li r0,PNV_THREAD_RUNNING | ||
132 | stb r0,PACA_THREAD_IDLE_STATE(r13) /* Clear thread state */ | ||
121 | 133 | ||
122 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE | 134 | #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE |
123 | li r0,KVM_HWTHREAD_IN_KERNEL | 135 | li r0,KVM_HWTHREAD_IN_KERNEL |
@@ -133,7 +145,7 @@ BEGIN_FTR_SECTION | |||
133 | 145 | ||
134 | /* Return SRR1 from power7_nap() */ | 146 | /* Return SRR1 from power7_nap() */ |
135 | mfspr r3,SPRN_SRR1 | 147 | mfspr r3,SPRN_SRR1 |
136 | beq cr1,2f | 148 | beq cr3,2f |
137 | b power7_wakeup_noloss | 149 | b power7_wakeup_noloss |
138 | 2: b power7_wakeup_loss | 150 | 2: b power7_wakeup_loss |
139 | 151 | ||
@@ -1382,6 +1394,7 @@ machine_check_handle_early: | |||
1382 | MACHINE_CHECK_HANDLER_WINDUP | 1394 | MACHINE_CHECK_HANDLER_WINDUP |
1383 | GET_PACA(r13) | 1395 | GET_PACA(r13) |
1384 | ld r1,PACAR1(r13) | 1396 | ld r1,PACAR1(r13) |
1397 | li r3,PNV_THREAD_NAP | ||
1385 | b power7_enter_nap_mode | 1398 | b power7_enter_nap_mode |
1386 | 4: | 1399 | 4: |
1387 | #endif | 1400 | #endif |