[Skiboot] [PATCH] slw: Add a flag to indicate no state loss and exit criteria for stop states

Shilpasri G Bhat shilpa.bhat at linux.vnet.ibm.com
Fri Sep 16 18:41:09 AEST 2016


Adds a flag OPAL_PM_WAKEUP_AT_NEXT_INST whenever set for stop0-4 idle
state it should be entered with EC and ESL bits of PSSCR set to 0.
This flag is enabled for stop0 which will ensure no state is lost by
the thread and the thread will wakeup at next instruction following
stop if MSR.EE=0 or at the corresponding interrupt handler if
MSR.EE=1. This will reduce the exit latency of the idle state and
hardware will not allocate the thread resources to other threads
while in power saving mode.

Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
Reviewed-by: Gautham R. Shenoy <ego at linux.vnet.ibm.com>
---
 hw/slw.c           | 3 ++-
 include/opal-api.h | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/slw.c b/hw/slw.c
index 09e8d1d..5cfa7b0 100644
--- a/hw/slw.c
+++ b/hw/slw.c
@@ -480,12 +480,13 @@ static struct cpu_idle_states power8_cpu_idle_states[] = {
  */
 static struct cpu_idle_states power9_cpu_idle_states[] = {
 	{
-		.name = "stop0",
+		.name = "stop0_lite", /* Enter stop0 with no loss */
 		.latency_ns = 300,
 		.residency_ns = 3000,
 		.flags = 0*OPAL_PM_DEC_STOP \
 		       | 0*OPAL_PM_TIMEBASE_STOP  \
 		       | 0*OPAL_PM_LOSE_USER_CONTEXT \
+		       | 1*OPAL_PM_WAKEUP_AT_NEXT_INST \
 		       | 0*OPAL_PM_LOSE_HYP_CONTEXT \
 		       | 0*OPAL_PM_LOSE_FULL_CONTEXT \
 		       | 1*OPAL_PM_STOP_INST_FAST,
diff --git a/include/opal-api.h b/include/opal-api.h
index f607a41..fdff0e1 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -195,6 +195,15 @@
 #define OPAL_PM_LOSE_HYP_CONTEXT	0x00002000 /* Restore hypervisor
 						  resource from PACA pointer */
 #define OPAL_PM_LOSE_FULL_CONTEXT	0x00004000
+#define OPAL_PM_WAKEUP_AT_NEXT_INST	0x00008000 /* Hypervisor to enter
+						    * stop0-4 with EC=ESL=0
+						    * where thread will not
+						    * lose any state and
+						    * wakeup at next
+						    * instruction or the
+						    * corresponding interrupt
+						    * handler.
+						    */
 #define OPAL_PM_NAP_ENABLED		0x00010000
 #define OPAL_PM_SLEEP_ENABLED		0x00020000
 #define OPAL_PM_WINKLE_ENABLED		0x00040000
-- 
1.8.3.1



More information about the Skiboot mailing list