HV: init VM bootargs only for LaaG

Currently the VM bootargs load address is hard-coded at 8KB right before
kernel load address, this should work for Linux kernel only since Linux
kernel is guaranteed to be loadered high than GPA 8K so its load address
would never be overflowed, other OS like Zephyr has no such assumption.

Tracked-On: #5689

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-02-02 15:43:40 +08:00 committed by wenlingz
parent 3310412148
commit 6bb7a45672
2 changed files with 5 additions and 2 deletions

View File

@ -225,7 +225,10 @@ static int32_t init_vm_sw_load(struct acrn_vm *vm, const struct acrn_multiboot_i
}
if (ret == 0) {
init_vm_bootargs_info(vm, mbi);
/* Currently VM bootargs only support Linux guest */
if (vm->sw.kernel_type == KERNEL_BZIMAGE) {
init_vm_bootargs_info(vm, mbi);
}
/* check whether there is a ramdisk module */
mod = get_mod_by_tag(mbi, vm_config->os_config.ramdisk_mod_tag);
if (mod != NULL) {

View File

@ -212,7 +212,7 @@ int32_t vm_sw_loader(struct acrn_vm *vm)
ramdisk_info->size);
}
/* Copy Guest OS bootargs to its load location */
if (bootargs_info->size != 0U) {
if ((bootargs_info->size != 0U) && (bootargs_info->load_addr != NULL)) {
(void)copy_to_gpa(vm, bootargs_info->src_addr,
(uint64_t)bootargs_info->load_addr,
(strnlen_s((char *)bootargs_info->src_addr, MAX_BOOTARGS_SIZE) + 1U));