diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index e0c48b379..eeaf3f594 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -598,12 +598,16 @@ void cpu_do_idle(void) __asm __volatile("pause" ::: "memory"); } -void cpu_dead(uint16_t pcpu_id) +/** + * only run on current pcpu + */ +void cpu_dead(void) { /* For debug purposes, using a stack variable in the while loop enables * us to modify the value using a JTAG probe and resume if needed. */ int32_t halt = 1; + uint16_t pcpu_id = get_cpu_id(); if (bitmap_test_and_clear_lock(pcpu_id, &pcpu_active_bitmap)) { /* clean up native stuff */ diff --git a/hypervisor/arch/x86/init.c b/hypervisor/arch/x86/init.c index 23dba529a..b9ab22254 100644 --- a/hypervisor/arch/x86/init.c +++ b/hypervisor/arch/x86/init.c @@ -72,7 +72,7 @@ static void enter_guest_mode(uint16_t pcpu_id) default_idle(); /* Control should not come here */ - cpu_dead(pcpu_id); + cpu_dead(); } static void bsp_boot_post(void) diff --git a/hypervisor/arch/x86/irq.c b/hypervisor/arch/x86/irq.c index 53baed348..1b30459a0 100644 --- a/hypervisor/arch/x86/irq.c +++ b/hypervisor/arch/x86/irq.c @@ -376,7 +376,7 @@ void dispatch_exception(struct intr_excp_ctx *ctx) spinlock_release(&exception_spinlock); /* Halt the CPU */ - cpu_dead(pcpu_id); + cpu_dead(); } #ifdef CONFIG_PARTITION_MODE diff --git a/hypervisor/common/schedule.c b/hypervisor/common/schedule.c index bf17edfb8..3369a8009 100644 --- a/hypervisor/common/schedule.c +++ b/hypervisor/common/schedule.c @@ -175,7 +175,7 @@ void default_idle(void) if (need_reschedule(pcpu_id) != 0) { schedule(); } else if (need_offline(pcpu_id) != 0) { - cpu_dead(pcpu_id); + cpu_dead(); } else { CPU_IRQ_ENABLE(); handle_complete_ioreq(pcpu_id); diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index cbada5f79..4853870d7 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -306,7 +306,7 @@ extern struct cpuinfo_x86 boot_cpu_data; /* Function prototypes */ void cpu_do_idle(void); -void cpu_dead(uint16_t pcpu_id); +void cpu_dead(void); void trampoline_start16(void); bool is_apicv_reg_virtualization_supported(void); bool is_apicv_intr_delivery_supported(void);