[Skiboot] [PATCH V4 3/4] core/direct-controls: add function to read core gated state

Shilpasri G Bhat shilpa.bhat at linux.vnet.ibm.com
Mon Nov 20 17:10:52 AEDT 2017


From: Robert Lippert <rlippert at google.com>

Change-Id: Ib534503f2528de4d8b1633d9859ae9ff5d010f98
Signed-off-by: Robert Lippert <rlippert at google.com>
---
 core/direct-controls.c | 21 +++++++++++++++++++++
 include/cpu.h          |  1 +
 2 files changed, 22 insertions(+)

diff --git a/core/direct-controls.c b/core/direct-controls.c
index 0ed00c1..c5ba80e 100644
--- a/core/direct-controls.c
+++ b/core/direct-controls.c
@@ -35,6 +35,7 @@
 #define P9_SPWKUP_SET			PPC_BIT(0)
 
 #define P9_EC_PPM_SSHHYP		0x0114
+#define P9_CORE_GATED			PPC_BIT(0)
 #define P9_SPECIAL_WKUP_DONE		PPC_BIT(1)
 
 /* Waking may take up to 5ms for deepest sleep states. Set timeout to 100ms */
@@ -280,6 +281,26 @@ out:
 	return rc;
 }
 
+int dctl_core_is_gated(struct cpu_thread *t)
+{
+	struct cpu_thread *c = t->primary;
+	uint32_t chip_id = pir_to_chip_id(c->pir);
+	uint32_t core_id = pir_to_core_id(c->pir);
+	uint32_t sshhyp_addr;
+	uint64_t val;
+
+	sshhyp_addr = XSCOM_ADDR_P9_EC_SLAVE(core_id, P9_EC_PPM_SSHHYP);
+
+	if (xscom_read(chip_id, sshhyp_addr, &val)) {
+		prlog(PR_ERR, "Could not query core gated on %u:%u:"
+				" Unable to read PPM_SSHHYP.\n",
+				chip_id, core_id);
+		return OPAL_HARDWARE;
+	}
+
+	return !!(val & P9_CORE_GATED);
+}
+
 static int dctl_stop(struct cpu_thread *t)
 {
 	struct cpu_thread *c = t->primary;
diff --git a/include/cpu.h b/include/cpu.h
index d4b7a42..5db4ccb 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -297,5 +297,6 @@ extern void cpu_fast_reboot_complete(void);
 
 int dctl_set_special_wakeup(struct cpu_thread *t);
 int dctl_clear_special_wakeup(struct cpu_thread *t);
+int dctl_core_is_gated(struct cpu_thread *t);
 
 #endif /* __CPU_H */
-- 
1.8.3.1



More information about the Skiboot mailing list