Skip to content

Commit cee2f8b

Browse files
yakuizhaowenlingz
authored andcommitted
ACRN/HV: Refine the function of init_vboot to initialize the depriv_boot env correctly
Currently when get_rsdp is called, the EFI depriv_boot env is not initialized. In such case it will fallback to the legacy mechanism of ACPI table. If the ACPI table based on legacy mechanism is not found, it will fail to get the ACPI table and then the system will hang. On the old platform it still can parse the ACPI table from legacy mechanism. In fact when EFI RSDP exists, the EFI RSDP is preferred instead of legacy ACPI RSDP. In order to avoid multiple calling of depriv_init_boot, the init_boot_operations is renamed and called after X2apic is enabled(early_init_lapic). Tracked-On: #3184 Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Reviewed-by: Yin Fengwei <fengwei.yin@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
1 parent 1c36508 commit cee2f8b

File tree

5 files changed

+9
-14
lines changed

5 files changed

+9
-14
lines changed

hypervisor/arch/x86/cpu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ void init_pcpu_pre(uint16_t pcpu_id_args)
119119
*/
120120
init_pcpu_capabilities();
121121

122-
init_vboot_operations();
123-
124122
init_pcpu_model_name();
125123

126124
load_pcpu_state_data();
@@ -135,6 +133,8 @@ void init_pcpu_pre(uint16_t pcpu_id_args)
135133

136134
early_init_lapic();
137135

136+
init_vboot();
137+
138138
if (!init_percpu_lapic_id()) {
139139
panic("failed to init_percpu_lapic_id!");
140140
}

hypervisor/arch/x86/init.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ static void enter_guest_mode(uint16_t pcpu_id)
6464

6565
static void init_primary_pcpu_post(void)
6666
{
67-
/* Perform any necessary guest vboot initialization */
68-
init_vboot();
69-
7067
init_debug_pre();
7168

7269
init_pcpu_post(BOOT_CPU_ID);

hypervisor/boot/guest/deprivilege_boot.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ static void init_depri_boot(void)
4343

4444
const struct depri_boot_context *get_depri_boot_ctx(void)
4545
{
46-
init_depri_boot();
4746
return &depri_boot_ctx;
4847
}
4948

5049
const struct lapic_regs *get_depri_boot_lapic_regs(void)
5150
{
52-
init_depri_boot();
5351
return &depri_boot_lapic_regs;
5452
}
5553

hypervisor/boot/guest/vboot_wrapper.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static enum vboot_mode sos_boot_mode;
2929
* @pre: this function is called during detect mode which is very early stage,
3030
* other exported interfaces should not be called beforehand.
3131
*/
32-
void init_vboot_operations(void)
32+
void init_vboot(void)
3333
{
3434

3535
struct multiboot_info *mbi;
@@ -61,15 +61,16 @@ void init_vboot_operations(void)
6161
}
6262
}
6363
}
64-
}
6564

66-
/* @pre: vboot_ops->init != NULL */
67-
void init_vboot(void)
68-
{
65+
/*
66+
* vboot_ops is mandatory and it will be initialized correctly.
67+
* The vboot_ops->init is called to assure that the boot env is
68+
* initialized before calling other vboot_ops interface.
69+
*/
70+
vboot_ops->init();
6971
#ifdef CONFIG_ACPI_PARSE_ENABLED
7072
acpi_fixup();
7173
#endif
72-
vboot_ops->init();
7374
}
7475

7576
/* @pre: vboot_ops != NULL */

hypervisor/boot/include/guest/vboot.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ struct vboot_operations {
2020
void (*init_irq)(void);
2121
};
2222

23-
void init_vboot_operations(void);
2423
void init_vboot(void);
2524
void init_vboot_irq(void);
2625
uint64_t get_ap_trampoline_buf(void);

0 commit comments

Comments
 (0)