From e8f726e3217e30085de58188b7a3593ba2d5c70b Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Mon, 7 Jun 2021 09:15:09 +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/guest/vboot_info.c | 2 +- hypervisor/boot/include/multiboot.h | 1 - hypervisor/boot/multiboot/multiboot.c | 20 +------------------- hypervisor/boot/multiboot/multiboot2.c | 4 +--- hypervisor/boot/multiboot/multiboot_priv.h | 4 ---- hypervisor/debug/console.c | 4 +--- 7 files changed, 5 insertions(+), 34 deletions(-) diff --git a/hypervisor/arch/x86/seed/seed.c b/hypervisor/arch/x86/seed/seed.c index 3e88d21fa..64c98389a 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/guest/vboot_info.c b/hypervisor/boot/guest/vboot_info.c index 1a3122711..39d35cd36 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/multiboot.h b/hypervisor/boot/include/multiboot.h index c6b56b118..e55bade69 100644 --- a/hypervisor/boot/include/multiboot.h +++ b/hypervisor/boot/include/multiboot.h @@ -26,7 +26,6 @@ #include 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 ea5a2b826..2503345e0 100644 --- a/hypervisor/boot/multiboot/multiboot.c +++ b/hypervisor/boot/multiboot/multiboot.c @@ -21,7 +21,6 @@ void init_acrn_boot_info(uint32_t magic, uint32_t info) if (boot_from_multiboot1(magic, info)) { struct multiboot_info *mbi = (struct multiboot_info *)(hpa2hva_early((uint64_t)info)); - acrn_bi.mi_flags = mbi->mi_flags; acrn_bi.mi_drives_addr = mbi->mi_drives_addr; acrn_bi.mi_drives_length = mbi->mi_drives_length; acrn_bi.mi_cmdline = (char *)hpa2hva_early((uint64_t)mbi->mi_cmdline); @@ -67,9 +66,8 @@ int32_t sanitize_acrn_boot_info(uint32_t magic, uint32_t info) } } #endif - acrn_bi.mi_flags |= MULTIBOOT_INFO_HAS_MMAP; } else { - acrn_bi.mi_flags &= ~MULTIBOOT_INFO_HAS_MMAP; + abi_status = -EINVAL; } if (acrn_bi.mi_mods_count > MAX_MODULE_NUM) { @@ -83,32 +81,17 @@ int32_t sanitize_acrn_boot_info(uint32_t magic, uint32_t info) (const void *)acrn_bi.mi_mods_va, (acrn_bi.mi_mods_count * sizeof(struct multiboot_module))); } - acrn_bi.mi_flags |= MULTIBOOT_INFO_HAS_MODS; } else { - acrn_bi.mi_flags &= ~MULTIBOOT_INFO_HAS_MODS; - } - - if ((acrn_bi.mi_flags & MULTIBOOT_INFO_HAS_MODS) == 0U) { pr_err("no multiboot module info found"); abi_status = -EINVAL; } - if ((acrn_bi.mi_flags & MULTIBOOT_INFO_HAS_MMAP) == 0U) { - pr_err("wrong multiboot flags: 0x%08x", acrn_bi.mi_flags); - abi_status = -EINVAL; - } - #ifdef CONFIG_MULTIBOOT2 if (boot_from_multiboot2(magic)) { if (acrn_bi.mi_efi_info.efi_memmap_hi != 0U) { pr_err("the EFI mmap address should be less than 4G!"); - acrn_bi.mi_flags &= ~MULTIBOOT_INFO_HAS_EFI_MMAP; abi_status = -EINVAL; } - - if ((acrn_bi.mi_flags & (MULTIBOOT_INFO_HAS_EFI64 | MULTIBOOT_INFO_HAS_EFI_MMAP)) == 0U) { - pr_err("no multiboot2 uefi info found!"); - } } #endif @@ -124,7 +107,6 @@ int32_t sanitize_acrn_boot_info(uint32_t magic, uint32_t info) /* * @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/multiboot/multiboot2.c b/hypervisor/boot/multiboot/multiboot2.c index 8e73a0a80..8b329913d 100644 --- a/hypervisor/boot/multiboot/multiboot2.c +++ b/hypervisor/boot/multiboot/multiboot2.c @@ -40,8 +40,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; } /** @@ -55,7 +55,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; } /** @@ -76,7 +75,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 e348b23ef..e5427dc39 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 - #ifdef CONFIG_MULTIBOOT2 /* * @post boot_regs[1] stores the address pointer that point to a valid multiboot2 info diff --git a/hypervisor/debug/console.c b/hypervisor/debug/console.c index 912701064..a6b5b5375 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) == ' ')