diff mbox series

[7/9] SLW: Call p9_stop_api only if deep_states are enabled

Message ID 1515065286-8656-8-git-send-email-akshay.adiga@linux.vnet.ibm.com
State Accepted
Headers show
Series p9_stop_api error handling | expand

Commit Message

Akshay Adiga Jan. 4, 2018, 11:28 a.m. UTC
All init time p9_stop_api calls have been isolated to slw_late_init. If
p9_stop_api fails, then the deep states can be excluded from device tree.

For p9_stop_api called after device-tree for cpuidle is created ,
has_deep_states will be used to check if this call is even required.

Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
---
 hw/slw.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/hw/slw.c b/hw/slw.c
index 5548226b..e461030c 100644
--- a/hw/slw.c
+++ b/hw/slw.c
@@ -908,6 +908,10 @@  void add_cpu_idle_state_properties(void)
 				}
 			}
 
+			if ((wakeup_engine_state == WAKEUP_ENGINE_PRESENT) && has_deep_states)
+				slw_late_init_p9(chip);
+			if (wakeup_engine_state != WAKEUP_ENGINE_PRESENT)
+				has_deep_states = false;
 	} else if (chip->type == PROC_CHIP_P8_MURANO ||
 	    chip->type == PROC_CHIP_P8_VENICE ||
 	    chip->type == PROC_CHIP_P8_NAPLES) {
@@ -1471,6 +1475,11 @@  int64_t opal_slw_set_reg(uint64_t cpu_pir, uint64_t sprn, uint64_t val)
 	assert(chip);
 
 	if (proc_gen == proc_gen_p9) {
+		if (!has_deep_states) {
+			prlog(PR_INFO, "SLW: Deep states not enabled\n");
+			return OPAL_SUCCESS;
+		}
+
 		if (wakeup_engine_state != WAKEUP_ENGINE_PRESENT) {
 			log_simple_error(&e_info(OPAL_RC_SLW_REG),
 					 "SLW: wakeup_engine in bad state=%d chip=%x\n",