hv/misc: vm_config: vm_config abstraction

Move vm_config to common scope. This change also affects auto-generated
C/H files from configuration tools.

Tracked-On: #8830
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Reviewed-by: Fei Li <fei1.li@intel.com>
Acked-by: Wang Yu1 <yu1.wang@intel.com>
This commit is contained in:
Yifan Liu
2025-09-04 08:17:54 +00:00
committed by acrnsi-robot
parent 127c2074a0
commit 4e888b0378
41 changed files with 241 additions and 226 deletions

View File

@@ -105,19 +105,19 @@ the following actions:
mask_shift = ffs64(max_pcbm) mask_shift = ffs64(max_pcbm)
vcosid = vmsr - MSR_IA32_type_MASK_0 vcosid = vmsr - MSR_IA32_type_MASK_0
pcosid = vm_config->pclosids[vcosid] pcosid = vm_config->arch.pclosids[vcosid]
pmsr = MSR_IA32_type_MASK_0 + pcosid pmsr = MSR_IA32_type_MASK_0 + pcosid
pcbm = vcbm << mask_shift pcbm = vcbm << mask_shift
vcbm = pcbm >> mask_shift vcbm = pcbm >> mask_shift
Where Where
``vm_config->pclosids[]``: array of physical COS IDs, where each corresponds to one ``vcpu_clos`` that ``vm_config->arch.pclosids[]``: array of physical COS IDs, where each corresponds to one ``vcpu_clos`` that
is defined in the scenario file is defined in the scenario file
``max_pcbm``: a bitmask that selects all the physical cache ways assigned to the VM, corresponds to ``max_pcbm``: a bitmask that selects all the physical cache ways assigned to the VM, corresponds to
the nth ``CLOS_MASK`` that is defined in scenario file, where n = the first physical COS ID assigned the nth ``CLOS_MASK`` that is defined in scenario file, where n = the first physical COS ID assigned
= ``vm_config->pclosids[0]`` = ``vm_config->arch.pclosids[0]``
``ffs64(max_pcbm)``: find the first (least significant) bit set in ``max_pcbm`` and return ``ffs64(max_pcbm)``: find the first (least significant) bit set in ``max_pcbm`` and return
the index of that bit. the index of that bit.

View File

@@ -168,6 +168,7 @@ COMMON_C_SRCS += lib/sprintf.c
ifdef STACK_PROTECTOR ifdef STACK_PROTECTOR
COMMON_C_SRCS += lib/stack_protector.c COMMON_C_SRCS += lib/stack_protector.c
endif endif
COMMON_C_SRCS += common/vm_config.c
# dm componment # dm componment
COMMON_C_SRCS += dm/vuart.c COMMON_C_SRCS += dm/vuart.c

View File

@@ -102,7 +102,6 @@ HW_C_SRCS += arch/x86/trampoline.c
HW_S_SRCS += arch/x86/sched.S HW_S_SRCS += arch/x86/sched.S
HW_C_SRCS += arch/x86/rdt.c HW_C_SRCS += arch/x86/rdt.c
HW_C_SRCS += arch/x86/sgx.c HW_C_SRCS += arch/x86/sgx.c
HW_C_SRCS += arch/x86/configs/vm_config.c
HW_C_SRCS += boot/acpi_base.c HW_C_SRCS += boot/acpi_base.c
# ACPI parsing component # ACPI parsing component
# This part should be isolated from FuSa Cert # This part should be isolated from FuSa Cert

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
#include <pci.h> #include <pci.h>
#include <asm/pci_dev.h> #include <asm/pci_dev.h>
#include <vpci.h> #include <vpci.h>

View File

@@ -6,7 +6,7 @@
#include <vm.h> #include <vm.h>
#include <asm/guest/ept.h> #include <asm/guest/ept.h>
#include <asm/vm_config.h> #include <vm_config.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/guest/optee.h> #include <asm/guest/optee.h>
#include <asm/trampoline.h> #include <asm/trampoline.h>

View File

