[Skiboot] [PATCH 59/61] xive2: Add NCU_SPEC_BAR to stop engine for restore

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Mon Jul 19 23:20:10 AEST 2021


From: Vaidyanathan Srinivasan <svaidy at linux.ibm.com>

P10 Stop engines have apis similar to P9 to set xscom restores
after wakeup from deep-sleep states.

This xscom restore will be used to support STOP11 on P10.

Signed-off-by: Vaidyanathan Srinivasan <svaidy at linux.ibm.com>
Signed-off-by: Pratik Rajesh Sampat <psampat at linux.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hw/xive2.c | 31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/hw/xive2.c b/hw/xive2.c
index f559b0f9a..d2fc2ad69 100644
--- a/hw/xive2.c
+++ b/hw/xive2.c
@@ -20,8 +20,8 @@
 #include <bitmap.h>
 #include <buddy.h>
 #include <phys-map.h>
-#include <p9_stop_api.H> /* TODO (p10): need P10 stop state engine */
-
+#include <p9_stop_api.H>
+#include <p10_stop_api.H>
 
 /* Verbose debug */
 #undef XIVE_VERBOSE_DEBUG
@@ -3022,11 +3022,32 @@ static void xive_configure_ex_special_bar(struct xive *x, struct cpu_thread *c)
 
 void xive2_late_init(void)
 {
+	struct cpu_thread *c;
+
 	prlog(PR_INFO, "SLW: Configuring self-restore for NCU_SPEC_BAR\n");
-			/*
-			 * TODO (p10): need P10 stop state engine and fix for STOP11
-			 */
+	for_each_present_cpu(c) {
+		if(cpu_is_thread0(c)) {
+			struct proc_chip *chip = get_chip(c->chip_id);
+			struct xive *x = chip->xive;
+			uint64_t xa, val, rc;
+			xa = XSCOM_ADDR_P10_NCU(pir_to_core_id(c->pir), P10_NCU_SPEC_BAR);
+			val = (uint64_t)x->tm_base | P10_NCU_SPEC_BAR_ENABLE;
+			/* Bail out if wakeup engine has already failed */
+			if (wakeup_engine_state != WAKEUP_ENGINE_PRESENT) {
+				prlog(PR_ERR, "XIVE proc_stop_api fail detected\n");
+				break;
+			}
+			rc = proc_stop_save_scom((void *)chip->homer_base, xa, val,
+				PROC_STOP_SCOM_REPLACE, PROC_STOP_SECTION_L3);
+			if (rc) {
+				xive_cpu_err(c, "proc_stop_save_scom failed for NCU_SPEC_BAR rc=%lld\n",
+					     rc);
+				wakeup_engine_state = WAKEUP_ENGINE_FAILED;
+			}
+		}
+	}
 }
+
 static void xive_provision_cpu(struct xive_cpu_state *xs, struct cpu_thread *c)
 {
 	struct xive *x;
-- 
2.31.1



More information about the Skiboot mailing list