HV: move sos bootargs to vm configurations

Previously the bootargs of SOS_VM is stored in a text file and stitched
into multiboot mods[0].string whereas the bootargs of PRE_LAUNCHED_VM is
stored in vm_configurations.c. Given the mods[].string will be used to
store Kernel image signature under hybrid mode, move the bootargs of SOS_VM
to vm configurations also to make it consistent with PRE_LAUNCHED_VM;

Tracked-On: #3214

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 2019-06-02 23:33:24 +08:00 committed by wenlingz
parent 8256ba2015
commit d0fa83b2cb
11 changed files with 102 additions and 10 deletions

View File

@ -10,6 +10,27 @@
#define ROOTFS_0 "root=/dev/sda3 "
#define ROOTFS_1 "root=/dev/mmcblk1p1 "
#define SOS_ROOTFS ROOTFS_1
#define SOS_CONSOLE "console=ttyS2 "
#ifndef CONFIG_RELEASE
#define BOOTARG_DEBUG "hvlog=2M@0x6de00000 " \
"memmap=0x400000$0x6da00000 " \
"ramoops.mem_address=0x6da00000 " \
"ramoops.mem_size=0x400000 " \
"ramoops.console_size=0x200000 " \
"reboot_panic=p,w "
#else
#define BOOTARG_DEBUG ""
#endif
#define SOS_BOOTARGS_DIFF BOOTARG_DEBUG \
"module_blacklist=dwc3_pci " \
"i915.enable_initial_modeset=1 " \
"i915.enable_guc=0x02 " \
"video=DP-1:d " \
"video=DP-2:d " \
"cma=64M@0- " \
"panic_print=0x1f"
#endif /* MISC_CFG_H */

View File

@ -10,6 +10,23 @@
#define ROOTFS_0 "root=/dev/sda3 "
#define ROOTFS_1 "root=/dev/mmcblk0p1 "
#define SOS_ROOTFS ROOTFS_1
#define SOS_CONSOLE "console=ttyS0 "
#ifndef CONFIG_RELEASE
#define BOOTARG_DEBUG "hvlog=2M@0x6de00000 " \
"memmap=0x400000$0x6da00000 " \
"ramoops.mem_address=0x6da00000 " \
"ramoops.mem_size=0x400000 " \
"ramoops.console_size=0x200000 " \
"reboot_panic=p,w "
#else
#define BOOTARG_DEBUG ""
#endif
#define SOS_BOOTARGS_DIFF BOOTARG_DEBUG \
"module_blacklist=dwc3_pci " \
"i915.enable_guc=0x02 " \
"cma=64M@0- "
#endif /* MISC_CFG_H */

View File

@ -9,6 +9,13 @@
#define ROOTFS_0 "root=/dev/sda3 "
#define SOS_ROOTFS ROOTFS_0
#define SOS_CONSOLE "console=ttyS0 "
#ifndef CONFIG_RELEASE
#define SOS_BOOTARGS_DIFF "hvlog=2M@0x1FE00000"
#else
#define SOS_BOOTARGS_DIFF ""
#endif
#endif /* MISC_CFG_H */

View File

@ -10,6 +10,13 @@
#define ROOTFS_0 "root=/dev/sda3 "
#define ROOTFS_1 "root=/dev/mmcblk0p1 "
#define SOS_ROOTFS ROOTFS_0
#define SOS_CONSOLE "console=ttyS0 "
#ifndef CONFIG_RELEASE
#define SOS_BOOTARGS_DIFF "hvlog=2M@0x1FE00000"
#else
#define SOS_BOOTARGS_DIFF ""
#endif
#endif /* MISC_CFG_H */

View File

@ -9,6 +9,13 @@
#define ROOTFS_0 "root=/dev/sda3 "
#define SOS_ROOTFS ROOTFS_0
#define SOS_CONSOLE "console=ttyS0 "
#ifndef CONFIG_RELEASE
#define SOS_BOOTARGS_DIFF "hvlog=2M@0x1FE00000"
#else
#define SOS_BOOTARGS_DIFF ""
#endif
#endif /* MISC_CFG_H */

View File

@ -10,6 +10,13 @@
#define ROOTFS_0 "root=/dev/sda3 "
#define ROOTFS_1 "root=/dev/nvme0n1p3 "
#define SOS_ROOTFS ROOTFS_0
#define SOS_CONSOLE "console=ttyS0 "
#ifndef CONFIG_RELEASE
#define SOS_BOOTARGS_DIFF "hvlog=2M@0x1FE00000"
#else
#define SOS_BOOTARGS_DIFF ""
#endif
#endif /* MISC_CFG_H */

View File