@@ -12,7 +12,7 @@
#include <asm/rdt.h> #include <asm/rdt.h>
#include <bits.h> #include <bits.h>
#include <asm/board.h> #include <asm/board.h>
#include <asm/vm_config.h> #include <vm_config.h>
#include <asm/msr.h> #include <asm/msr.h>
#include <vcpu.h> #include <vcpu.h>
#include <vm.h> #include <vm.h>
@@ -53,12 +53,12 @@ uint16_t vcat_get_num_vclosids(const struct acrn_vm *vm)
if (is_vcat_configured(vm)) { if (is_vcat_configured(vm)) {
/* /*
* For performance and simplicity, here number of vCLOSIDs (num_vclosids) is set * For performance and simplicity, here number of vCLOSIDs (num_vclosids) is set
* equal to the number of pCLOSIDs assigned to this VM (get_vm_config(vm->vm_id)->num_pclosids). * equal to the number of pCLOSIDs assigned to this VM (get_vm_config(vm->vm_id)->arch.num_pclosids).
* But technically, we do not have to make such an assumption. For example, * But technically, we do not have to make such an assumption. For example,
* Hypervisor could implement CLOSID context switch, then number of vCLOSIDs * Hypervisor could implement CLOSID context switch, then number of vCLOSIDs
* can be greater than the number of pCLOSIDs assigned. etc. * can be greater than the number of pCLOSIDs assigned. etc.
*/ */
num_vclosids = get_vm_config(vm->vm_id)->num_pclosids; num_vclosids = get_vm_config(vm->vm_id)->arch.num_pclosids;
} }
return num_vclosids; return num_vclosids;
@@ -68,7 +68,7 @@ uint16_t vcat_get_num_vclosids(const struct acrn_vm *vm)
* @brief Map vCLOSID to pCLOSID * @brief Map vCLOSID to pCLOSID
* *
* @pre vm != NULL && vm->vm_id < CONFIG_MAX_VM_NUM * @pre vm != NULL && vm->vm_id < CONFIG_MAX_VM_NUM
* @pre (get_vm_config(vm->vm_id)->pclosids != NULL) && (vclosid < get_vm_config(vm->vm_id)->num_pclosids) * @pre (get_vm_config(vm->vm_id)->arch.pclosids != NULL) && (vclosid < get_vm_config(vm->vm_id)->arch.num_pclosids)
*/ */
static uint16_t vclosid_to_pclosid(const struct acrn_vm *vm, uint16_t vclosid) static uint16_t vclosid_to_pclosid(const struct acrn_vm *vm, uint16_t vclosid)
{ {
@@ -80,9 +80,9 @@ static uint16_t vclosid_to_pclosid(const struct acrn_vm *vm, uint16_t vclosid)
* *
* Note that write_vcbm() calls vclosid_to_pclosid() indirectly, in write_vcbm(), * Note that write_vcbm() calls vclosid_to_pclosid() indirectly, in write_vcbm(),
* the is_l2_vcbm_msr()/is_l3_vcbm_msr() calls ensure that vclosid is always less than * the is_l2_vcbm_msr()/is_l3_vcbm_msr() calls ensure that vclosid is always less than
* get_vm_config(vm->vm_id)->num_pclosids, so vclosid is always an array index within bound here * get_vm_config(vm->vm_id)->arch.num_pclosids, so vclosid is always an array index within bound here
*/ */
return get_vm_config(vm->vm_id)->pclosids[vclosid]; return get_vm_config(vm->vm_id)->arch.pclosids[vclosid];
} }
/** /**
@@ -126,9 +126,9 @@ static uint64_t get_max_pcbm(const struct acrn_vm *vm, int res)
uint64_t max_pcbm = 0UL; uint64_t max_pcbm = 0UL;
if (is_l2_vcat_configured(vm) && (res == RDT_RESOURCE_L2)) { if (is_l2_vcat_configured(vm) && (res == RDT_RESOURCE_L2)) {
max_pcbm = get_vm_config(vm->vm_id)->max_l2_pcbm; max_pcbm = get_vm_config(vm->vm_id)->arch.max_l2_pcbm;
} else if (is_l3_vcat_configured(vm) && (res == RDT_RESOURCE_L3)) { } else if (is_l3_vcat_configured(vm) && (res == RDT_RESOURCE_L3)) {
max_pcbm = get_vm_config(vm->vm_id)->max_l3_pcbm; max_pcbm = get_vm_config(vm->vm_id)->arch.max_l3_pcbm;
} }
return max_pcbm; return max_pcbm;

View File

@@ -385,7 +385,7 @@ static void guest_cpuid_04h(__unused struct acrn_vm *vm, uint32_t *eax, uint32_t
#ifdef CONFIG_VCAT_ENABLED #ifdef CONFIG_VCAT_ENABLED
if (is_vcat_configured(vm)) { if (is_vcat_configured(vm)) {
/* set_vcpuid_vcat_04h will not change entry.eax */ /* set_vcpuid_vcat_04h will not change entry.eax */
result = set_vcpuid_vcat_04h(vm, &entry); set_vcpuid_vcat_04h(vm, &entry);
} }
#endif #endif
} }

View File

