[Skiboot] [RFC v1 3/4] SLW: Configure self-restore for HRMOR

Akshay Adiga akshay.adiga at linux.vnet.ibm.com
Thu May 4 18:34:43 AEST 2017


HRMOR is set to zero for OPAL based system where the hypervisor is not
relocated.  After wakeup from deep stop state, the control should be
transferred to Linux 0x100 vector with no HRMOR offset.

Signed-off-by: Akshay Adiga <akshay.adiga at linux.vnet.ibm.com>
---
Changes in v1 :
Changes in commit message

 hw/slw.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/hw/slw.c b/hw/slw.c
index e4ab2c2..aeb8388 100644
--- a/hw/slw.c
+++ b/hw/slw.c
@@ -1159,17 +1159,50 @@ static void slw_patch_regs(struct proc_chip *chip)
 		/* XXX Add HIDs etc... */
 	}
 }
+
 #endif /* __HAVE_LIBPORE__ */
 
 static void slw_init_chip_p9(struct proc_chip *chip)
 {
 	struct cpu_thread *c;
+	int rc;
 
 	prlog(PR_NOTICE, "SLW: Init chip 0x%x\n", chip->id);
 
 	/* At power ON setup inits for power-mgt */
 	for_each_available_core_in_chip(c, chip->id)
 		slw_set_overrides_p9(chip, c);
+
+	#if __HAVE_LIBPORE__
+	if(!chip->homer_base) {
+		log_simple_error(&e_info(OPAL_RC_SLW_REG),
+			"SLW: HOMER base not set %x\n",
+				chip->id);
+		return;
+	}
+
+	prlog(PR_NOTICE, "SLW: Configuring self-restore for HRMOR\n");
+
+	/* Should this be for_each_present_cpu() ? */
+	for_each_available_cpu(c) {
+
+		if (c->chip_id != chip->id)
+			continue;
+
+		/*
+		 * Clear HRMOR. Need to update only for thread
+		 * 0 of each core. Doing it anyway for all threads
+		 */
+		rc =  p9_stop_save_cpureg ((void *) chip->homer_base,
+						P9_STOP_SPR_HRMOR, 0,
+					       c->pir);
+		if (rc) {
+			log_simple_error(&e_info(OPAL_RC_SLW_REG),
+				"SLW: Failed to set HRMOR for CPU %x\n",
+				c->pir);
+		}
+	}
+	#endif /* __HAVE_LIBPORE__ */
 }
 static void slw_init_chip(struct proc_chip *chip)
 {
-- 
2.5.5



More information about the Skiboot mailing list