[Skiboot] [PATCH] Bail out when booting in big core mode

Joel Stanley joel at jms.id.au
Wed Apr 29 13:18:06 AEST 2020


This is not supported and will result in a misbehaving system later in
boot.

We wait until the console is up so the developer can see what happened.

Signed-off-by: Joel Stanley <joel at jms.id.au>
---
I see that there are some patches on the list to support this mode. If
they don't go in soon, I ask that this change be added (and backported)
to help developers who accidentally boot in big core mode.

 core/cpu.c          | 9 +++++++++
 core/init.c         | 3 +++
 include/cpu.h       | 3 +++
 include/processor.h | 2 ++
 4 files changed, 17 insertions(+)

diff --git a/core/cpu.c b/core/cpu.c
index 37d9f41a8b79..f0c7e881e0f0 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -935,6 +935,15 @@ static void init_cpu_thread(struct cpu_thread *t,
 	assert(pir == container_of(t, struct cpu_stack, cpu) - cpu_stacks);
 }
 
+void cpu_check_bigcore(void)
+{
+	unsigned int pvr = mfspr(SPR_PVR);
+	if (PVR_TYPE(pvr) == PVR_TYPE_P9 && !(PVR_CHIP_TYPE(pvr) & 0x1)) {
+		prerror("CPU: Detected unsupported POWER9 in big core mode.\n");
+		abort();
+	}
+}
+
 static void enable_attn(void)
 {
 	unsigned long hid0;
diff --git a/core/init.c b/core/init.c
index 39cfd3fbe1b1..73a6756ebdb3 100644
--- a/core/init.c
+++ b/core/init.c
@@ -1284,6 +1284,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt)
 	/* Install the OPAL Console handlers */
 	init_opal_console();
 
+	/* Now that the console is up, bail out if we do not support the machine */
+	cpu_check_bigcore();
+
 	/*
 	 * Some platforms set a flag to wait for SBE validation to be
 	 * performed by the BMC. If this occurs it leaves the SBE in a
diff --git a/include/cpu.h b/include/cpu.h
index 686310d71676..a24e52c9c5e8 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -291,6 +291,9 @@ void cpu_set_sreset_enable(bool sreset_enabled);
 /* IPI for PM modes is enabled */
 void cpu_set_ipi_enable(bool sreset_enabled);
 
+/* Abort if we do not support CPU mode */
+void cpu_check_bigcore(void);
+
 static inline void cpu_give_self_os(void)
 {
 	__this_cpu->state = cpu_state_os;
diff --git a/include/processor.h b/include/processor.h
index 57c2ee13ad4e..f124caa90e67 100644
--- a/include/processor.h
+++ b/include/processor.h
@@ -175,10 +175,12 @@
 #define SPR_PVR_TYPE			0xffff0000
 #define SPR_PVR_VERS_MAJ		0x00000f00
 #define SPR_PVR_VERS_MIN		0x000000ff
+#define SPR_PVR_CHIP_TYPE		0x0000f000
 
 #define PVR_TYPE(_pvr)		GETFIELD(SPR_PVR_TYPE, _pvr)
 #define PVR_VERS_MAJ(_pvr)	GETFIELD(SPR_PVR_VERS_MAJ, _pvr)
 #define PVR_VERS_MIN(_pvr)	GETFIELD(SPR_PVR_VERS_MIN, _pvr)
+#define PVR_CHIP_TYPE(_pvr)	GETFIELD(SPR_PVR_CHIP_TYPE, _pvr)
 
 /* PVR definitions */
 #define PVR_TYPE_P8E	0x004b /* Murano */
-- 
2.26.2



More information about the Skiboot mailing list