@@ -371,7 +371,7 @@ static void intercept_x2apic_msrs(uint8_t *msr_bitmap_arg, uint32_t mode)
/** /**
* @pre vcpu != NULL && vcpu->vm != NULL && vcpu->vm->vm_id < CONFIG_MAX_VM_NUM * @pre vcpu != NULL && vcpu->vm != NULL && vcpu->vm->vm_id < CONFIG_MAX_VM_NUM
* @pre (is_platform_rdt_capable() == false()) || (is_platform_rdt_capable() && get_vm_config(vcpu->vm->vm_id)->pclosids != NULL) * @pre (is_platform_rdt_capable() == false()) || (is_platform_rdt_capable() && get_vm_config(vcpu->vm->vm_id)->arch.pclosids != NULL)
*/ */
static void prepare_auto_msr_area(struct acrn_vcpu *vcpu) static void prepare_auto_msr_area(struct acrn_vcpu *vcpu)
{ {
@@ -390,9 +390,9 @@ static void prepare_auto_msr_area(struct acrn_vcpu *vcpu)
struct acrn_vm_config *cfg = get_vm_config(vcpu->vm->vm_id); struct acrn_vm_config *cfg = get_vm_config(vcpu->vm->vm_id);
uint16_t vcpu_clos; uint16_t vcpu_clos;
ASSERT(cfg->pclosids != NULL, "error, cfg->pclosids is NULL"); ASSERT(cfg->arch.pclosids != NULL, "error, cfg->arch.pclosids is NULL");
vcpu_clos = cfg->pclosids[vcpu->vcpu_id%cfg->num_pclosids]; vcpu_clos = cfg->arch.pclosids[vcpu->vcpu_id%cfg->arch.num_pclosids];
/* RDT: only load/restore MSR_IA32_PQR_ASSOC when hv and guest have different settings /* RDT: only load/restore MSR_IA32_PQR_ASSOC when hv and guest have different settings
* vCAT: always load/restore MSR_IA32_PQR_ASSOC * vCAT: always load/restore MSR_IA32_PQR_ASSOC

View File

@@ -14,7 +14,7 @@
#include <asm/rdt.h> #include <asm/rdt.h>
#include <bits.h> #include <bits.h>
#include <asm/board.h> #include <asm/board.h>
#include <asm/vm_config.h> #include <vm_config.h>
#include <asm/msr.h> #include <asm/msr.h>
const uint16_t hv_clos = 0U; const uint16_t hv_clos = 0U;

View File

@@ -59,7 +59,7 @@ static int32_t partition_epc(void)
uint64_t psec_addr = 0UL, psec_size = 0UL; uint64_t psec_addr = 0UL, psec_size = 0UL;
uint64_t free_size = 0UL, alloc_size; uint64_t free_size = 0UL, alloc_size;
struct acrn_vm_config *vm_config = get_vm_config(vm_id); struct acrn_vm_config *vm_config = get_vm_config(vm_id);
uint64_t vm_request_size = vm_config->epc.size; uint64_t vm_request_size = vm_config->arch.epc.size;
int32_t ret = 0; int32_t ret = 0;
while (psec_id < MAX_EPC_SECTIONS) { while (psec_id < MAX_EPC_SECTIONS) {
@@ -70,7 +70,7 @@ static int32_t partition_epc(void)
} }
mid = 0U; mid = 0U;
vm_config = get_vm_config(vm_id); vm_config = get_vm_config(vm_id);
vm_request_size = vm_config->epc.size; vm_request_size = vm_config->arch.epc.size;
} else { } else {
if (free_size == 0UL) { if (free_size == 0UL) {
ret = get_epc_section(psec_id, &psec_addr, &psec_size); ret = get_epc_section(psec_id, &psec_addr, &psec_size);
@@ -83,7 +83,7 @@ static int32_t partition_epc(void)
alloc_size = min(vm_request_size, free_size); alloc_size = min(vm_request_size, free_size);
vm_epc_maps[mid][vm_id].size = alloc_size; vm_epc_maps[mid][vm_id].size = alloc_size;
vm_epc_maps[mid][vm_id].hpa = psec_addr + psec_size - free_size; vm_epc_maps[mid][vm_id].hpa = psec_addr + psec_size - free_size;
vm_epc_maps[mid][vm_id].gpa = vm_config->epc.base + vm_config->epc.size - vm_request_size; vm_epc_maps[mid][vm_id].gpa = vm_config->arch.epc.base + vm_config->arch.epc.size - vm_request_size;
vm_request_size -= alloc_size; vm_request_size -= alloc_size;
free_size -= alloc_size; free_size -= alloc_size;
mid++; mid++;

View File

@@ -20,7 +20,7 @@
#include <ticks.h> #include <ticks.h>
#include <logmsg.h> #include <logmsg.h>
#include <asm/board.h> #include <asm/board.h>
#include <asm/vm_config.h> #include <vm_config.h>
#include <pci.h> #include <pci.h>
#include <asm/platform_caps.h> #include <asm/platform_caps.h>
#include <pgtable.h> #include <pgtable.h>

View File

@@ -13,6 +13,8 @@
#include <schedule.h> #include <schedule.h>
#include <notify.h> #include <notify.h>
#include <asm/notify.h>
bool is_vcpu_bsp(const struct acrn_vcpu *vcpu) bool is_vcpu_bsp(const struct acrn_vcpu *vcpu)
{ {
return (vcpu->vcpu_id == BSP_CPU_ID); return (vcpu->vcpu_id == BSP_CPU_ID);

View File

@@ -10,6 +10,7 @@
#include <logmsg.h> #include <logmsg.h>
#include <sbuf.h> #include <sbuf.h>
#include <sprintf.h> #include <sprintf.h>
#include <asm/notify.h>
#include <asm/host_pm.h> #include <asm/host_pm.h>
static struct acrn_vm vm_array[CONFIG_MAX_VM_NUM] __aligned(PAGE_SIZE); static struct acrn_vm vm_array[CONFIG_MAX_VM_NUM] __aligned(PAGE_SIZE);

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
#include <util.h> #include <util.h>
#include <rtl.h> #include <rtl.h>

View File

@@ -7,25 +7,17 @@
* Haicheng Li <haicheng.li@intel.com> * Haicheng Li <haicheng.li@intel.com>
*/ */
#ifndef VM_CONFIG_H_ #ifndef RISCV_VM_CONFIG_H_
#define VM_CONFIG_H_ #define RISCV_VM_CONFIG_H_
#include <board_info.h> #include <board_info.h>
#define MAX_VCPUS_PER_VM MAX_PCPU_NUM #define MAX_VCPUS_PER_VM MAX_PCPU_NUM
#define CONFIG_MAX_VM_NUM 16U #define CONFIG_MAX_VM_NUM 16U
/* TODO: To be moved in later patches */ #define DM_OWNED_GUEST_FLAG_MASK 0UL
enum os_kernel_type {
DUMMY, struct arch_vm_config {
};
/* TODO: Dummy, to be removed */
#include <schedule.h>
struct acrn_vm_config {
struct sched_params sched_params; /* Scheduler params for vCPUs of this VM */
}; };
static inline struct acrn_vm_config *get_vm_config(__unused uint16_t vm_id) {
return NULL;
}
#endif /* VM_CONFIG_H_ */ #endif /* VM_CONFIG_H_ */

View File

@@ -6,7 +6,7 @@
#ifndef NESTED_H #ifndef NESTED_H
#define NESTED_H #define NESTED_H
#include <asm/vm_config.h> #include <vm_config.h>
#include <lib/errno.h> #include <lib/errno.h>
/* helper data structure to make VMX capability MSR manipulation easier */ /* helper data structure to make VMX capability MSR manipulation easier */

View File

@@ -8,7 +8,7 @@
#define TEE_H_ #define TEE_H_
#include <vm.h> #include <vm.h>
#include <asm/vm_config.h> #include <vm_config.h>
#include <ptdev.h> #include <ptdev.h>
#define TEE_FIXED_NONSECURE_VECTOR 0x29U #define TEE_FIXED_NONSECURE_VECTOR 0x29U

View File

@@ -29,7 +29,7 @@
#include <asm/guest/instr_emul.h> #include <asm/guest/instr_emul.h>
#include <asm/guest/nested.h> #include <asm/guest/nested.h>
#include <asm/vmx.h> #include <asm/vmx.h>
#include <asm/vm_config.h> #include <vm_config.h>
/** /**
* @brief vcpu * @brief vcpu

View File

@@ -27,7 +27,7 @@
#include <vpci.h> #include <vpci.h>
#include <asm/cpu_caps.h> #include <asm/cpu_caps.h>
#include <asm/e820.h> #include <asm/e820.h>
#include <asm/vm_config.h> #include <vm_config.h>
#include <io_req.h> #include <io_req.h>
#include <mmu.h> #include <mmu.h>
#ifdef CONFIG_HYPERV_ENABLED #ifdef CONFIG_HYPERV_ENABLED

View File

@@ -7,7 +7,7 @@
#ifndef PCI_DEV_H_ #ifndef PCI_DEV_H_
#define PCI_DEV_H_ #define PCI_DEV_H_
#include <asm/vm_config.h> #include <vm_config.h>
extern struct acrn_vm_pci_dev_config sos_pci_devs[CONFIG_MAX_PCI_DEV_NUM]; extern struct acrn_vm_pci_dev_config sos_pci_devs[CONFIG_MAX_PCI_DEV_NUM];

View File

@@ -12,7 +12,7 @@
#include <profiling.h> #include <profiling.h>
#include <asm/gdt.h> #include <asm/gdt.h>
#include <asm/security.h> #include <asm/security.h>
#include <asm/vm_config.h> #include <vm_config.h>
struct per_cpu_arch { struct per_cpu_arch {
/* vmxon_region MUST be 4KB-aligned */ /* vmxon_region MUST be 4KB-aligned */

View File

@@ -1,61 +1,14 @@
/* /*
* Copyright (C) 2018-2022 Intel Corporation. * Copyright (C) 2018-2025 Intel Corporation.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#ifndef VM_CONFIG_H_ #ifndef X86_VM_CONFIG_H_
#define VM_CONFIG_H_ #define X86_VM_CONFIG_H_
#include <types.h>
#include <pci.h>
#include <board_info.h>
#include <boot.h>
#include <acrn_common.h>
#include <vm_configurations.h>
#include <asm/sgx.h> #include <asm/sgx.h>
#include <acrn_hv_defs.h>
#include <schedule.h>
#include <vuart_config.h>
#define AFFINITY_CPU(n) (1UL << (n))
#define MAX_VCPUS_PER_VM MAX_PCPU_NUM
#define MAX_VM_OS_NAME_LEN 32U
#define MAX_MOD_TAG_LEN 32U
#if defined(CONFIG_SCHED_NOOP)
#define SERVICE_VM_IDLE ""
#elif defined(CONFIG_SCHED_PRIO)
#define SERVICE_VM_IDLE ""
#else
#define SERVICE_VM_IDLE "idle=halt "
#endif
#define PCI_DEV_TYPE_NONE 0U
#define PCI_DEV_TYPE_PTDEV (1U << 0U)
#define PCI_DEV_TYPE_HVEMUL (1U << 1U)
#define PCI_DEV_TYPE_SERVICE_VM_EMUL (1U << 2U)
#define PCI_DEV_TYPE_DUMMY_MF_EMUL (1U << 3U)
#define MAX_MMIO_DEV_NUM 2U
#define CONFIG_SERVICE_VM .load_order = SERVICE_VM, \
.severity = SEVERITY_SERVICE_VM
#define CONFIG_SAFETY_VM .load_order = PRE_LAUNCHED_VM, \
.severity = SEVERITY_SAFETY_VM
#define CONFIG_PRE_STD_VM .load_order = PRE_LAUNCHED_VM, \
.severity = SEVERITY_STANDARD_VM
#define CONFIG_PRE_RT_VM .load_order = PRE_LAUNCHED_VM, \
.severity = SEVERITY_RTVM
#define CONFIG_POST_STD_VM .load_order = POST_LAUNCHED_VM, \
.severity = SEVERITY_STANDARD_VM
#define CONFIG_POST_RT_VM .load_order = POST_LAUNCHED_VM, \
.severity = SEVERITY_RTVM
/* Bitmask of guest flags that can be programmed by device model. Other bits are set by hypervisor only. */ /* Bitmask of guest flags that can be programmed by device model. Other bits are set by hypervisor only. */
#if (SERVICE_VM_NUM == 0) #if (SERVICE_VM_NUM == 0)
@@ -68,93 +21,7 @@
| GUEST_FLAG_RT | GUEST_FLAG_IO_COMPLETION_POLLING | GUEST_FLAG_PMU_PASSTHROUGH) | GUEST_FLAG_RT | GUEST_FLAG_IO_COMPLETION_POLLING | GUEST_FLAG_PMU_PASSTHROUGH)
#endif #endif
/* ACRN guest severity */ struct arch_vm_config {
enum acrn_vm_severity {
SEVERITY_SAFETY_VM = 0x40U,
SEVERITY_RTVM = RTVM_SEVERITY_LEVEL,
SEVERITY_SERVICE_VM = 0x20U,
SEVERITY_STANDARD_VM = 0x10U,
};
struct vm_hpa_regions {
uint64_t start_hpa;
uint64_t size_hpa;
};
struct acrn_vm_mem_config {
uint64_t size; /* VM memory size configuration */
uint64_t region_num;
struct vm_hpa_regions *host_regions;
};
enum os_kernel_type {
KERNEL_BZIMAGE = 1,
KERNEL_RAWIMAGE,
KERNEL_ELF,
KERNEL_UNKNOWN,
};
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 kernel_mod_tag[MAX_MOD_TAG_LEN]; /* multiboot module tag for kernel */
char ramdisk_mod_tag[MAX_MOD_TAG_LEN]; /* multiboot module tag for ramdisk */
char bootargs[MAX_BOOTARGS_SIZE]; /* boot args/cmdline */
uint64_t kernel_load_addr;
uint64_t kernel_entry_addr;
uint64_t kernel_ramdisk_addr;
} __aligned(8);
struct acrn_vm_acpi_config {
char acpi_mod_tag[MAX_MOD_TAG_LEN]; /* multiboot module tag for ACPI */
} __aligned(8);
/* the vbdf is assgined by device model */
#define UNASSIGNED_VBDF 0xFFFFU
struct acrn_vm_pci_dev_config {
uint32_t emu_type; /* the type how the device is emulated. */
union pci_bdf vbdf; /* virtual BDF of PCI device */
union pci_bdf pbdf; /* physical BDF of PCI device */
char shm_region_name[32]; /* TODO: combine pbdf and shm_region_name into a union member */
/* TODO: All device specific attributions need move to other place */
struct target_vuart t_vuart;
uint16_t vuart_idx;
uint16_t vrp_sec_bus; /* use virtual root port's secondary bus as unique identification */
uint8_t vrp_max_payload; /* vrp's dev cap's max payload */
uint64_t vbar_base[PCI_BAR_COUNT]; /* vbar base address of PCI device, which is power-on default value */
struct pci_pdev *pdev; /* the physical PCI device if it's a PT device */
const struct pci_vdev_ops *vdev_ops; /* operations for PCI CFG read/write */
} __aligned(8);
struct pt_intx_config {
uint32_t phys_gsi; /* physical IOAPIC gsi to be forwarded to the VM */
uint32_t virt_gsi; /* virtual IOAPIC gsi triggered on the vIOAPIC */
} __aligned(8);
struct acrn_vm_config {
enum acrn_vm_load_order load_order; /* specify the load order of VM */
char name[MAX_VM_NAME_LEN]; /* VM name identifier */
uint8_t reserved[2];
uint8_t severity; /* severity of the VM */
uint64_t cpu_affinity; /* The set bits represent the pCPUs the vCPUs of
* the VM may run on.
*/
uint64_t guest_flags; /* VM flags that we want to configure for guest
* Now we have two flags:
* GUEST_FLAG_SECURE_WORLD_ENABLED
* GUEST_FLAG_LAPIC_PASSTHROUGH
* We could add more guest flags in future;
*/
struct sched_params sched_params; /* Scheduler params for vCPUs of this VM */
uint16_t companion_vm_id; /* The companion VM id for this VM */
struct acrn_vm_mem_config memory; /* memory configuration of VM */
struct epc_section epc; /* EPC memory configuration of VM */
uint16_t pci_dev_num; /* indicate how many PCI devices in VM */
struct acrn_vm_pci_dev_config *pci_devs; /* point to PCI devices BDF list */
struct acrn_vm_os_config os_config; /* OS information the VM */
struct acrn_vm_acpi_config acpi_config; /* ACPI config for the VM */
/* /*
* below are variable length members (per build). * below are variable length members (per build).
* Service VM can get the vm_configs[] array through hypercall, but Service VM may not * Service VM can get the vm_configs[] array through hypercall, but Service VM may not
@@ -179,22 +46,11 @@ struct acrn_vm_config {
uint32_t max_l2_pcbm; uint32_t max_l2_pcbm;
uint32_t max_l3_pcbm; uint32_t max_l3_pcbm;
struct vuart_config vuart[MAX_VUART_NUM_PER_VM];/* vuart configuration for VM */
bool pt_tpm2; bool pt_tpm2;
struct acrn_mmiodev mmiodevs[MAX_MMIO_DEV_NUM];
bool pt_p2sb_bar; /* whether to passthru p2sb bridge to pre-launched VM or not */ bool pt_p2sb_bar; /* whether to passthru p2sb bridge to pre-launched VM or not */
uint16_t pt_intx_num; /* number of pt_intx_config entries pointed by pt_intx */ struct epc_section epc; /* EPC memory configuration of VM */
struct pt_intx_config *pt_intx; /* stores the base address of struct pt_intx_config array */ };
} __aligned(8);
struct acrn_vm_config *get_vm_config(uint16_t vm_id); #endif /* X86_VM_CONFIG_H_ */
uint8_t get_vm_severity(uint16_t vm_id);
bool vm_has_matched_name(uint16_t vmid, const char *name);
extern struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM];
extern struct acrn_vm_config *const service_vm_config;
#endif /* VM_CONFIG_H_ */

