Skip to content

Commit 41ac9e5

Browse files
JasonChenCJEddie Dong
authored andcommitted
rename function & definition from firmware to guest boot
The interface struct & API changes like below: struct uefi_context->struct depri_boot_context init_firmware_operations()->init_vboot_operations() init_firmware()->init_vboot() firmware_init_irq()->init_vboot_irq() firmware_get_rsdp()->get_rsdp_ptr() firmware_get_ap_trampoline()->get_ap_trampoline_buf() firmware_init_vm_boot_info()->init_vm_boot_info() Tracked-On: #1842 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 20f97f7 commit 41ac9e5

File tree

16 files changed

+123
-122
lines changed

16 files changed

+123
-122
lines changed

efi-stub/boot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ enable_disable_all_ap(BOOLEAN enable)
8888
}
8989

9090
static inline void hv_jump(EFI_PHYSICAL_ADDRESS hv_start,
91-
struct multiboot_info *mbi, struct uefi_context *efi_ctx)
91+
struct multiboot_info *mbi, struct depri_boot_context *efi_ctx)
9292
{
9393
hv_func hf;
9494

@@ -243,7 +243,7 @@ switch_to_guest_mode(EFI_HANDLE image, EFI_PHYSICAL_ADDRESS hv_hpa)
243243
EFI_STATUS err;
244244
struct multiboot_mmap *mmap;
245245
struct multiboot_info *mbi;
246-
struct uefi_context *efi_ctx;
246+
struct depri_boot_context *efi_ctx;
247247
struct acpi_table_rsdp *rsdp = NULL;
248248
int32_t i;
249249
EFI_CONFIGURATION_TABLE *config_table;

efi-stub/boot.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ typedef void(*hv_func)(int32_t, struct multiboot_info*);
7878
#define MBOOT_MMAP_NUMS 256
7979
#define MBOOT_MMAP_SIZE (sizeof(struct multiboot_mmap) * MBOOT_MMAP_NUMS)
8080
#define MBOOT_INFO_SIZE (sizeof(struct multiboot_info))
81-
#define BOOT_CTX_SIZE (sizeof(struct uefi_context))
81+
#define BOOT_CTX_SIZE (sizeof(struct depri_boot_context))
8282
#define BOOT_LOADER_NAME_SIZE 17U
8383
#define EFI_BOOT_MEM_SIZE \
8484
(MBOOT_MMAP_SIZE + MBOOT_INFO_SIZE + BOOT_CTX_SIZE + BOOT_LOADER_NAME_SIZE)
@@ -87,7 +87,7 @@ typedef void(*hv_func)(int32_t, struct multiboot_info*);
8787
#define MBOOT_INFO_PTR(addr) \
8888
((struct multiboot_info *)((VOID *)(addr) + MBOOT_MMAP_SIZE))
8989
#define BOOT_CTX_PTR(addr) \
90-
((struct uefi_context *)((VOID *)(addr) + MBOOT_MMAP_SIZE + MBOOT_INFO_SIZE))
90+
((struct depri_boot_context *)((VOID *)(addr) + MBOOT_MMAP_SIZE + MBOOT_INFO_SIZE))
9191
#define BOOT_LOADER_NAME_PTR(addr) \
9292
((char *)((VOID *)(addr) + MBOOT_MMAP_SIZE + MBOOT_INFO_SIZE + BOOT_CTX_SIZE))
9393

hypervisor/arch/x86/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void init_pcpu_pre(uint16_t pcpu_id_args)
116116
*/
117117
init_pcpu_capabilities();
118118

119-
init_firmware_operations();
119+
init_vboot_operations();
120120

121121
init_pcpu_model_name();
122122

hypervisor/arch/x86/guest/vm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_
363363
create_sos_vm_e820(vm);
364364
prepare_sos_vm_memmap(vm);
365365

366-
status = firmware_init_vm_boot_info(vm);
366+
status = init_vm_boot_info(vm);
367367
if (status != 0) {
368368
need_cleanup = true;
369369
}
@@ -388,7 +388,7 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_
388388
if (vm_config->load_order == PRE_LAUNCHED_VM) {
389389
create_prelaunched_vm_e820(vm);
390390
prepare_prelaunched_vm_memmap(vm, vm_config);
391-
(void)firmware_init_vm_boot_info(vm);
391+
(void)init_vm_boot_info(vm);
392392
}
393393
}
394394

hypervisor/arch/x86/init.c

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

