aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2017-11-17 09:08:05 -0500
committerMichael Ellerman <mpe@ellerman.id.au>2018-03-31 09:47:46 -0400
commit3d4fbffdd703d2b968db443911f2147c732a4a48 (patch)
tree4227b85de9f76cbba0c7c9979ea08be7548c4d56
parentd40b6768e45bd9213139b2d91d30c7692b6007b1 (diff)
powerpc/64s/idle: POWER9 implement a separate idle stop function for hotplug
Implement a new function to invoke stop, power9_offline_stop, which is like power9_idle_stop but used by the cpu hotplug code. Move KVM secondary state manipulation code to the offline case. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/processor.h1
-rw-r--r--arch/powerpc/kernel/idle_book3s.S24
-rw-r--r--arch/powerpc/platforms/powernv/idle.c2
3 files changed, 20 insertions, 7 deletions
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index bb9cb25ffb20..c4b36a494a63 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -518,6 +518,7 @@ extern int powersave_nap; /* set if nap mode can be used in idle loop */
518extern unsigned long power7_idle_insn(unsigned long type); /* PNV_THREAD_NAP/etc*/ 518extern unsigned long power7_idle_insn(unsigned long type); /* PNV_THREAD_NAP/etc*/
519extern void power7_idle_type(unsigned long type); 519extern void power7_idle_type(unsigned long type);
520extern unsigned long power9_idle_stop(unsigned long psscr_val); 520extern unsigned long power9_idle_stop(unsigned long psscr_val);
521extern unsigned long power9_offline_stop(unsigned long psscr_val);
521extern void power9_idle_type(unsigned long stop_psscr_val, 522extern void power9_idle_type(unsigned long stop_psscr_val,
522 unsigned long stop_psscr_mask); 523 unsigned long stop_psscr_mask);
523 524
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 89157cf452e3..2896ccf3138d 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -325,12 +325,6 @@ enter_winkle:
325 * r3 - PSSCR value corresponding to the requested stop state. 325 * r3 - PSSCR value corresponding to the requested stop state.
326 */ 326 */
327power_enter_stop: 327power_enter_stop:
328#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
329 /* Tell KVM we're entering idle */
330 li r4,KVM_HWTHREAD_IN_IDLE
331 /* DO THIS IN REAL MODE! See comment above. */
332 stb r4,HSTATE_HWTHREAD_STATE(r13)
333#endif
334/* 328/*
335 * Check if we are executing the lite variant with ESL=EC=0 329 * Check if we are executing the lite variant with ESL=EC=0
336 */ 330 */
@@ -429,6 +423,24 @@ ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 66); \
429 * Entered with MSR[EE]=0 and no soft-masked interrupts pending. 423 * Entered with MSR[EE]=0 and no soft-masked interrupts pending.
430 * r3 contains desired PSSCR register value. 424 * r3 contains desired PSSCR register value.
431 */ 425 */
426_GLOBAL(power9_offline_stop)
427 std r3, PACA_REQ_PSSCR(r13)
428 mtspr SPRN_PSSCR,r3
429#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
430 /* Tell KVM we're entering idle */
431 li r4,KVM_HWTHREAD_IN_IDLE
432 /* DO THIS IN REAL MODE! See comment above. */
433 stb r4,HSTATE_HWTHREAD_STATE(r13)
434#endif
435 LOAD_REG_ADDR(r4,power_enter_stop)
436 b pnv_powersave_common
437 /* No return */
438
439
440/*
441 * Entered with MSR[EE]=0 and no soft-masked interrupts pending.
442 * r3 contains desired PSSCR register value.
443 */
432_GLOBAL(power9_idle_stop) 444_GLOBAL(power9_idle_stop)
433BEGIN_FTR_SECTION 445BEGIN_FTR_SECTION
434 lwz r5, PACA_DONT_STOP(r13) 446 lwz r5, PACA_DONT_STOP(r13)
diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index d9e366bb23da..378fde1f85a8 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -511,7 +511,7 @@ unsigned long pnv_cpu_offline(unsigned int cpu)
511 psscr = mfspr(SPRN_PSSCR); 511 psscr = mfspr(SPRN_PSSCR);
512 psscr = (psscr & ~pnv_deepest_stop_psscr_mask) | 512 psscr = (psscr & ~pnv_deepest_stop_psscr_mask) |
513 pnv_deepest_stop_psscr_val; 513 pnv_deepest_stop_psscr_val;
514 srr1 = power9_idle_stop(psscr); 514 srr1 = power9_offline_stop(psscr);
515 515
516 } else if ((idle_states & OPAL_PM_WINKLE_ENABLED) && 516 } else if ((idle_states & OPAL_PM_WINKLE_ENABLED) &&
517 (idle_states & OPAL_PM_LOSE_FULL_CONTEXT)) { 517 (idle_states & OPAL_PM_LOSE_FULL_CONTEXT)) {