@ -130,7 +130,7 @@ static void merge_cmdline(const struct acrn_vm *vm, const char *cmdline, const c
dst_avail -= 1U;
cmd_dst += 1U;
/* copy mods[].mm_string */
/* copy vm_config->os_config.bootargs */
(void)strncpy_s(cmd_dst, dst_avail, cmdstr, cmdstr_len);
}
}
@ -189,13 +189,11 @@ static int32_t init_general_vm_boot_info(struct acrn_vm *vm)
dev_dbg(ACRN_DBG_BOOT, "mod counts=%d\n", mbi->mi_mods_count);
/* mod[0] is for kernel&cmdline, other mod for ramdisk/firmware info*/
/* mod[0] is for kernel, other mod for ramdisk/firmware info*/
mods = (struct multiboot_module *)hpa2hva((uint64_t)mbi->mi_mods_addr);
dev_dbg(ACRN_DBG_BOOT, "mod0 start=0x%x, end=0x%x",
mods[0].mm_mod_start, mods[0].mm_mod_end);
dev_dbg(ACRN_DBG_BOOT, "cmd addr=0x%x, str=%s", mods[0].mm_string,
(char *)(uint64_t)mods[0].mm_string);
vm->sw.kernel_type = vm_config->os_config.kernel_type;
vm->sw.kernel_info.kernel_src_addr = hpa2hva((uint64_t)mods[0].mm_mod_start);
@ -210,20 +208,18 @@ static int32_t init_general_vm_boot_info(struct acrn_vm *vm)
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) {
/*
* If there is cmdline from mbi->mi_cmdline, merge it with
* mods[0].mm_string
* vm_config->os_config.bootargs
*/
merge_cmdline(vm, hpa2hva((uint64_t)mbi->mi_cmdline),
hpa2hva((uint64_t)mods[0].mm_string));
vm_config->os_config.bootargs);
vm->sw.bootargs_info.src_addr = kernel_cmdline;
vm->sw.bootargs_info.size =
strnlen_s(kernel_cmdline, MAX_BOOTARGS_SIZE);
} else {
vm->sw.bootargs_info.src_addr =
hpa2hva((uint64_t)mods[0].mm_string);
vm->sw.bootargs_info.src_addr = vm_config->os_config.bootargs;
vm->sw.bootargs_info.size =
strnlen_s(hpa2hva((uint64_t)mods[0].mm_string),
MAX_BOOTARGS_SIZE);
strnlen_s(vm_config->os_config.bootargs, MAX_BOOTARGS_SIZE);
}
}

View File

@ -23,6 +23,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
.os_config = {
.name = "ACRN Service OS",
.kernel_type = KERNEL_BZIMAGE,
.bootargs = SOS_VM_BOOTARGS
},
.vuart[0] = {
.type = VUART_LEGACY_PIO,

View File

@ -7,11 +7,25 @@
#ifndef VM_CONFIGURATIONS_H
#define VM_CONFIGURATIONS_H
#include <misc_cfg.h>
#define CONFIG_MAX_VM_NUM 4U
/* Bits mask of guest flags that can be programmed by device model. Other bits are set by hypervisor only */
#define DM_OWNED_GUEST_FLAG_MASK (GUEST_FLAG_SECURE_WORLD_ENABLED | GUEST_FLAG_LAPIC_PASSTHROUGH | \
GUEST_FLAG_RT | GUEST_FLAG_IO_COMPLETION_POLLING)
#define SOS_VM_BOOTARGS SOS_ROOTFS \
"rw rootwait " \
"console=tty0 " \
SOS_CONSOLE \
"consoleblank=0 " \
"no_timer_check " \
"quiet loglevel=3 " \
"i915.nuclear_pageflip=1 " \
"i915.avail_planes_per_pipe=0x01010F " \
"i915.domain_plane_owners=0x011111110000 " \
"i915.enable_gvt=1 " \
SOS_BOOTARGS_DIFF
#endif /* VM_CONFIGURATIONS_H */

View File

@ -25,6 +25,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
.os_config = {
.name = "ACRN Service OS",
.kernel_type = KERNEL_BZIMAGE,
.bootargs = SOS_VM_BOOTARGS,
},
.vuart[0] = {
.type = VUART_LEGACY_PIO,

View File

@ -7,11 +7,25 @@
#ifndef VM_CONFIGURATIONS_H
#define VM_CONFIGURATIONS_H
#include <misc_cfg.h>
#define CONFIG_MAX_VM_NUM 2U
/* Bits mask of guest flags that can be programmed by device model. Other bits are set by hypervisor only */
#define DM_OWNED_GUEST_FLAG_MASK (GUEST_FLAG_SECURE_WORLD_ENABLED | GUEST_FLAG_LAPIC_PASSTHROUGH | \
GUEST_FLAG_RT | GUEST_FLAG_IO_COMPLETION_POLLING)
#define SOS_VM_BOOTARGS SOS_ROOTFS \
"rw rootwait " \
"console=tty0 " \
SOS_CONSOLE \
"consoleblank=0 " \
"no_timer_check " \
"quiet loglevel=3 " \
"i915.nuclear_pageflip=1 " \
"i915.avail_planes_per_pipe=0x01010F " \
"i915.domain_plane_owners=0x011111110000 " \
"i915.enable_gvt=1 " \
SOS_BOOTARGS_DIFF
#endif /* VM_CONFIGURATIONS_H */