diff options
author | Michael Neuling <mikey@neuling.org> | 2016-05-02 15:26:19 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-05-10 16:04:51 +1000 |
commit | 4e62374cd3a124b792e3e1befbeaadc0985e4df3 (patch) | |
tree | 4ec7272a5dc447c7c1b3ece749d0554435be0eef /core | |
parent | 6b50ff75b5194972a00ba662767c65d70c90a938 (diff) | |
download | skiboot-4e62374cd3a124b792e3e1befbeaadc0985e4df3.zip skiboot-4e62374cd3a124b792e3e1befbeaadc0985e4df3.tar.gz skiboot-4e62374cd3a124b792e3e1befbeaadc0985e4df3.tar.bz2 |
Disable attn instruction on boot
Currently we don't touch the attn enable bit in HID0 on boot.
When attn is enabled, it's available everywhere including HV=0. This
is very dangerous for the host kernel.
This explicitly disables the attn instruction on all CPUs on boot.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/cpu.c | 16 | ||||
-rw-r--r-- | core/init.c | 2 |
2 files changed, 18 insertions, 0 deletions
@@ -408,6 +408,15 @@ static void enable_attn(void) set_hid0(hid0); } +static void disable_attn(void) +{ + unsigned long hid0; + + hid0 = mfspr(SPR_HID0); + hid0 &= ~SPR_HID0_ENABLE_ATTN; + set_hid0(hid0); +} + extern void __trigger_attn(void); void trigger_attn(void) { @@ -415,6 +424,12 @@ void trigger_attn(void) __trigger_attn(); } +void init_hid(void) +{ + /* attn is enabled even when HV=0, so make sure it's off */ + disable_attn(); +} + void pre_init_boot_cpu(void) { struct cpu_thread *cpu = this_cpu(); @@ -481,6 +496,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; |