6565
static void init_primary_pcpu_post(void)
6666
{
67-
/* Perform any necessary firmware initialization */
68-
init_firmware();
67+
/* Perform any necessary guest vboot initialization */
68+
init_vboot();
6969

7070
init_debug_pre();
7171

hypervisor/arch/x86/irq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,5 +458,5 @@ void init_interrupt(uint16_t pcpu_id)
458458
init_lapic(pcpu_id);
459459
init_default_irqs(pcpu_id);
460460

461-
firmware_init_irq();
461+
init_vboot_irq();
462462
}

hypervisor/arch/x86/trampoline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ uint64_t prepare_trampoline(void)
110110
uint64_t size, dest_pa, i;
111111

112112
size = (uint64_t)(&ld_trampoline_end - &ld_trampoline_start);
113-
dest_pa = firmware_get_ap_trampoline();
113+
dest_pa = get_ap_trampoline_buf();
114114

115115
pr_dbg("trampoline code: %llx size %x", dest_pa, size);
116116

hypervisor/boot/acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static struct acpi_table_rsdp *get_rsdp(void)
152152
struct acpi_table_rsdp *rsdp = NULL;
153153
uint16_t *addr;
154154

155-
rsdp = (struct acpi_table_rsdp *)firmware_get_rsdp();
155+
rsdp = (struct acpi_table_rsdp *)get_rsdp_ptr();
156156
if (rsdp == NULL) {
157157
/* EBDA is addressed by the 16 bit pointer at 0x40E */
158158
addr = (uint16_t *)hpa2hva(0x40eUL);

hypervisor/boot/guest/deprivilege_boot.c

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: BSD-3-Clause
55
*/
66

7-
/* this is for UEFI platform */
7+
/* this is for de-privilege guest vboot method */
88

99
#include <types.h>
1010
#include <acrn_common.h>
@@ -17,52 +17,53 @@
1717
#include <multiboot.h>
1818
#include <deprivilege_boot.h>
1919

20-
static struct uefi_context uefi_ctx;
21-
static struct lapic_regs uefi_lapic_regs;
20+
static struct depri_boot_context depri_boot_ctx;
21+
static struct lapic_regs depri_boot_lapic_regs;
2222

23-
static void uefi_init(void)
23+
static void init_depri_boot(void)
2424
{
25-
static bool uefi_initialized = false;
25+
static bool depri_initialized = false;
2626
struct multiboot_info *mbi = NULL;
2727

28-
if (!uefi_initialized) {
28+
if (!depri_initialized) {
2929
parse_hv_cmdline();
3030

3131
mbi = (struct multiboot_info *) hpa2hva(((uint64_t)(uint32_t)boot_regs[1]));
3232
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_DRIVES) == 0U) {
33-
pr_err("no multiboot drivers for uefi found");
33+
pr_err("no multiboot drivers for depri_boot found");
3434
} else {
35-
memcpy_s(&uefi_ctx, sizeof(struct uefi_context), hpa2hva((uint64_t)mbi->mi_drives_addr),
36-
sizeof(struct uefi_context));
37-
save_lapic(&uefi_lapic_regs);
35+
memcpy_s(&depri_boot_ctx, sizeof(struct depri_boot_context),
36+
hpa2hva((uint64_t)mbi->mi_drives_addr),
37+
sizeof(struct depri_boot_context));
38+
save_lapic(&depri_boot_lapic_regs);
3839
}
39-
uefi_initialized = true;
40+
depri_initialized = true;
4041
}
4142
}
4243

43-
const struct uefi_context *get_uefi_ctx(void)
44+
const struct depri_boot_context *get_depri_boot_ctx(void)
4445
{
45-
uefi_init();
46-
return &uefi_ctx;
46+
init_depri_boot();
47+
return &depri_boot_ctx;
4748
}
4849

49-
const struct lapic_regs *get_uefi_lapic_regs(void)
50+
const struct lapic_regs *get_depri_boot_lapic_regs(void)
5051
{
51-
uefi_init();
52-
return &uefi_lapic_regs;
52+
init_depri_boot();
53+
return &depri_boot_lapic_regs;
5354
}
5455

55-
static uint64_t uefi_get_ap_trampoline(void)
56+
static uint64_t get_depri_boot_ap_trampoline(void)
5657
{
57-
return (uint64_t)(uefi_ctx.ap_trampoline_buf);
58+
return (uint64_t)(depri_boot_ctx.ap_trampoline_buf);
5859
}
5960

60-
static void* uefi_get_rsdp(void)
61+
static void* get_depri_boot_rsdp(void)
6162
{
62-
return hpa2hva((uint64_t)(uefi_ctx.rsdp));
63+
return hpa2hva((uint64_t)(depri_boot_ctx.rsdp));
6364
}
6465

