From b1612e30720ad738175ac91b18b1d99b4aac5260 Mon Sep 17 00:00:00 2001 From: Jason Chen CJ Date: Sat, 4 Aug 2018 19:11:49 +0800 Subject: [PATCH] add cpu_do_idle to handle idle add wrap function cpu_do_idle in default_idle to handle arch cpu specific idle operation. Signed-off-by: Jason Chen CJ Acked-by: Eddie Dong --- hypervisor/arch/x86/cpu.c | 5 +++++ hypervisor/common/schedule.c | 5 ++--- hypervisor/include/arch/x86/cpu.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 7fe31d52f..1769d0faa 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -748,6 +748,11 @@ void stop_cpus() } } +void cpu_do_idle(__unused uint16_t pcpu_id) +{ + __asm __volatile("pause" ::: "memory"); +} + void cpu_dead(uint16_t pcpu_id) { /* For debug purposes, using a stack variable in the while loop enables diff --git a/hypervisor/common/schedule.c b/hypervisor/common/schedule.c index 24deac0a0..1670d5ff5 100644 --- a/hypervisor/common/schedule.c +++ b/hypervisor/common/schedule.c @@ -172,9 +172,8 @@ void default_idle(void) schedule(); } else if (need_offline(pcpu_id) != 0) { cpu_dead(pcpu_id); - } else { - __asm __volatile("pause" ::: "memory"); - } + } else + cpu_do_idle(pcpu_id); } } diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index b62f527aa..e56f443d2 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -318,6 +318,7 @@ extern struct cpuinfo_x86 boot_cpu_data; #define MAX_CX_ENTRY (MAX_CSTATE - 1U) /* Function prototypes */ +void cpu_do_idle(__unused uint16_t pcpu_id); void cpu_dead(uint16_t pcpu_id); void trampoline_start16(void); bool is_vapic_supported(void);