View File

@@ -22,7 +22,7 @@
#include <dm/vpci.h> #include <dm/vpci.h>
#include <dm/vrtc.h> #include <dm/vrtc.h>
#include <spinlock.h> #include <spinlock.h>
#include <asm/vm_config.h> #include <vm_config.h>
#include <asm/guest/vm.h> #include <asm/guest/vm.h>
#include <vcpu.h> #include <vcpu.h>

View File

@@ -0,0 +1,163 @@
/*
* Copyright (C) 2018-2025 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef VM_CONFIG_H_
#define VM_CONFIG_H_
#include <types.h>
#include <pci.h>
#include <board_info.h>
#include <boot.h>
#include <acrn_common.h>
#include <vm_configurations.h>
#include <acrn_hv_defs.h>
#include <schedule.h>
#include <asm/vm_config.h>
#include <vuart.h>
#define AFFINITY_CPU(n) (1UL << (n))
#define MAX_VCPUS_PER_VM MAX_PCPU_NUM
#define MAX_VM_OS_NAME_LEN 32U
#define MAX_MOD_TAG_LEN 32U
#if defined(CONFIG_SCHED_NOOP)
#define SERVICE_VM_IDLE ""
#elif defined(CONFIG_SCHED_PRIO)
#define SERVICE_VM_IDLE ""
#else
#define SERVICE_VM_IDLE "idle=halt "
#endif
#define PCI_DEV_TYPE_NONE 0U
#define PCI_DEV_TYPE_PTDEV (1U << 0U)
#define PCI_DEV_TYPE_HVEMUL (1U << 1U)
#define PCI_DEV_TYPE_SERVICE_VM_EMUL (1U << 2U)
#define PCI_DEV_TYPE_DUMMY_MF_EMUL (1U << 3U)
#define MAX_MMIO_DEV_NUM 2U
#define CONFIG_SERVICE_VM .load_order = SERVICE_VM, \
.severity = SEVERITY_SERVICE_VM
#define CONFIG_SAFETY_VM .load_order = PRE_LAUNCHED_VM, \
.severity = SEVERITY_SAFETY_VM
#define CONFIG_PRE_STD_VM .load_order = PRE_LAUNCHED_VM, \
.severity = SEVERITY_STANDARD_VM
#define CONFIG_PRE_RT_VM .load_order = PRE_LAUNCHED_VM, \
.severity = SEVERITY_RTVM
#define CONFIG_POST_STD_VM .load_order = POST_LAUNCHED_VM, \
.severity = SEVERITY_STANDARD_VM
#define CONFIG_POST_RT_VM .load_order = POST_LAUNCHED_VM, \
.severity = SEVERITY_RTVM
/* ACRN guest severity */
enum acrn_vm_severity {
SEVERITY_SAFETY_VM = 0x40U,
SEVERITY_RTVM = RTVM_SEVERITY_LEVEL,
SEVERITY_SERVICE_VM = 0x20U,
SEVERITY_STANDARD_VM = 0x10U,
};
struct vm_hpa_regions {
uint64_t start_hpa;
uint64_t size_hpa;
};
struct acrn_vm_mem_config {
uint64_t size; /* VM memory size configuration */
uint64_t region_num;
struct vm_hpa_regions *host_regions;
};
enum os_kernel_type {
KERNEL_BZIMAGE = 1,
KERNEL_RAWIMAGE,
KERNEL_ELF,
KERNEL_UNKNOWN,
};
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 kernel_mod_tag[MAX_MOD_TAG_LEN]; /* multiboot module tag for kernel */
char ramdisk_mod_tag[MAX_MOD_TAG_LEN]; /* multiboot module tag for ramdisk */
char bootargs[MAX_BOOTARGS_SIZE]; /* boot args/cmdline */
uint64_t kernel_load_addr;
uint64_t kernel_entry_addr;
uint64_t kernel_ramdisk_addr;
} __aligned(8);
struct acrn_vm_acpi_config {
char acpi_mod_tag[MAX_MOD_TAG_LEN]; /* multiboot module tag for ACPI */
} __aligned(8);
/* the vbdf is assgined by device model */
#define UNASSIGNED_VBDF 0xFFFFU
struct acrn_vm_pci_dev_config {
uint32_t emu_type; /* the type how the device is emulated. */
union pci_bdf vbdf; /* virtual BDF of PCI device */
union pci_bdf pbdf; /* physical BDF of PCI device */
char shm_region_name[32]; /* TODO: combine pbdf and shm_region_name into a union member */
/* TODO: All device specific attributions need move to other place */
struct target_vuart t_vuart;
uint16_t vuart_idx;
uint16_t vrp_sec_bus; /* use virtual root port's secondary bus as unique identification */
uint8_t vrp_max_payload; /* vrp's dev cap's max payload */
uint64_t vbar_base[PCI_BAR_COUNT]; /* vbar base address of PCI device, which is power-on default value */
struct pci_pdev *pdev; /* the physical PCI device if it's a PT device */
const struct pci_vdev_ops *vdev_ops; /* operations for PCI CFG read/write */
} __aligned(8);
struct pt_intx_config {
uint32_t phys_gsi; /* physical IOAPIC gsi to be forwarded to the VM */
uint32_t virt_gsi; /* virtual IOAPIC gsi triggered on the vIOAPIC */
} __aligned(8);
struct acrn_vm_config {
enum acrn_vm_load_order load_order; /* specify the load order of VM */
char name[MAX_VM_NAME_LEN]; /* VM name identifier */
uint8_t reserved[2];
uint8_t severity; /* severity of the VM */
uint64_t cpu_affinity; /* The set bits represent the pCPUs the vCPUs of
* the VM may run on.
*/
uint64_t guest_flags; /* VM flags that we want to configure for guest
* Now we have two flags:
* GUEST_FLAG_SECURE_WORLD_ENABLED
* GUEST_FLAG_LAPIC_PASSTHROUGH
* We could add more guest flags in future;
*/
struct sched_params sched_params; /* Scheduler params for vCPUs of this VM */
uint16_t companion_vm_id; /* The companion VM id for this VM */
struct acrn_vm_mem_config memory; /* memory configuration of VM */
uint16_t pci_dev_num; /* indicate how many PCI devices in VM */
struct acrn_vm_pci_dev_config *pci_devs; /* point to PCI devices BDF list */
struct acrn_vm_os_config os_config; /* OS information the VM */
struct acrn_vm_acpi_config acpi_config; /* ACPI config for the VM */
struct vuart_config vuart[MAX_VUART_NUM_PER_VM];/* vuart configuration for VM */
struct acrn_mmiodev mmiodevs[MAX_MMIO_DEV_NUM];
uint16_t pt_intx_num; /* number of pt_intx_config entries pointed by pt_intx */
struct pt_intx_config *pt_intx; /* stores the base address of struct pt_intx_config array */
struct arch_vm_config arch;
} __aligned(8);
struct acrn_vm_config *get_vm_config(uint16_t vm_id);
uint8_t get_vm_severity(uint16_t vm_id);
bool vm_has_matched_name(uint16_t vmid, const char *name);
extern struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM];
extern struct acrn_vm_config *const service_vm_config;
#endif /* VM_CONFIG_H_ */