65-
static void uefi_spurious_handler(int32_t vector)
66+
static void depri_boot_spurious_handler(int32_t vector)
6667
{
6768
if (get_pcpu_id() == BOOT_CPU_ID) {
6869
struct acrn_vcpu *vcpu = per_cpu(vcpu, BOOT_CPU_ID);
@@ -75,21 +76,21 @@ static void uefi_spurious_handler(int32_t vector)
7576
}
7677
}
7778

78-
static void uefi_init_irq(void)
79+
static void init_depri_boot_irq(void)
7980
{
80-
spurious_handler = (spurious_handler_t)uefi_spurious_handler;
81+
spurious_handler = (spurious_handler_t)depri_boot_spurious_handler;
8182
/* we defer irq enabling till vlapic is ready */
8283
}
8384

84-
static struct firmware_operations firmware_uefi_ops = {
85-
.init = uefi_init,
86-
.get_ap_trampoline = uefi_get_ap_trampoline,
87-
.get_rsdp = uefi_get_rsdp,
88-
.init_irq = uefi_init_irq,
89-
.init_vm_boot_info = uefi_init_vm_boot_info,
85+
static struct vboot_operations depri_boot_ops = {
86+
.init = init_depri_boot,
87+
.get_ap_trampoline = get_depri_boot_ap_trampoline,
88+
.get_rsdp = get_depri_boot_rsdp,
89+
.init_irq = init_depri_boot_irq,
90+
.init_vboot_info = init_depri_vboot_info,
9091
};
9192

92-
struct firmware_operations* uefi_get_firmware_operations(void)
93+
struct vboot_operations* get_deprivilege_boot_ops(void)
9394
{
94-
return &firmware_uefi_ops;
95+
return &depri_boot_ops;
9596
}

hypervisor/boot/guest/deprivilege_boot_info.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@
1111
#include <boot_context.h>
1212
#include <deprivilege_boot.h>
1313

14-
static int32_t uefi_sw_loader(struct acrn_vm *vm)
14+
static int32_t depri_boot_sw_loader(struct acrn_vm *vm)
1515
{
1616
int32_t ret = 0;
1717
/* get primary vcpu */
1818
struct acrn_vcpu *vcpu = vcpu_from_vid(vm, BOOT_CPU_ID);
1919
struct acrn_vcpu_regs *vcpu_regs = &boot_context;
20-
const struct uefi_context *uefi_ctx = get_uefi_ctx();
21-
const struct lapic_regs *uefi_lapic_regs = get_uefi_lapic_regs();
20+
const struct depri_boot_context *depri_boot_ctx = get_depri_boot_ctx();
21+
const struct lapic_regs *depri_boot_lapic_regs = get_depri_boot_lapic_regs();
2222

2323
pr_dbg("Loading guest to run-time location");
2424

25-
vlapic_restore(vcpu_vlapic(vcpu), uefi_lapic_regs);
25+
vlapic_restore(vcpu_vlapic(vcpu), depri_boot_lapic_regs);
2626

2727
/* For UEFI platform, the bsp init regs come from two places:
28-
* 1. saved in uefi_boot: gpregs, rip
28+
* 1. saved in depri_boot: gpregs, rip
2929
* 2. saved when HV started: other registers
30-
* We copy the info saved in uefi_boot to boot_context and
30+
* We copy the info saved in depri_boot to boot_context and
3131
* init bsp with boot_context.
3232
*/
3333
memcpy_s(&(vcpu_regs->gprs), sizeof(struct acrn_gp_regs),
34-
&(uefi_ctx->vcpu_regs.gprs), sizeof(struct acrn_gp_regs));
34+
&(depri_boot_ctx->vcpu_regs.gprs), sizeof(struct acrn_gp_regs));
3535

36-
vcpu_regs->rip = uefi_ctx->vcpu_regs.rip;
36+
vcpu_regs->rip = depri_boot_ctx->vcpu_regs.rip;
3737
set_vcpu_regs(vcpu, vcpu_regs);
3838

3939
/* defer irq enabling till vlapic is ready */
@@ -42,9 +42,9 @@ static int32_t uefi_sw_loader(struct acrn_vm *vm)
4242
return ret;
4343
}
4444

45-
int32_t uefi_init_vm_boot_info(__unused struct acrn_vm *vm)
45+
int32_t init_depri_vboot_info(__unused struct acrn_vm *vm)
4646
{
47-
vm_sw_loader = uefi_sw_loader;
47+
vm_sw_loader = depri_boot_sw_loader;
4848

4949
return 0;
5050
}

0 commit comments

Comments
 (0)