[v3,6/7] SLW: Allow deep states if homer address is known

Message ID 1503478082-11775-7-git-send-email-akshay.adiga@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Akshay Adiga Aug. 23, 2017, 8:48 a.m.
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>
---
 hw/slw.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

Patch

diff --git a/hw/slw.c b/hw/slw.c
index c943d80..288295a 100644
--- a/hw/slw.c
+++ b/hw/slw.c
@@ -707,7 +707,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;
 
@@ -797,9 +797,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.
@@ -827,7 +838,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 */
@@ -835,7 +846,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++) {