diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index 337ec560a..7d7c7534d 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -293,7 +293,7 @@ static int init_phy_cpu_storage(void) return bsp_cpu_id; } -static void cpu_set_current_state(uint32_t logical_id, int state) +static void cpu_set_current_state(uint32_t logical_id, enum cpu_state state) { spinlock_obtain(&up_count_spinlock); diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index b93739c90..b0bb475d1 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -132,13 +132,6 @@ /* Boot CPU ID */ #define CPU_BOOT_ID 0U -/* CPU states defined */ -#define CPU_STATE_RESET 0 -#define CPU_STATE_INITIALIZING 1 -#define CPU_STATE_RUNNING 2 -#define CPU_STATE_HALTED 3 -#define CPU_STATE_DEAD 4 - /* hypervisor stack bottom magic('intl') */ #define SP_BOTTOM_MAGIC 0x696e746cUL @@ -218,6 +211,15 @@ enum feature_word { FEATURE_WORDS, }; +/* CPU states defined */ +enum cpu_state { + CPU_STATE_RESET = 0, + CPU_STATE_INITIALIZING, + CPU_STATE_RUNNING, + CPU_STATE_HALTED, + CPU_STATE_DEAD, +}; + struct cpu_state_info { uint8_t px_cnt; /* count of all Px states */ const struct cpu_px_data *px_data; diff --git a/hypervisor/include/arch/x86/per_cpu.h b/hypervisor/include/arch/x86/per_cpu.h index 7dd9c742f..f18b073b6 100644 --- a/hypervisor/include/arch/x86/per_cpu.h +++ b/hypervisor/include/arch/x86/per_cpu.h @@ -32,7 +32,7 @@ struct per_cpu_region { struct emul_cnx g_inst_ctxt; struct host_gdt gdt; struct tss_64 tss; - int state; + enum cpu_state state; uint8_t mc_stack[CONFIG_STACK_SIZE] __aligned(16); uint8_t df_stack[CONFIG_STACK_SIZE] __aligned(16); uint8_t sf_stack[CONFIG_STACK_SIZE] __aligned(16);