mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-29 22:47:21 +00:00
HV: make vm kernel type configurable
Different kernel has different load method, it should be configurable in vm configurations; 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:
parent
ae8893cba1
commit
bb55489e5c
@ -142,7 +142,7 @@ static void *get_kernel_load_addr(struct acrn_vm *vm)
|
||||
struct zero_page *zeropage;
|
||||
|
||||
switch (sw_info->kernel_type) {
|
||||
case VM_LINUX_GUEST:
|
||||
case KERNEL_BZIMAGE:
|
||||
/* According to the explaination for pref_address
|
||||
* in Documentation/x86/boot.txt, a relocating
|
||||
* bootloader should attempt to load kernel at pref_address
|
||||
@ -171,6 +171,7 @@ static int32_t init_general_vm_boot_info(struct acrn_vm *vm)
|
||||
{
|
||||
struct multiboot_module *mods = NULL;
|
||||
struct multiboot_info *mbi = NULL;
|
||||
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
|
||||
int32_t ret = -EINVAL;
|
||||
|
||||
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC) {
|
||||
@ -196,13 +197,11 @@ static int32_t init_general_vm_boot_info(struct acrn_vm *vm)
|
||||
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_LINUX_GUEST;
|
||||
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);
|
||||
vm->sw.kernel_info.kernel_size = mods[0].mm_mod_end - mods[0].mm_mod_start;
|
||||
vm->sw.kernel_info.kernel_load_addr = get_kernel_load_addr(vm);
|
||||
|
||||
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
|
||||
|
||||
if (vm_config->load_order == PRE_LAUNCHED_VM) {
|
||||
vm->sw.bootargs_info.src_addr = (void *)vm_config->os_config.bootargs;
|
||||
vm->sw.bootargs_info.size =
|
||||
|
@ -180,12 +180,14 @@ int32_t direct_boot_sw_loader(struct acrn_vm *vm)
|
||||
ramdisk_info->size);
|
||||
}
|
||||
|
||||
/* See if guest is a Linux guest */
|
||||
if (vm->sw.kernel_type == VM_LINUX_GUEST) {
|
||||
switch (vm->sw.kernel_type) {
|
||||
case KERNEL_BZIMAGE:
|
||||
prepare_loading_bzimage(vm, vcpu);
|
||||
} else {
|
||||
break;
|
||||
default:
|
||||
pr_err("%s, Loading VM SW failed", __func__);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
|
@ -50,7 +50,7 @@ struct sw_kernel_info {
|
||||
};
|
||||
|
||||
struct vm_sw_info {
|
||||
int32_t kernel_type; /* Guest kernel type */
|
||||
enum os_kernel_type kernel_type; /* Guest kernel type */
|
||||
/* Kernel information (common for all guest types) */
|
||||
struct sw_kernel_info kernel_info;
|
||||
struct sw_module_info bootargs_info;
|
||||
@ -69,9 +69,6 @@ struct vm_pm_info {
|
||||
struct pm_s_state_data *sx_state_data; /* data for S3/S5 implementation */
|
||||
};
|
||||
|
||||
/* VM guest types */
|
||||
#define VM_LINUX_GUEST 0x02
|
||||
#define VM_MONO_GUEST 0x01
|
||||
/* Enumerated type for VM states */
|
||||
enum vm_state {
|
||||
VM_POWERED_OFF = 0,
|
||||
|
@ -61,8 +61,13 @@ struct vuart_config {
|
||||
struct target_vuart t_vuart; /* target vuart */
|
||||
} __aligned(8);
|
||||
|
||||
enum os_kernel_type {
|
||||
KERNEL_BZIMAGE = 1,
|
||||
};
|
||||
|
||||
struct acrn_vm_os_config {
|
||||
char name[MAX_VM_OS_NAME_LEN]; /* OS name, useful for debug */
|
||||
enum os_kernel_type kernel_type; /* used for kernel specifc loading method */
|
||||
char bootargs[MAX_BOOTARGS_SIZE]; /* boot args/cmdline */
|
||||
} __aligned(8);
|
||||
|
||||
|
@ -22,6 +22,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
|
||||
},
|
||||
.os_config = {
|
||||
.name = "ACRN Service OS",
|
||||
.kernel_type = KERNEL_BZIMAGE,
|
||||
},
|
||||
.vuart[0] = {
|
||||
.type = VUART_LEGACY_PIO,
|
||||
|
@ -26,6 +26,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
|
||||
},
|
||||
.os_config = {
|
||||
.name = "ClearLinux",
|
||||
.kernel_type = KERNEL_BZIMAGE,
|
||||
.bootargs = VM0_CONFIG_OS_BOOTARG_CONSOLE \
|
||||
VM0_CONFIG_OS_BOOTARG_MAXCPUS \
|
||||
VM0_CONFIG_OS_BOOTARG_ROOT \
|
||||
@ -64,6 +65,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
|
||||
},
|
||||
.os_config = {
|
||||
.name = "ClearLinux",
|
||||
.kernel_type = KERNEL_BZIMAGE,
|
||||
.bootargs = VM1_CONFIG_OS_BOOTARG_CONSOLE \
|
||||
VM1_CONFIG_OS_BOOTARG_MAXCPUS \
|
||||
VM1_CONFIG_OS_BOOTARG_ROOT \
|
||||
|
@ -24,6 +24,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
|
||||
},
|
||||
.os_config = {
|
||||
.name = "ACRN Service OS",
|
||||
.kernel_type = KERNEL_BZIMAGE,
|
||||
},
|
||||
.vuart[0] = {
|
||||
.type = VUART_LEGACY_PIO,
|
||||
|
Loading…
Reference in New Issue
Block a user