linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* powerpc: Enable cpuhotplug with ESL=1 on POWER9
@ 2017-02-24  6:34 Vaidyanathan Srinivasan
  2017-02-24  6:34 ` [PATCH 1/2] powerpc/cpuhotplug: Force ESL=1 for offline cpus Vaidyanathan Srinivasan
  2017-02-24  6:34 ` [PATCH 2/2] powerpc/cpuhotplug: print psscr and srr1 value for debug Vaidyanathan Srinivasan
  0 siblings, 2 replies; 3+ messages in thread
From: Vaidyanathan Srinivasan @ 2017-02-24  6:34 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linuxppc-dev

The attached patch enables ESL=1 STOP2 for cpuhotplug.  This is a debug
patch that we could carry now until STOP states are discovered from
device tree.

Test run:

[  151.670021] CPU8 going offline with request psscr 00000000003f0332
[  151.719856] CPU 8 offline: Remove Rx thread
[  189.200410] CPU8 coming online with psscr 20000000003f0332, srr1 9000000000261001

We request ESL=EC=1 and STOP2 and successfully wakeup from that state
using IPI from XIVE.

--Vaidy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] powerpc/cpuhotplug: Force ESL=1 for offline cpus
  2017-02-24  6:34 powerpc: Enable cpuhotplug with ESL=1 on POWER9 Vaidyanathan Srinivasan
@ 2017-02-24  6:34 ` Vaidyanathan Srinivasan
  2017-02-24  6:34 ` [PATCH 2/2] powerpc/cpuhotplug: print psscr and srr1 value for debug Vaidyanathan Srinivasan
  1 sibling, 0 replies; 3+ messages in thread
From: Vaidyanathan Srinivasan @ 2017-02-24  6:34 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linuxppc-dev, Gautham R . Shenoy

From: Gautham R. Shenoy <ego@linux.vnet.ibm.com>

ESL=1 losses some HYP SPR context and not idea for cpuidle,
however can be used for offline cpus.

Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/cpuidle.h    | 15 +++++++++++++++
 arch/powerpc/platforms/powernv/idle.c | 11 +++++++++++
 2 files changed, 26 insertions(+)

diff --git a/arch/powerpc/include/asm/cpuidle.h b/arch/powerpc/include/asm/cpuidle.h
index fd321eb4..31192d8 100644
--- a/arch/powerpc/include/asm/cpuidle.h
+++ b/arch/powerpc/include/asm/cpuidle.h
@@ -40,6 +40,21 @@
 #define ERR_EC_ESL_MISMATCH		-1
 #define ERR_DEEP_STATE_ESL_MISMATCH	-2
 
+/* Additional defs for debug and trace */
+
+#define RL_SHIFT      0
+#define MTL_SHIFT     4
+#define TR_SHIFT      8
+#define PSLL_SHIFT    16
+#define EC_SHIFT      20
+#define ESL_SHIFT     21
+#define INIT_PSSCR(ESL, EC, PSLL, TR, MTL, RL)	(((ESL) << (ESL_SHIFT)) | \
+						 ((EC) << (EC_SHIFT)) | \
+						 ((PSLL) << (PSLL_SHIFT)) | \
+						 ((TR) << (TR_SHIFT)) | \
+						 ((MTL) << (MTL_SHIFT)) | \
+						 ((RL) << (RL_SHIFT)))
+
 #ifndef __ASSEMBLY__
 extern u32 pnv_fastsleep_workaround_at_entry[];
 extern u32 pnv_fastsleep_workaround_at_exit[];
diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index 4ee837e..4f0663a 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -524,6 +524,17 @@ static int __init pnv_init_idle_states(void)
 
 	pnv_alloc_idle_core_states();
 
+	/* On POWER9 DD1, enter stop2 with ESL=EC=1 on Hotplug */
+	if (cpu_has_feature(CPU_FTR_POWER9_DD1)) {
+		pnv_deepest_stop_psscr_val =
+				/* ESL, EC, PSSL, TR,  MTL, RL */
+			INIT_PSSCR(0x1, 0x1, 0xf, 0x3, 0x3, 0x2);
+		pnv_deepest_stop_psscr_mask = PSSCR_HV_DEFAULT_MASK;
+		pr_warn("Overriding deepest_stop_psscr to: val=0x%016llx,mask=0x%016llx\n",
+			pnv_deepest_stop_psscr_val,
+			pnv_deepest_stop_psscr_mask);
+	}
+
 	if (supported_cpuidle_states & OPAL_PM_NAP_ENABLED)
 		ppc_md.power_save = power7_idle;
 	else if (supported_cpuidle_states & OPAL_PM_STOP_INST_FAST)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] powerpc/cpuhotplug: print psscr and srr1 value for debug
  2017-02-24  6:34 powerpc: Enable cpuhotplug with ESL=1 on POWER9 Vaidyanathan Srinivasan
  2017-02-24  6:34 ` [PATCH 1/2] powerpc/cpuhotplug: Force ESL=1 for offline cpus Vaidyanathan Srinivasan
@ 2017-02-24  6:34 ` Vaidyanathan Srinivasan
  1 sibling, 0 replies; 3+ messages in thread
From: Vaidyanathan Srinivasan @ 2017-02-24  6:34 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linuxppc-dev

This is a debug patch that helps trace various STOP
state transitions and look at srr1 and psscr at wakeup.

Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/powernv/smp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c
index e39e6c4..5b3f002 100644
--- a/arch/powerpc/platforms/powernv/smp.c
+++ b/arch/powerpc/platforms/powernv/smp.c
@@ -185,8 +185,12 @@ static void pnv_smp_cpu_kill_self(void)
 		ppc64_runlatch_off();
 
 		if (cpu_has_feature(CPU_FTR_ARCH_300)) {
+			pr_info("CPU%d going offline with request psscr %016llx\n",
+				cpu, pnv_deepest_stop_psscr_val);
 			srr1 = power9_idle_stop(pnv_deepest_stop_psscr_val,
 						pnv_deepest_stop_psscr_mask);
+			pr_info("CPU%d coming online with psscr %016lx, srr1 %016lx\n",
+						cpu, mfspr(SPRN_PSSCR), srr1);
 		} else if (idle_states & OPAL_PM_WINKLE_ENABLED) {
 			srr1 = power7_winkle();
 		} else if ((idle_states & OPAL_PM_SLEEP_ENABLED) ||
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-24  6:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-24  6:34 powerpc: Enable cpuhotplug with ESL=1 on POWER9 Vaidyanathan Srinivasan
2017-02-24  6:34 ` [PATCH 1/2] powerpc/cpuhotplug: Force ESL=1 for offline cpus Vaidyanathan Srinivasan
2017-02-24  6:34 ` [PATCH 2/2] powerpc/cpuhotplug: print psscr and srr1 value for debug Vaidyanathan Srinivasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).