mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-30 06:54:48 +00:00
hv: Fix for PARTITION_MODE compilation
This patch fixes compilation issue for PARTITION_MODE. Tracked-On: #1404 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
This commit is contained in:
parent
eebccac2a7
commit
5b28b37842
@ -434,7 +434,7 @@ int prepare_vm(uint16_t pcpu_id)
|
||||
int ret = 0;
|
||||
uint16_t i;
|
||||
struct vm *vm = NULL;
|
||||
const struct vm_description *vm_desc = NULL;
|
||||
struct vm_description *vm_desc = NULL;
|
||||
bool is_vm_bsp;
|
||||
|
||||
vm_desc = pcpu_vm_desc_map[pcpu_id].vm_desc_ptr;
|
||||
|
@ -15,6 +15,54 @@
|
||||
|
||||
#define MAX_BOOT_PARAMS_LEN 64U
|
||||
|
||||
#ifdef CONFIG_PARTITION_MODE
|
||||
int init_vm_boot_info(struct vm *vm)
|
||||
{
|
||||
struct multiboot_module *mods = NULL;
|
||||
struct multiboot_info *mbi = NULL;
|
||||
|
||||
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC) {
|
||||
ASSERT(false, "no multiboot info found");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mbi = hpa2hva((uint64_t)boot_regs[1]);
|
||||
|
||||
dev_dbg(ACRN_DBG_BOOT, "Multiboot detected, flag=0x%x", mbi->mi_flags);
|
||||
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_MODS) == 0U) {
|
||||
ASSERT(false, "no kernel info found");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
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*/
|
||||
mods = (struct multiboot_module *)(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_LINUX_GUEST;
|
||||
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 = (void *)(16 * 1024 * 1024UL);
|
||||
|
||||
vm->sw.linux_info.bootargs_src_addr =
|
||||
(void *)vm->vm_desc->bootargs;
|
||||
vm->sw.linux_info.bootargs_size =
|
||||
strnlen_s(vm->vm_desc->bootargs, MEM_2K);
|
||||
|
||||
vm->sw.linux_info.bootargs_load_addr = (void *)(vm->vm_desc->mem_size - 8*1024UL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
static const char *boot_params_arg = "ImageBootParamsAddr=";
|
||||
|
||||
struct image_boot_params {
|
||||
@ -187,53 +235,6 @@ fail:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PARTITION_MODE
|
||||
int init_vm_boot_info(struct vm *vm)
|
||||
{
|
||||
struct multiboot_module *mods = NULL;
|
||||
struct multiboot_info *mbi = NULL;
|
||||
|
||||
if (boot_regs[0] != MULTIBOOT_INFO_MAGIC) {
|
||||
ASSERT(false, "no multiboot info found");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mbi = hpa2hva((uint64_t)boot_regs[1]);
|
||||
|
||||
dev_dbg(ACRN_DBG_BOOT, "Multiboot detected, flag=0x%x", mbi->mi_flags);
|
||||
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_MODS) == 0U) {
|
||||
ASSERT(false, "no kernel info found");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
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*/
|
||||
mods = (struct multiboot_module *)(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_LINUX_GUEST;
|
||||
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 = (void *)(16 * 1024 * 1024UL);
|
||||
|
||||
vm->sw.linux_info.bootargs_src_addr =
|
||||
vm->vm_desc->bootargs;
|
||||
vm->sw.linux_info.bootargs_size =
|
||||
strnlen_s(vm->vm_desc->bootargs, MEM_2K);
|
||||
|
||||
vm->sw.linux_info.bootargs_load_addr = (void *)(vm->vm_desc->mem_size - 8*1024UL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
/**
|
||||
* @param[inout] vm pointer to a vm descriptor
|
||||
*
|
||||
|
@ -285,11 +285,11 @@ extern spinlock_t vm_list_lock;
|
||||
#ifdef CONFIG_PARTITION_MODE
|
||||
struct vm_description_array {
|
||||
int num_vm_desc;
|
||||
const struct vm_description vm_desc_array[];
|
||||
struct vm_description vm_desc_array[];
|
||||
};
|
||||
|
||||
struct pcpu_vm_desc_mapping {
|
||||
const struct vm_descriptin *vm_desc_ptr;
|
||||
struct vm_description *vm_desc_ptr;
|
||||
bool is_bsp;
|
||||
};
|
||||
extern const struct pcpu_vm_desc_mapping pcpu_vm_desc_map[];
|
||||
|
@ -157,7 +157,7 @@ static struct vpci_vdev_array vpci_vdev_array2 = {
|
||||
/*******************************/
|
||||
/* User Defined VM definitions */
|
||||
/*******************************/
|
||||
const struct vm_description_array vm_desc_partition = {
|
||||
struct vm_description_array vm_desc_partition = {
|
||||
/* Number of user virtual machines */
|
||||
.num_vm_desc = NUM_USER_VMS,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user