diff options
-rw-r--r-- | arch/powerpc/kernel/idle_power7.S | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/arch/powerpc/kernel/idle_power7.S b/arch/powerpc/kernel/idle_power7.S index ccde8f084ce4..112ccf497562 100644 --- a/arch/powerpc/kernel/idle_power7.S +++ b/arch/powerpc/kernel/idle_power7.S | |||
@@ -52,6 +52,22 @@ | |||
52 | .text | 52 | .text |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * Used by threads when the lock bit of core_idle_state is set. | ||
56 | * Threads will spin in HMT_LOW until the lock bit is cleared. | ||
57 | * r14 - pointer to core_idle_state | ||
58 | * r15 - used to load contents of core_idle_state | ||
59 | */ | ||
60 | |||
61 | core_idle_lock_held: | ||
62 | HMT_LOW | ||
63 | 3: lwz r15,0(r14) | ||
64 | andi. r15,r15,PNV_CORE_IDLE_LOCK_BIT | ||
65 | bne 3b | ||
66 | HMT_MEDIUM | ||
67 | lwarx r15,0,r14 | ||
68 | blr | ||
69 | |||
70 | /* | ||
55 | * Pass requested state in r3: | 71 | * Pass requested state in r3: |
56 | * r3 - PNV_THREAD_NAP/SLEEP/WINKLE | 72 | * r3 - PNV_THREAD_NAP/SLEEP/WINKLE |
57 | * | 73 | * |
@@ -150,6 +166,10 @@ power7_enter_nap_mode: | |||
150 | ld r14,PACA_CORE_IDLE_STATE_PTR(r13) | 166 | ld r14,PACA_CORE_IDLE_STATE_PTR(r13) |
151 | lwarx_loop1: | 167 | lwarx_loop1: |
152 | lwarx r15,0,r14 | 168 | lwarx r15,0,r14 |
169 | |||
170 | andi. r9,r15,PNV_CORE_IDLE_LOCK_BIT | ||
171 | bnel core_idle_lock_held | ||
172 | |||
153 | andc r15,r15,r7 /* Clear thread bit */ | 173 | andc r15,r15,r7 /* Clear thread bit */ |
154 | 174 | ||
155 | andi. r15,r15,PNV_CORE_IDLE_THREAD_BITS | 175 | andi. r15,r15,PNV_CORE_IDLE_THREAD_BITS |
@@ -294,7 +314,7 @@ lwarx_loop2: | |||
294 | * workaround undo code or resyncing timebase or restoring context | 314 | * workaround undo code or resyncing timebase or restoring context |
295 | * In either case loop until the lock bit is cleared. | 315 | * In either case loop until the lock bit is cleared. |
296 | */ | 316 | */ |
297 | bne core_idle_lock_held | 317 | bnel core_idle_lock_held |
298 | 318 | ||
299 | cmpwi cr2,r15,0 | 319 | cmpwi cr2,r15,0 |
300 | lbz r4,PACA_SUBCORE_SIBLING_MASK(r13) | 320 | lbz r4,PACA_SUBCORE_SIBLING_MASK(r13) |
@@ -319,15 +339,6 @@ lwarx_loop2: | |||
319 | isync | 339 | isync |
320 | b common_exit | 340 | b common_exit |
321 | 341 | ||
322 | core_idle_lock_held: | ||
323 | HMT_LOW | ||
324 | core_idle_lock_loop: | ||
325 | lwz r15,0(14) | ||
326 | andi. r9,r15,PNV_CORE_IDLE_LOCK_BIT | ||
327 | bne core_idle_lock_loop | ||
328 | HMT_MEDIUM | ||
329 | b lwarx_loop2 | ||
330 | |||
331 | first_thread_in_subcore: | 342 | first_thread_in_subcore: |
332 | /* First thread in subcore to wakeup */ | 343 | /* First thread in subcore to wakeup */ |
333 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT | 344 | ori r15,r15,PNV_CORE_IDLE_LOCK_BIT |