[Skiboot] [PATCH 1/6] Enable attn instruction on boot

Michael Neuling mikey at neuling.org
Fri Apr 29 15:57:02 AEST 2016


Currently we leave the attn instruction disabled until we use.  This
means that attn is not available to the host kernel.

This enables the attn instruction on all CPUs on boot.

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 core/cpu.c        | 10 ++++++++++
 core/init.c       |  2 ++
 hw/fsp/fsp-attn.c |  5 -----
 include/cpu.h     |  1 +
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/core/cpu.c b/core/cpu.c
index d347903..46aea9a 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -399,6 +399,15 @@ static void init_cpu_thread(struct cpu_thread *t,
 	assert(pir == container_of(t, struct cpu_stack, cpu) - cpu_stacks);
 }
 
+void init_hid(void)
+{
+	unsigned long hid0;
+
+	hid0 = mfspr(SPR_HID0);
+	hid0 |= SPR_HID0_ENABLE_ATTN;
+	set_hid0(hid0);
+}
+
 void pre_init_boot_cpu(void)
 {
 	struct cpu_thread *cpu = this_cpu();
@@ -465,6 +474,7 @@ void init_boot_cpu(void)
 	init_cpu_thread(boot_cpu, cpu_state_active, pir);
 	init_boot_tracebuf(boot_cpu);
 	assert(this_cpu() == boot_cpu);
+	init_hid();
 
 	list_head_init(&global_job_queue);
 }
diff --git a/core/init.c b/core/init.c
index 15fff18..a72972d 100644
--- a/core/init.c
+++ b/core/init.c
@@ -809,6 +809,8 @@ void __noreturn __secondary_cpu_entry(void)
 	/* Secondary CPU called in */
 	cpu_callin(cpu);
 
+	init_hid();
+
 	/* Wait for work to do */
 	while(true) {
 		int i;
diff --git a/hw/fsp/fsp-attn.c b/hw/fsp/fsp-attn.c
index 7b56192..ff702ab 100644
--- a/hw/fsp/fsp-attn.c
+++ b/hw/fsp/fsp-attn.c
@@ -118,8 +118,6 @@ static void update_sp_attn_area(const char *msg)
 
 void __attribute__((noreturn)) ibm_fsp_terminate(const char *msg)
 {
-	unsigned long hid0;
-
 	/* Update SP attention area */
 	update_sp_attn_area(msg);
 
@@ -133,9 +131,6 @@ void __attribute__((noreturn)) ibm_fsp_terminate(const char *msg)
 	 * reboot loop.
 	 */
 
-	hid0 = mfspr(SPR_HID0);
-	hid0 |= SPR_HID0_ENABLE_ATTN;
-	set_hid0(hid0);
 	trigger_attn();
 	for (;;) ;
 }
diff --git a/include/cpu.h b/include/cpu.h
index 9eaf59c..587cd52 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -120,6 +120,7 @@ static inline void __nomcount cpu_relax(void)
 void pre_init_boot_cpu(void);
 void init_boot_cpu(void);
 void init_all_cpus(void);
+void init_hid(void);
 
 /* This brings up our secondaries */
 extern void cpu_bringup(void);
-- 
2.7.4



More information about the Skiboot mailing list