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 <victor.sun@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
This commit is contained in:
Victor Sun 2021-06-07 09:15:09 +08:00 committed by wenlingz
parent 8f24d91108
commit e8f726e321
7 changed files with 5 additions and 34 deletions

View File

@ -45,9 +45,7 @@ static uint32_t parse_seed_arg(void)
uint32_t i = SEED_ARG_NUM - 1U; uint32_t i = SEED_ARG_NUM - 1U;
uint32_t len; 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) { if (cmd_src != NULL) {
for (i = 0U; seed_arg[i].str != NULL; i++) { for (i = 0U; seed_arg[i].str != NULL; i++) {

View File

@ -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 * 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. * (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, if (strncat_s((char *)vm->sw.bootargs_info.src_addr, MAX_BOOTARGS_SIZE,
abi->mi_cmdline, (MAX_BOOTARGS_SIZE - 1U)) != 0) { abi->mi_cmdline, (MAX_BOOTARGS_SIZE - 1U)) != 0) {
pr_err("failed to merge mbi cmdline to SOS bootargs!"); pr_err("failed to merge mbi cmdline to SOS bootargs!");

View File

@ -26,7 +26,6 @@
#include <vm_configurations.h> #include <vm_configurations.h>
struct acrn_boot_info { struct acrn_boot_info {
uint32_t mi_flags; /* the flags is back-compatible with multiboot1 */
const char *mi_cmdline; const char *mi_cmdline;
const char *mi_loader_name; const char *mi_loader_name;

View File

@ -21,7 +21,6 @@ void init_acrn_boot_info(uint32_t magic, uint32_t info)
if (boot_from_multiboot1(magic, info)) { if (boot_from_multiboot1(magic, info)) {
struct multiboot_info *mbi = (struct multiboot_info *)(hpa2hva_early((uint64_t)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_addr = mbi->mi_drives_addr;
acrn_bi.mi_drives_length = mbi->mi_drives_length; acrn_bi.mi_drives_length = mbi->mi_drives_length;
acrn_bi.mi_cmdline = (char *)hpa2hva_early((uint64_t)mbi->mi_cmdline); 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 #endif
acrn_bi.mi_flags |= MULTIBOOT_INFO_HAS_MMAP;
} else { } else {
acrn_bi.mi_flags &= ~MULTIBOOT_INFO_HAS_MMAP; abi_status = -EINVAL;
} }
if (acrn_bi.mi_mods_count > MAX_MODULE_NUM) { 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, (const void *)acrn_bi.mi_mods_va,
(acrn_bi.mi_mods_count * sizeof(struct multiboot_module))); (acrn_bi.mi_mods_count * sizeof(struct multiboot_module)));
} }
acrn_bi.mi_flags |= MULTIBOOT_INFO_HAS_MODS;
} else { } 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"); pr_err("no multiboot module info found");
abi_status = -EINVAL; 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 #ifdef CONFIG_MULTIBOOT2
if (boot_from_multiboot2(magic)) { if (boot_from_multiboot2(magic)) {
if (acrn_bi.mi_efi_info.efi_memmap_hi != 0U) { if (acrn_bi.mi_efi_info.efi_memmap_hi != 0U) {
pr_err("the EFI mmap address should be less than 4G!"); pr_err("the EFI mmap address should be less than 4G!");
acrn_bi.mi_flags &= ~MULTIBOOT_INFO_HAS_EFI_MMAP;
abi_status = -EINVAL; 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 #endif
@ -124,7 +107,6 @@ int32_t sanitize_acrn_boot_info(uint32_t magic, uint32_t info)
/* /*
* @post retval != NULL * @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) * @post (retval->mi_mmap_entries > 0U) && (retval->mi_mmap_entries <= MAX_MMAP_ENTRIES)
*/ */
struct acrn_boot_info *get_acrn_boot_info(void) struct acrn_boot_info *get_acrn_boot_info(void)

View File

@ -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" */ 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 = (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_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 = (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_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_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) { switch (mb2_tag->type) {
case MULTIBOOT2_TAG_TYPE_CMDLINE: case MULTIBOOT2_TAG_TYPE_CMDLINE:
abi->mi_cmdline = ((struct multiboot2_tag_string *)mb2_tag)->string; abi->mi_cmdline = ((struct multiboot2_tag_string *)mb2_tag)->string;
abi->mi_flags |= MULTIBOOT_INFO_HAS_CMDLINE;
break; break;
case MULTIBOOT2_TAG_TYPE_MMAP: case MULTIBOOT2_TAG_TYPE_MMAP:
mb2_mmap_to_abi(abi, (const struct multiboot2_tag_mmap *)mb2_tag); mb2_mmap_to_abi(abi, (const struct multiboot2_tag_mmap *)mb2_tag);

View File

@ -7,10 +7,6 @@
#ifndef MULTIBOOT_PRIV_H #ifndef MULTIBOOT_PRIV_H
#define 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 #ifdef CONFIG_MULTIBOOT2
/* /*
* @post boot_regs[1] stores the address pointer that point to a valid multiboot2 info * @post boot_regs[1] stores the address pointer that point to a valid multiboot2 info

View File

@ -31,9 +31,7 @@ static void parse_hvdbg_cmdline(void)
const char *end = NULL; const char *end = NULL;
struct acrn_boot_info *abi = get_acrn_boot_info(); 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 != NULL) && ((*start) != '\0')) {
while ((*start) == ' ') while ((*start) == ' ')