From 56c52d0b952a838c25a980921dc7c55a482e12bb Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Thu, 27 May 2021 11:37:49 +0800 Subject: [PATCH] HV: modularization: remove mi_flags from acrn boot info The mi_flags is not needed any more so remove it from acrn_boot_info struct; Tracked-On: #5661 Signed-off-by: Victor Sun Reviewed-by: Jason Chen CJ --- hypervisor/arch/x86/seed/seed.c | 4 +--- hypervisor/boot/boot.c | 24 +++++----------------- hypervisor/boot/guest/vboot_info.c | 2 +- hypervisor/boot/include/boot.h | 1 - hypervisor/boot/multiboot/multiboot.c | 1 - hypervisor/boot/multiboot/multiboot2.c | 4 +--- hypervisor/boot/multiboot/multiboot_priv.h | 4 ---- hypervisor/debug/console.c | 4 +--- 8 files changed, 9 insertions(+), 35 deletions(-) diff --git a/hypervisor/arch/x86/seed/seed.c b/hypervisor/arch/x86/seed/seed.c index c0b06fc42..c2b618133 100644 --- a/hypervisor/arch/x86/seed/seed.c +++ b/hypervisor/arch/x86/seed/seed.c @@ -45,9 +45,7 @@ static uint32_t parse_seed_arg(void) uint32_t i = SEED_ARG_NUM - 1U; uint32_t len; - if ((abi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) { - cmd_src = abi->mi_cmdline; - } + cmd_src = abi->mi_cmdline; if (cmd_src != NULL) { for (i = 0U; seed_arg[i].str != NULL; i++) { diff --git a/hypervisor/boot/boot.c b/hypervisor/boot/boot.c index 5a8e06e10..5fd6272dd 100644 --- a/hypervisor/boot/boot.c +++ b/hypervisor/boot/boot.c @@ -10,7 +10,6 @@ #include #include #include -#include "multiboot/multiboot_priv.h" static struct acrn_boot_info acrn_bi = { 0U }; static char boot_protocol_name[16U] = { 0 }; @@ -30,30 +29,18 @@ int32_t sanitize_acrn_boot_info(struct acrn_boot_info *abi) { int32_t abi_status = 0; - if (abi->mi_mmap_entries != 0U) { - abi->mi_flags |= MULTIBOOT_INFO_HAS_MMAP; - } else { - abi->mi_flags &= ~MULTIBOOT_INFO_HAS_MMAP; - } - - if (abi->mi_mods_count != 0U) { - abi->mi_flags |= MULTIBOOT_INFO_HAS_MODS; - } else { - abi->mi_flags &= ~MULTIBOOT_INFO_HAS_MODS; - } - - if ((abi->mi_flags & MULTIBOOT_INFO_HAS_MODS) == 0U) { - pr_err("no multiboot module info found"); + if (abi->mi_mods_count == 0U) { + pr_err("no boot module info found"); abi_status = -EINVAL; } - if ((abi->mi_flags & MULTIBOOT_INFO_HAS_MMAP) == 0U) { - pr_err("wrong multiboot flags: 0x%08x", abi->mi_flags); + if (abi->mi_mmap_entries == 0U) { + pr_err("no boot mmap info found"); abi_status = -EINVAL; } #ifdef CONFIG_MULTIBOOT2 - if ((abi->mi_flags & (MULTIBOOT_INFO_HAS_EFI64 | MULTIBOOT_INFO_HAS_EFI_MMAP)) == 0U) { + if ((abi->mi_efi_info.efi_systab == 0U) && (abi->mi_efi_info.efi_systab_hi == 0U)) { pr_err("no multiboot2 uefi info found!"); } #endif @@ -70,7 +57,6 @@ int32_t sanitize_acrn_boot_info(struct acrn_boot_info *abi) /* * @post retval != NULL - * @post retval->mi_flags & MULTIBOOT_INFO_HAS_MMAP != 0U * @post (retval->mi_mmap_entries > 0U) && (retval->mi_mmap_entries <= MAX_MMAP_ENTRIES) */ struct acrn_boot_info *get_acrn_boot_info(void) diff --git a/hypervisor/boot/guest/vboot_info.c b/hypervisor/boot/guest/vboot_info.c index 4a36776ec..16e222ad3 100644 --- a/hypervisor/boot/guest/vboot_info.c +++ b/hypervisor/boot/guest/vboot_info.c @@ -140,7 +140,7 @@ static void init_vm_bootargs_info(struct acrn_vm *vm, const struct acrn_boot_inf * This is very helpful when one of configured bootargs need to be revised at GRUB runtime * (e.g. "root="), since the later one would override the previous one if multiple bootargs exist. */ - if (((abi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) && (*(abi->mi_cmdline) != '\0')) { + if ((abi->mi_cmdline != NULL) && (*(abi->mi_cmdline) != '\0')) { if (strncat_s((char *)vm->sw.bootargs_info.src_addr, MAX_BOOTARGS_SIZE, abi->mi_cmdline, (MAX_BOOTARGS_SIZE - 1U)) != 0) { pr_err("failed to merge mbi cmdline to SOS bootargs!"); diff --git a/hypervisor/boot/include/boot.h b/hypervisor/boot/include/boot.h index 34745ec0e..4d00dd0fc 100644 --- a/hypervisor/boot/include/boot.h +++ b/hypervisor/boot/include/boot.h @@ -23,7 +23,6 @@ #define ACPI_MODULE_SIZE MEM_1M struct acrn_boot_info { - uint32_t mi_flags; /* the flags is back-compatible with multiboot1 */ const char *mi_cmdline; const char *mi_loader_name; diff --git a/hypervisor/boot/multiboot/multiboot.c b/hypervisor/boot/multiboot/multiboot.c index 9876f8e26..9c3d3d92f 100644 --- a/hypervisor/boot/multiboot/multiboot.c +++ b/hypervisor/boot/multiboot/multiboot.c @@ -18,7 +18,6 @@ int32_t multiboot_to_acrn_bi(struct acrn_boot_info *abi, void *mb_info) { struct multiboot_mmap *mmap = (struct multiboot_mmap *)hpa2hva_early((uint64_t)mbi->mi_mmap_addr); struct multiboot_module *mods = (struct multiboot_module *)hpa2hva_early((uint64_t)mbi->mi_mods_addr); - abi->mi_flags = mbi->mi_flags; abi->mi_cmdline = (char *)hpa2hva_early((uint64_t)mbi->mi_cmdline); abi->mi_loader_name = (char *)hpa2hva_early((uint64_t)mbi->mi_loader_name); abi->mi_mmap_entries = mbi->mi_mmap_length / sizeof(struct multiboot_mmap); diff --git a/hypervisor/boot/multiboot/multiboot2.c b/hypervisor/boot/multiboot/multiboot2.c index 119bb8513..b40024c38 100644 --- a/hypervisor/boot/multiboot/multiboot2.c +++ b/hypervisor/boot/multiboot/multiboot2.c @@ -51,8 +51,8 @@ static void mb2_efi64_to_abi(struct acrn_boot_info *abi, const struct multiboot2 { const uint32_t efiloader_sig = 0x34364c45; /* "EL64" */ abi->mi_efi_info.efi_systab = (uint32_t)(uint64_t)mb2_tag_efi64->pointer; + abi->mi_efi_info.efi_systab_hi = (uint32_t)((uint64_t)mb2_tag_efi64->pointer >> 32U); abi->mi_efi_info.efi_loader_signature = efiloader_sig; - abi->mi_flags |= MULTIBOOT_INFO_HAS_EFI64; } /** @@ -66,7 +66,6 @@ static void mb2_efimmap_to_abi(struct acrn_boot_info *abi, abi->mi_efi_info.efi_memmap = (uint32_t)(uint64_t)mb2_tag_efimmap->efi_mmap; abi->mi_efi_info.efi_memmap_size = mb2_tag_efimmap->size - 16U; abi->mi_efi_info.efi_memmap_hi = (uint32_t)(((uint64_t)mb2_tag_efimmap->efi_mmap) >> 32U); - abi->mi_flags |= MULTIBOOT_INFO_HAS_EFI_MMAP; } /** @@ -87,7 +86,6 @@ int32_t multiboot2_to_acrn_bi(struct acrn_boot_info *abi, void *mb2_info) switch (mb2_tag->type) { case MULTIBOOT2_TAG_TYPE_CMDLINE: abi->mi_cmdline = ((struct multiboot2_tag_string *)mb2_tag)->string; - abi->mi_flags |= MULTIBOOT_INFO_HAS_CMDLINE; break; case MULTIBOOT2_TAG_TYPE_MMAP: mb2_mmap_to_abi(abi, (const struct multiboot2_tag_mmap *)mb2_tag); diff --git a/hypervisor/boot/multiboot/multiboot_priv.h b/hypervisor/boot/multiboot/multiboot_priv.h index 4edfbbb1d..75a4f4f04 100644 --- a/hypervisor/boot/multiboot/multiboot_priv.h +++ b/hypervisor/boot/multiboot/multiboot_priv.h @@ -7,10 +7,6 @@ #ifndef MULTIBOOT_PRIV_H #define MULTIBOOT_PRIV_H -/* extended flags for acrn multiboot info from multiboot2 */ -#define MULTIBOOT_INFO_HAS_EFI_MMAP 0x00010000U -#define MULTIBOOT_INFO_HAS_EFI64 0x00020000U - static inline bool boot_from_multiboot(uint32_t magic, uint32_t info) { return ((magic == MULTIBOOT_INFO_MAGIC) && (info != 0U)); diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c index f6ec147d1..7fb7adc59 100644 --- a/hypervisor/debug/console.c +++ b/hypervisor/debug/console.c @@ -31,9 +31,7 @@ static void parse_hvdbg_cmdline(void) const char *end = NULL; struct acrn_boot_info *abi = get_acrn_boot_info(); - if ((abi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) { - start = abi->mi_cmdline; - } + start = abi->mi_cmdline; while ((start != NULL) && ((*start) != '\0')) { while ((*start) == ' ')