From 4702e743a8bf55ef51a037aa9360e19515025e82 Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Tue, 3 Aug 2021 14:51:32 +0800 Subject: [PATCH] HV: vm_load: change kernel type for zephyr image Previously we only support loading raw format of zephyr image as prelaunched Zephyr VM, this would cause guest F segment overridden issue because the zephyr raw image covers memory space from 0x1000 to 0x100000 upper. To fix this issue, we should support ELF format image loading so that parse and load the multiple segments from ELF image directly. Tracked-On: #6323 Signed-off-by: Victor Sun Acked-by: Eddie Dong --- hypervisor/boot/guest/vboot_info.c | 2 +- hypervisor/common/vm_load.c | 2 +- hypervisor/include/arch/x86/asm/vm_config.h | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hypervisor/boot/guest/vboot_info.c b/hypervisor/boot/guest/vboot_info.c index abf726200..278c959d1 100644 --- a/hypervisor/boot/guest/vboot_info.c +++ b/hypervisor/boot/guest/vboot_info.c @@ -61,7 +61,7 @@ static int32_t init_vm_kernel_info(struct acrn_vm *vm, const struct abi_module * if ((mod->start != NULL) && (mod->size != 0U)) { vm->sw.kernel_info.kernel_src_addr = mod->start; vm->sw.kernel_info.kernel_size = mod->size; - if ((vm->sw.kernel_type == KERNEL_BZIMAGE) || (vm->sw.kernel_type == KERNEL_ZEPHYR)) { + if ((vm->sw.kernel_type > 0) && (vm->sw.kernel_type < KERNEL_UNKNOWN)) { ret = 0; } else { pr_err("Unsupported Kernel type."); diff --git a/hypervisor/common/vm_load.c b/hypervisor/common/vm_load.c index 78b6a3957..d9e9d8ba7 100644 --- a/hypervisor/common/vm_load.c +++ b/hypervisor/common/vm_load.c @@ -493,7 +493,7 @@ int32_t vm_sw_loader(struct acrn_vm *vm) ret = vm_bzimage_loader(vm); - } else if (vm->sw.kernel_type == KERNEL_ZEPHYR){ + } else if (vm->sw.kernel_type == KERNEL_RAWIMAGE){ ret = vm_rawimage_loader(vm); diff --git a/hypervisor/include/arch/x86/asm/vm_config.h b/hypervisor/include/arch/x86/asm/vm_config.h index 016dc0401..d3d1c2402 100644 --- a/hypervisor/include/arch/x86/asm/vm_config.h +++ b/hypervisor/include/arch/x86/asm/vm_config.h @@ -110,6 +110,9 @@ struct vuart_config { enum os_kernel_type { KERNEL_BZIMAGE = 1, KERNEL_ZEPHYR, + KERNEL_RAWIMAGE, + KERNEL_ELF, + KERNEL_UNKNOWN, }; struct acrn_vm_os_config {