Skip to content

Commit cc2256d

Browse files
lifeixjren1
authored andcommitted
Call monitor_cap_detect in bsp_boot_init
On the APL NUC board (CPU family: 0x6 model: 92), the monitor is buggy. We can't use it to wake up CPU core from mwait by memory monitor. Signed-off-by: Li, Fei1 <fei1.li@intel.com>
1 parent cc1d532 commit cc2256d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

hypervisor/arch/x86/cpu.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ struct cpu_capability {
7474
static struct cpu_capability cpu_caps;
7575

7676
static void apicv_cap_detect(void);
77+
static void monitor_cap_detect(void);
7778
static void cpu_set_logical_id(uint32_t logical_id);
7879
static void print_hv_banner(void);
79-
bool check_monitor_support(void);
80+
static inline bool get_monitor_cap(void);
8081
int cpu_find_logical_id(uint32_t lapic_id);
8182
#ifndef CONFIG_EFI_STUB
8283
static void start_cpus();
@@ -310,6 +311,8 @@ void bsp_boot_init(void)
310311

311312
apicv_cap_detect();
312313

314+
monitor_cap_detect();
315+
313316
/* Set state for this CPU to initializing */
314317
cpu_set_current_state(CPU_BOOT_ID, CPU_STATE_INITIALIZING);
315318

@@ -557,7 +560,7 @@ static void pcpu_sync_sleep(unsigned long *sync, int mask_bit)
557560
{
558561
int wake_sync = (1 << mask_bit);
559562

560-
if (check_monitor_support()) {
563+
if (get_monitor_cap()) {
561564
/* Wait for the event to be set using monitor/mwait */
562565
asm volatile ("1: cmpl %%ebx,(%%eax)\n"
563566
" je 2f\n"
@@ -653,7 +656,7 @@ static void monitor_cap_detect(void)
653656
}
654657
}
655658

656-
bool check_monitor_support(void)
659+
static inline bool get_monitor_cap(void)
657660
{
658661
return cpu_caps.monitor_supported;
659662
}

0 commit comments

Comments
 (0)