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 guest kernel only. Linux
kernel bzImage boot protocol guarantees its load address to be high than
GPA 8K so the 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 8af704beec
commit f44fb6856b
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) { if (ret == 0) {
/* Currently VM bootargs only support Linux kernel bzImage format */
if (vm->sw.kernel_type == KERNEL_BZIMAGE) {
init_vm_bootargs_info(vm, mbi); init_vm_bootargs_info(vm, mbi);
}
/* check whether there is a ramdisk module */ /* check whether there is a ramdisk module */
mod = get_mod_by_tag(mbi, vm_config->os_config.ramdisk_mod_tag); mod = get_mod_by_tag(mbi, vm_config->os_config.ramdisk_mod_tag);
if (mod != NULL) { if (mod != NULL) {

View File

@ -212,7 +212,7 @@ int32_t vm_sw_loader(struct acrn_vm *vm)
ramdisk_info->size); ramdisk_info->size);
} }
/* Copy Guest OS bootargs to its load location */ /* 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, (void)copy_to_gpa(vm, bootargs_info->src_addr,
(uint64_t)bootargs_info->load_addr, (uint64_t)bootargs_info->load_addr,
(strnlen_s((char *)bootargs_info->src_addr, MAX_BOOTARGS_SIZE) + 1U)); (strnlen_s((char *)bootargs_info->src_addr, MAX_BOOTARGS_SIZE) + 1U));