Skip to content

Commit d0b791c

Browse files
committed
powerpc/64s/idle: Consolidate power9_offline_stop()/power9_idle_stop()
Commit 3d4fbff ("powerpc/64s/idle: POWER9 implement a separate idle stop function for hotplug") that added power9_offline_stop() was written before commit 7672691 ("powerpc/powernv: Provide a way to force a core into SMT4 mode"). When merging the former I failed to notice that it caused us to skip the force-SMT4 logic for offline CPUs. The result is that offlined CPUs will not correctly participate in the force-SMT4 logic, which presumably will result in badness (not tested). Reconcile the two commits by making power9_offline_stop() a pre-cursor to power9_idle_stop(), so that they share the force-SMT4 logic. This is based on an original commit from Nick, all breakage is my own. Fixes: 3d4fbff ("powerpc/64s/idle: POWER9 implement a separate idle stop function for hotplug") Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Nicholas Piggin <[email protected]>
1 parent f2748bd commit d0b791c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

arch/powerpc/kernel/idle_book3s.S

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -422,25 +422,24 @@ ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 66); \
422422
/*
423423
* Entered with MSR[EE]=0 and no soft-masked interrupts pending.
424424
* r3 contains desired PSSCR register value.
425+
*
426+
* Offline (CPU unplug) case also must notify KVM that the CPU is
427+
* idle.
425428
*/
426429
_GLOBAL(power9_offline_stop)
427-
std r3, PACA_REQ_PSSCR(r13)
428-
mtspr SPRN_PSSCR,r3
429430
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
430-
/* Tell KVM we're entering idle */
431+
/*
432+
* Tell KVM we're entering idle.
433+
* This does not have to be done in real mode because the P9 MMU
434+
* is independent per-thread. Some steppings share radix/hash mode
435+
* between threads, but in that case KVM has a barrier sync in real
436+
* mode before and after switching between radix and hash.
437+
*/
431438
li r4,KVM_HWTHREAD_IN_IDLE
432-
/* DO THIS IN REAL MODE! See comment above. */
433439
stb r4,HSTATE_HWTHREAD_STATE(r13)
434440
#endif
435-
LOAD_REG_ADDR(r4,power_enter_stop)
436-
b pnv_powersave_common
437-
/* No return */
441+
/* fall through */
438442

439-
440-
/*
441-
* Entered with MSR[EE]=0 and no soft-masked interrupts pending.
442-
* r3 contains desired PSSCR register value.
443-
*/
444443
_GLOBAL(power9_idle_stop)
445444
std r3, PACA_REQ_PSSCR(r13)
446445
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE

0 commit comments

Comments
 (0)