View File

@@ -10,7 +10,7 @@
#ifdef PROFILING_ON #ifdef PROFILING_ON
#include <vcpu.h> #include <vcpu.h>
#include <asm/vm_config.h> #include <vm_config.h>
#define MAX_MSR_LIST_NUM 15U #define MAX_MSR_LIST_NUM 15U
#define MAX_PROFILING_MSR_STORE_NUM 1 #define MAX_PROFILING_MSR_STORE_NUM 1

View File

@@ -31,7 +31,7 @@
#include <types.h> #include <types.h>
#include <spinlock.h> #include <spinlock.h>
#include <vuart_config.h> #include <vuart_config.h>
#include <asm/vm_config.h> #include <vm_config.h>
/** /**
* @addtogroup vp-dm_vperipheral * @addtogroup vp-dm_vperipheral

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <types.h> #include <types.h>
#include <asm/vm_config.h> #include <vm_config.h>
#include <vm.h> #include <vm.h>
#include <vacpi.h> #include <vacpi.h>
#include <logmsg.h> #include <logmsg.h>
@@ -49,7 +49,7 @@ static void tpm2_fixup(uint16_t vm_id)
vtpm2 = get_acpi_mod_entry(ACPI_SIG_TPM2, mod->start); vtpm2 = get_acpi_mod_entry(ACPI_SIG_TPM2, mod->start);
tpm2 = get_acpi_tbl(ACPI_SIG_TPM2); tpm2 = get_acpi_tbl(ACPI_SIG_TPM2);
if (config->pt_tpm2 && (vtpm2 != NULL) && (tpm2 != NULL)) { if (config->arch.pt_tpm2 && (vtpm2 != NULL) && (tpm2 != NULL)) {
for (i = 0U; i < MAX_MMIO_DEV_NUM; i++) { for (i = 0U; i < MAX_MMIO_DEV_NUM; i++) {
if (strncmp(config->mmiodevs[i].name, "tpm2", 4) == 0) { if (strncmp(config->mmiodevs[i].name, "tpm2", 4) == 0) {
dev = &config->mmiodevs[i]; dev = &config->mmiodevs[i];

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
#include <vpci.h> #include <vpci.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/page.h> #include <asm/page.h>

View File

@@ -4,5 +4,5 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
struct pt_intx_config vm0_pt_intx[1U] = {}; struct pt_intx_config vm0_pt_intx[1U] = {};

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
#include <vuart.h> #include <vuart.h>
#include <asm/pci_dev.h> #include <asm/pci_dev.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
#include <vpci.h> #include <vpci.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/page.h> #include <asm/page.h>

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
struct pt_intx_config vm0_pt_intx[1U] = {}; struct pt_intx_config vm0_pt_intx[1U] = {};
struct pt_intx_config vm1_pt_intx[1U] = {}; struct pt_intx_config vm1_pt_intx[1U] = {};

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
#include <vuart.h> #include <vuart.h>
#include <asm/pci_dev.h> #include <asm/pci_dev.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
#include <vpci.h> #include <vpci.h>
#include <asm/mmu.h> #include <asm/mmu.h>
#include <asm/page.h> #include <asm/page.h>

View File

@@ -4,4 +4,4 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
#include <asm/vm_config.h> #include <vm_config.h>
#include <vuart.h> #include <vuart.h>
#include <asm/pci_dev.h> #include <asm/pci_dev.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>

View File

@@ -18,7 +18,7 @@
<xsl:value-of select="$license" /> <xsl:value-of select="$license" />
<!-- Included headers --> <!-- Included headers -->
<xsl:value-of select="acrn:include('asm/vm_config.h')" /> <xsl:value-of select="acrn:include('vm_config.h')" />
<xsl:value-of select="acrn:include('vpci.h')" /> <xsl:value-of select="acrn:include('vpci.h')" />
<xsl:value-of select="acrn:include('asm/mmu.h')" /> <xsl:value-of select="acrn:include('asm/mmu.h')" />
<xsl:value-of select="acrn:include('asm/page.h')" /> <xsl:value-of select="acrn:include('asm/page.h')" />

View File

@@ -18,7 +18,7 @@
<xsl:value-of select="$license" /> <xsl:value-of select="$license" />
<!-- Included headers --> <!-- Included headers -->
<xsl:value-of select="acrn:include('asm/vm_config.h')" /> <xsl:value-of select="acrn:include('vm_config.h')" />
<xsl:apply-templates select="config-data/acrn-config/vm" /> <xsl:apply-templates select="config-data/acrn-config/vm" />
</xsl:template> </xsl:template>

View File

@@ -14,7 +14,7 @@
<xsl:value-of select="$license" /> <xsl:value-of select="$license" />
<!-- Included headers --> <!-- Included headers -->
<xsl:value-of select="acrn:include('asm/vm_config.h')" /> <xsl:value-of select="acrn:include('vm_config.h')" />
<xsl:value-of select="acrn:include('vuart.h')" /> <xsl:value-of select="acrn:include('vuart.h')" />
<xsl:value-of select="acrn:include('asm/pci_dev.h')" /> <xsl:value-of select="acrn:include('asm/pci_dev.h')" />
<xsl:value-of select="acrn:include('asm/pgtable.h')" /> <xsl:value-of select="acrn:include('asm/pgtable.h')" />
@@ -194,25 +194,25 @@
<xsl:template name="clos"> <xsl:template name="clos">
<xsl:value-of select="acrn:ifdef('CONFIG_RDT_ENABLED')" /> <xsl:value-of select="acrn:ifdef('CONFIG_RDT_ENABLED')" />
<xsl:value-of select="acrn:initializer('pclosids', concat('vm', @id, '_vcpu_clos'))" /> <xsl:value-of select="acrn:initializer('arch.pclosids', concat('vm', @id, '_vcpu_clos'))" />
<xsl:variable name="vm_id" select="@id" /> <xsl:variable name="vm_id" select="@id" />
<xsl:variable name="vm_name" select="name/text()" /> <xsl:variable name="vm_name" select="name/text()" />
<xsl:choose> <xsl:choose>
<xsl:when test="acrn:is-vcat-enabled() and virtual_cat_support[text() = 'y']"> <xsl:when test="acrn:is-vcat-enabled() and virtual_cat_support[text() = 'y']">
<xsl:value-of select="acrn:initializer('num_pclosids', concat(count(//vm[@id=$vm_id]/virtual_cat_number), 'U'))" /> <xsl:value-of select="acrn:initializer('arch.num_pclosids', concat(count(//vm[@id=$vm_id]/virtual_cat_number), 'U'))" />
<xsl:variable name="rdt_res_str" select="acrn:get-normalized-closinfo-rdt-res-str()" /> <xsl:variable name="rdt_res_str" select="acrn:get-normalized-closinfo-rdt-res-str()" />
<xsl:if test="contains($rdt_res_str, 'L2')"> <xsl:if test="contains($rdt_res_str, 'L2')">
<xsl:value-of select="acrn:initializer('max_l2_pcbm', //CACHE_ALLOCATION[CACHE_LEVEL='2']/POLICY[VM=$vm_name]/CLOS_MASK)" /> <xsl:value-of select="acrn:initializer('arch.max_l2_pcbm', //CACHE_ALLOCATION[CACHE_LEVEL='2']/POLICY[VM=$vm_name]/CLOS_MASK)" />
</xsl:if> </xsl:if>
<xsl:if test="contains($rdt_res_str, 'L3')"> <xsl:if test="contains($rdt_res_str, 'L3')">
<xsl:value-of select="acrn:initializer('max_l3_pcbm', //CACHE_ALLOCATION[CACHE_LEVEL='3']/POLICY[VM=$vm_name]/CLOS_MASK)" /> <xsl:value-of select="acrn:initializer('arch.max_l3_pcbm', //CACHE_ALLOCATION[CACHE_LEVEL='3']/POLICY[VM=$vm_name]/CLOS_MASK)" />
</xsl:if> </xsl:if>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="acrn:initializer('num_pclosids', concat(count(//allocation-data/acrn-config/vm[@id=$vm_id]/clos/vcpu_clos), 'U'))" /> <xsl:value-of select="acrn:initializer('arch.num_pclosids', concat(count(//allocation-data/acrn-config/vm[@id=$vm_id]/clos/vcpu_clos), 'U'))" />
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
@@ -365,7 +365,7 @@
<xsl:template name="pre_launched"> <xsl:template name="pre_launched">
<xsl:if test="@id = '0'"> <xsl:if test="@id = '0'">
<xsl:value-of select="acrn:ifdef('VM0_PASSTHROUGH_TPM')" /> <xsl:value-of select="acrn:ifdef('VM0_PASSTHROUGH_TPM')" />
<xsl:value-of select="acrn:initializer('pt_tpm2', 'true')" /> <xsl:value-of select="acrn:initializer('arch.pt_tpm2', 'true')" />
<xsl:value-of select="acrn:initializer('mmiodevs[0]', '{', true())" /> <xsl:value-of select="acrn:initializer('mmiodevs[0]', '{', true())" />
<xsl:value-of select="acrn:initializer('name', concat($quot, 'tpm2', $quot))" /> <xsl:value-of select="acrn:initializer('name', concat($quot, 'tpm2', $quot))" />
<xsl:value-of select="acrn:initializer('res[0]', '{', true())" /> <xsl:value-of select="acrn:initializer('res[0]', '{', true())" />

View File

@@ -25,7 +25,8 @@ BOARD_CFG_DIR := $(SCENARIO_CFG_DIR)
PRE_BUILD_SRCS += main.c PRE_BUILD_SRCS += main.c
PRE_BUILD_SRCS += static_checks.c PRE_BUILD_SRCS += static_checks.c
PRE_BUILD_SRCS += vm_cfg_checks.c PRE_BUILD_SRCS += vm_cfg_checks.c
PRE_BUILD_SRCS += $(HV_SRC_DIR)/arch/x86/configs/vm_config.c #PRE_BUILD_SRCS += $(HV_SRC_DIR)/arch/x86/configs/vm_config.c
PRE_BUILD_SRCS += $(HV_SRC_DIR)/common/vm_config.c
PRE_BUILD_SRCS += $(SCENARIO_CFG_DIR)/vm_configurations.c PRE_BUILD_SRCS += $(SCENARIO_CFG_DIR)/vm_configurations.c
PRE_BUILD_SRCS += $(BOARD_CFG_DIR)/pt_intx.c PRE_BUILD_SRCS += $(BOARD_CFG_DIR)/pt_intx.c
ifneq (,$(wildcard $(BOARD_CFG_DIR)/pci_dev.c)) ifneq (,$(wildcard $(BOARD_CFG_DIR)/pci_dev.c))

View File

@@ -6,7 +6,7 @@
#include <bits.h> #include <bits.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/vm_config.h> #include <vm_config.h>
#include <asm/rdt.h> #include <asm/rdt.h>
#include <vuart.h> #include <vuart.h>
#include <ivshmem.h> #include <ivshmem.h>
@@ -31,11 +31,11 @@ static bool check_vm_clos_config(uint16_t vm_id)
bool ret = true; bool ret = true;
struct acrn_vm_config *vm_config = get_vm_config(vm_id); struct acrn_vm_config *vm_config = get_vm_config(vm_id);
for (i = 0U; i < vm_config->num_pclosids; i++) { for (i = 0U; i < vm_config->arch.num_pclosids; i++) {
if (((platform_clos_num != 0U) && (vm_config->pclosids[i] == platform_clos_num)) if (((platform_clos_num != 0U) && (vm_config->arch.pclosids[i] == platform_clos_num))
|| (vm_config->pclosids[i] > platform_clos_num)) { || (vm_config->arch.pclosids[i] > platform_clos_num)) {
printf("vm%u: vcpu%u clos(%u) exceed the max clos(%u).", printf("vm%u: vcpu%u clos(%u) exceed the max clos(%u).",
vm_id, i, vm_config->pclosids[i], platform_clos_num); vm_id, i, vm_config->arch.pclosids[i], platform_clos_num);
ret = false; ret = false;
break; break;
} }
@@ -71,7 +71,7 @@ bool sanitize_vm_config(void)
if (((vm_config->guest_flags & GUEST_FLAG_RT) != 0U) if (((vm_config->guest_flags & GUEST_FLAG_RT) != 0U)
&& ((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH)== 0U)) { && ((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH)== 0U)) {
ret = false; ret = false;
} else if (vm_config->epc.size != 0UL) { } else if (vm_config->arch.epc.size != 0UL) {
ret = false; ret = false;
} }
break; break;
@@ -94,7 +94,7 @@ bool sanitize_vm_config(void)
#endif #endif
if (ret && if (ret &&
(((vm_config->epc.size | vm_config->epc.base) & ~PAGE_MASK) != 0UL)) { (((vm_config->arch.epc.size | vm_config->arch.epc.base) & ~PAGE_MASK) != 0UL)) {
ret = false; ret = false;
} }