uefi: remove warkaround for AP wakeup

remove sipi_from_efi_boot_service_exit & efi_deferred_wakeup_pcpu workaround
for uefi boot flow

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Xu, Anthony <anthony.xu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jason Chen CJ 2018-05-15 10:57:00 +08:00 committed by lijinxia
parent 953f6b5b1b
commit d2a7a9c91d
5 changed files with 2 additions and 92 deletions

View File

@ -37,10 +37,6 @@
#include <version.h>
#include <hv_debug.h>
#ifdef CONFIG_EFI_STUB
extern uint32_t efi_physical_available_ap_bitmap;
#endif
spinlock_t cpu_secondary_spinlock = {
.head = 0,
.tail = 0
@ -85,9 +81,7 @@ static void cpu_xsave_init(void);
static void cpu_set_logical_id(uint32_t logical_id);
static void print_hv_banner(void);
int cpu_find_logical_id(uint32_t lapic_id);
#ifndef CONFIG_EFI_STUB
static void start_cpus(void);
#endif
static void pcpu_sync_sleep(unsigned long *sync, int mask_bit);
int ibrs_type;
@ -290,22 +284,14 @@ static int init_phy_cpu_storage(void)
pcpu_num = parse_madt(lapic_id_base);
alloc_phy_cpu_data(pcpu_num);
for (i = 0; i < pcpu_num; i++) {
for (i = 0; i < pcpu_num; i++)
per_cpu(lapic_id, i) = *lapic_id_base++;
#ifdef CONFIG_EFI_STUB
efi_physical_available_ap_bitmap |= 1 << per_cpu(lapic_id, i);
#endif
}
/* free memory after lapic_id are saved in per_cpu data */
free(lapic_id_base);
bsp_lapic_id = get_cur_lapic_id();
#ifdef CONFIG_EFI_STUB
efi_physical_available_ap_bitmap &= ~(1 << bsp_lapic_id);
#endif
bsp_cpu_id = cpu_find_logical_id(bsp_lapic_id);
ASSERT(bsp_cpu_id >= 0, "fail to get phy cpu id");
@ -543,18 +529,11 @@ void bsp_boot_init(void)
init_scheduler();
#ifndef CONFIG_EFI_STUB
/* Start all secondary cores */
start_cpus();
/* Trigger event to allow secondary CPUs to continue */
bitmap_set(0, &pcpu_sync);
#else
memcpy_s(_ld_cpu_secondary_reset_start,
(unsigned long)&_ld_cpu_secondary_reset_size,
_ld_cpu_secondary_reset_load,
(unsigned long)&_ld_cpu_secondary_reset_size);
#endif
ASSERT(get_cpu_id() == CPU_BOOT_ID, "");
@ -630,10 +609,6 @@ void cpu_secondary_init(void)
/* Wait for boot processor to signal all secondary cores to continue */
pcpu_sync_sleep(&pcpu_sync, 0);
#ifdef CONFIG_EFI_STUB
bitmap_clr(0, &pcpu_sync);
#endif
hv_main(get_cpu_id());
/* Control will only come here for secondary CPUs not configured for
@ -654,7 +629,6 @@ int cpu_find_logical_id(uint32_t lapic_id)
return -1;
}
#ifndef CONFIG_EFI_STUB
/*
* Start all secondary CPUs.
*/
@ -700,7 +674,6 @@ static void start_cpus()
} while (1);
}
}
#endif
void cpu_dead(uint32_t logical_id)
{

View File

@ -971,11 +971,6 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic)
mode = icrval & APIC_DELMODE_MASK;
phys = ((icrval & APIC_DESTMODE_LOG) == 0);
#ifdef CONFIG_EFI_STUB
if (sipi_from_efi_boot_service_exit(dest, mode, vec))
return 0;
#endif
if (mode == APIC_DELMODE_FIXED && vec < 16) {
vlapic_set_error(vlapic, APIC_ESR_SEND_ILLEGAL_VECTOR);
dev_dbg(ACRN_DBG_LAPIC, "Ignoring invalid IPI %d", vec);

View File

@ -55,12 +55,8 @@
#ifdef CONFIG_EFI_STUB
static void efi_init(void);
uint32_t efi_physical_available_ap_bitmap = 0;
uint32_t efi_wake_up_ap_bitmap = 0;
struct efi_ctx* efi_ctx = NULL;
struct lapic_regs uefi_lapic_regs;
extern uint32_t up_count;
extern unsigned long pcpu_sync;
static int efi_initialized;
void efi_spurious_handler(int vector)
@ -84,51 +80,6 @@ void efi_spurious_handler(int vector)
return;
}
int sipi_from_efi_boot_service_exit(uint32_t dest, uint32_t mode, uint32_t vec)
{
if (efi_wake_up_ap_bitmap != efi_physical_available_ap_bitmap) {
if (mode == APIC_DELMODE_STARTUP) {
uint32_t cpu_id = cpu_find_logical_id(dest);
send_startup_ipi(INTR_CPU_STARTUP_USE_DEST,
cpu_id, (uint64_t)(vec<<12));
efi_wake_up_ap_bitmap |= 1 << dest;
}
return 1;
}
return 0;
}
void efi_deferred_wakeup_pcpu(int cpu_id)
{
uint32_t timeout;
uint32_t expected_up;
static uint32_t waked_pcpu_bitmap;
if ((1 << cpu_id) & waked_pcpu_bitmap)
return;
waked_pcpu_bitmap |= 1 << cpu_id;
expected_up = up_count + 1;
send_startup_ipi(INTR_CPU_STARTUP_USE_DEST,
cpu_id, (uint64_t)cpu_secondary_reset);
timeout = CPU_UP_TIMEOUT * 1000;
while ((up_count != expected_up)) {
/* Delay 10us */
udelay(10);
/* Decrement timeout value */
timeout -= 10;
}
bitmap_set(0, &pcpu_sync);
}
int uefi_sw_loader(struct vm *vm, struct vcpu *vcpu)
{
int ret = 0;

View File

@ -73,13 +73,9 @@ int allocate_pcpu(void)
int i;
for (i = 0; i < phy_cpu_num; i++) {
if (bitmap_test_and_set(i, &pcpu_used_bitmap) == 0) {
#ifdef CONFIG_EFI_STUB
efi_deferred_wakeup_pcpu(i);
#endif
if (bitmap_test_and_set(i, &pcpu_used_bitmap) == 0)
return i;
}
}
return -1;
}

View File

@ -521,9 +521,4 @@ struct ioapic {
#define IOAPIC_RTE_INTVEC 0x000000ff /*R/W: INT vector field*/
#ifdef CONFIG_EFI_STUB
int sipi_from_efi_boot_service_exit(uint32_t dest, uint32_t mode, uint32_t vec);
void efi_deferred_wakeup_pcpu(int cpu_id);
#endif
#endif /* _APICREG_H_ */