HV: add acpi module support for pre-launched VM

Previously we use a pre-defined structure as vACPI table for pre-launched
VM, the structure is initialized by HV code. Now change the method to use a
pre-loaded multiboot module instead. The module file will be generated by
acrn-config tool and loaded to GPA 0x7ff00000, a hardcoded RSDP table at
GPA 0x000f2400 will point to the XSDT table which at GPA 0x7ff00080;

Tracked-On: #5266

Signed-off-by: Victor Sun <victor.sun@intel.com>
Signed-off-by: Shuang Zheng <shuang.zheng@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2020-09-02 15:42:20 +08:00
committed by Fuzhong Liu
parent 4290a79951
commit 34547e1e19
8 changed files with 67 additions and 3 deletions

View File

@@ -19,6 +19,7 @@
#include <logmsg.h>
#include <deprivilege_boot.h>
#include <vboot_info.h>
#include <vacpi.h>
#define DBG_LEVEL_BOOT 6U
@@ -37,6 +38,16 @@ static void init_vm_ramdisk_info(struct acrn_vm *vm, const struct multiboot_modu
}
}
/**
* @pre vm != NULL && mod != NULL
*/
static void init_vm_acpi_info(struct acrn_vm *vm, const struct multiboot_module *mod)
{
vm->sw.acpi_info.src_addr = hpa2hva((uint64_t)mod->mm_mod_start);
vm->sw.acpi_info.load_addr = (void *)VIRT_ACPI_DATA_ADDR;
vm->sw.acpi_info.size = ACPI_MODULE_SIZE;
}
/**
* @pre vm != NULL
*/
@@ -222,6 +233,16 @@ static int32_t init_vm_sw_load(struct acrn_vm *vm, const struct acrn_multiboot_i
if (mod != NULL) {
init_vm_ramdisk_info(vm, mod);
}
if (is_prelaunched_vm(vm)) {
mod = get_mod_by_tag(mbi, vm_config->acpi_config.acpi_mod_tag);
if ((mod != NULL) && ((mod->mm_mod_end - mod->mm_mod_start) == ACPI_MODULE_SIZE)) {
init_vm_acpi_info(vm, mod);
} else {
pr_err("failed to load VM %d acpi module", vm->vm_id);
}
}
} else {
pr_err("failed to load VM %d kernel module", vm->vm_id);
}

View File

@@ -16,8 +16,11 @@
#include <vm_configurations.h>
#define MAX_BOOTARGS_SIZE 2048U
/* The modules in multiboot are for kernel and ramdisk of pre-launched VMs and SOS VM */
#define MAX_MODULE_NUM (2U * PRE_VM_NUM + 2U * SOS_VM_NUM)
/* The modules in multiboot are: Pre-launched VM: kernel/ramdisk/acpi; SOS VM: kernel/ramdisk */
#define MAX_MODULE_NUM (3U * PRE_VM_NUM + 2U * SOS_VM_NUM)
/* The vACPI module size is fixed to 1MB */
#define ACPI_MODULE_SIZE MEM_1M
/* extended flags for acrn multiboot info from multiboot2 */
#define MULTIBOOT_INFO_HAS_EFI_MMAP 0x00010000U