diff mbox series

[v5,6/8] SLW: Allow deep states if homer address is known

Message ID 1505478062-1623-7-git-send-email-akshay.adiga@linux.vnet.ibm.com
State Accepted
Headers show
Series Enable stop4 idle state | expand

Commit Message

Akshay Adiga Sept. 15, 2017, 12:21 p.m. UTC
Use a common variable has_wakeup_engine instead of has_slw to tell if
the
a) SLW image is populated in case of power8
b) CME image is populated in case of power9

Currently we expect CME to be loaded if homer address is known ( except
for simulators)

Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
---
 hw/slw.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/hw/slw.c b/hw/slw.c
index 39aa4d0..1ce7608 100644
--- a/hw/slw.c
+++ b/hw/slw.c
@@ -813,7 +813,7 @@  void add_cpu_idle_state_properties(void)
 	int nr_states;
 
 	bool can_sleep = true;
-	bool has_slw = true;
+	bool has_wakeup_engine = true;
 	bool has_stop_inst = false;
 	u8 i;
 
@@ -906,9 +906,20 @@  void add_cpu_idle_state_properties(void)
 		nr_states = ARRAY_SIZE(power7_cpu_idle_states);
 	}
 
-	/* Enable deep idle states only if slw image is intact */
-	has_slw = (chip->slw_base && chip->slw_bar_size &&
-			chip->slw_image_size);
+	/*
+	 * Enable deep idle states only if :
+	 * P8 : slw image is intact
+	 * P9 : homer_base is set
+	 */
+	if (!(proc_chip_quirks & QUIRK_MAMBO_CALLOUTS)) {
+		if (proc_gen == proc_gen_p9)
+			has_wakeup_engine = !!(chip->homer_base);
+		else /* (proc_gen == proc_gen_p8) */
+			has_wakeup_engine = (chip->slw_base && chip->slw_bar_size &&
+					chip->slw_image_size);
+	} else {
+		has_wakeup_engine = false;
+	}
 
 	/*
 	 * Currently we can't append strings and cells to dt properties.
@@ -936,7 +947,7 @@  void add_cpu_idle_state_properties(void)
 	if (has_stop_inst) {
 		/* Power 9 / POWER ISA 3.0 */
 		supported_states_mask = OPAL_PM_STOP_INST_FAST;
-		if (has_slw)
+		if (has_wakeup_engine)
 			supported_states_mask |= OPAL_PM_STOP_INST_DEEP;
 	} else {
 		/* Power 7 and Power 8 */
@@ -944,7 +955,7 @@  void add_cpu_idle_state_properties(void)
 		if (can_sleep)
 			supported_states_mask |= OPAL_PM_SLEEP_ENABLED |
 						OPAL_PM_SLEEP_ENABLED_ER1;
-		if (has_slw)
+		if (has_wakeup_engine)
 			supported_states_mask |= OPAL_PM_WINKLE_ENABLED;
 	}
 	for (i = 0; i < nr_states; i++) {