powerpc/64s/idle: POWER9 implement a separate idle stop function for hotplug
authorNicholas Piggin <npiggin@gmail.com>
Fri, 17 Nov 2017 14:08:05 +0000 (00:08 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 31 Mar 2018 13:47:46 +0000 (00:47 +1100)
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>
arch/powerpc/include/asm/processor.h
arch/powerpc/kernel/idle_book3s.S
arch/powerpc/platforms/powernv/idle.c

index bb9cb25ffb2010f7c10de0fd4e1d4bb247098ecd..c4b36a494a63655528d2305e0393241b8743cb86 100644 (file)
@@ -518,6 +518,7 @@ extern int powersave_nap;   /* set if nap mode can be used in idle loop */
 extern unsigned long power7_idle_insn(unsigned long type); /* PNV_THREAD_NAP/etc*/
 extern void power7_idle_type(unsigned long type);
 extern unsigned long power9_idle_stop(unsigned long psscr_val);
+extern unsigned long power9_offline_stop(unsigned long psscr_val);
 extern void power9_idle_type(unsigned long stop_psscr_val,
                              unsigned long stop_psscr_mask);
 
index 89157cf452e3cba91827cd547b0d832c9a3dd57d..2896ccf3138db026fc60b6de4082d147bea71ece 100644 (file)
@@ -325,12 +325,6 @@ enter_winkle:
  * r3 - PSSCR value corresponding to the requested stop state.
  */
 power_enter_stop:
-#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
-       /* Tell KVM we're entering idle */
-       li      r4,KVM_HWTHREAD_IN_IDLE
-       /* DO THIS IN REAL MODE!  See comment above. */
-       stb     r4,HSTATE_HWTHREAD_STATE(r13)
-#endif
 /*
  * Check if we are executing the lite variant with ESL=EC=0
  */
@@ -425,6 +419,24 @@ ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 66);           \
        ld      r3,ORIG_GPR3(r1);       /* Restore original r3 */       \
 20:    nop;
 
+/*
+ * Entered with MSR[EE]=0 and no soft-masked interrupts pending.
+ * r3 contains desired PSSCR register value.
+ */
+_GLOBAL(power9_offline_stop)
+       std     r3, PACA_REQ_PSSCR(r13)
+       mtspr   SPRN_PSSCR,r3
+#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
+       /* Tell KVM we're entering idle */
+       li      r4,KVM_HWTHREAD_IN_IDLE
+       /* DO THIS IN REAL MODE!  See comment above. */
+       stb     r4,HSTATE_HWTHREAD_STATE(r13)
+#endif
+       LOAD_REG_ADDR(r4,power_enter_stop)
+       b       pnv_powersave_common
+       /* No return */
+
+
 /*
  * Entered with MSR[EE]=0 and no soft-masked interrupts pending.
  * r3 contains desired PSSCR register value.
index d9e366bb23da49bad3f0429826917357bdde214e..378fde1f85a803b916a87fd41f020284192e1752 100644 (file)
@@ -511,7 +511,7 @@ unsigned long pnv_cpu_offline(unsigned int cpu)
                psscr = mfspr(SPRN_PSSCR);
                psscr = (psscr & ~pnv_deepest_stop_psscr_mask) |
                                                pnv_deepest_stop_psscr_val;
-               srr1 = power9_idle_stop(psscr);
+               srr1 = power9_offline_stop(psscr);
 
        } else if ((idle_states & OPAL_PM_WINKLE_ENABLED) &&
                   (idle_states & OPAL_PM_LOSE_FULL_CONTEXT)) {