From c078f90d779247359a23c21edfbb9007f437e039 Mon Sep 17 00:00:00 2001 From: Binbin Wu Date: Wed, 22 May 2019 15:18:18 +0800 Subject: [PATCH] hv: vm_config: add epc info in vm config Add EPC information in vm configuration structure. EPC information contains the EPC base and size allocated to a VM. Tracked-On: #3179 Signed-off-by: Binbin Wu Acked-by: Eddie Dong --- hypervisor/arch/x86/configs/vm_config.c | 7 +++++++ hypervisor/include/arch/x86/vm_config.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/hypervisor/arch/x86/configs/vm_config.c b/hypervisor/arch/x86/configs/vm_config.c index b85b51715..9d7e33de1 100644 --- a/hypervisor/arch/x86/configs/vm_config.c +++ b/hypervisor/arch/x86/configs/vm_config.c @@ -7,6 +7,7 @@ #include #include #include +#include /* * @pre vm_id < CONFIG_MAX_VM_NUM @@ -89,6 +90,8 @@ bool sanitize_vm_config(void) } else if (((vm_config->guest_flags & GUEST_FLAG_LAPIC_PASSTHROUGH) != 0U) && ((vm_config->guest_flags & GUEST_FLAG_RT) == 0U)) { ret = false; + }else if (vm_config->epc.size != 0UL) { + ret = false; } else { pre_launch_pcpu_bitmap |= vm_config->pcpu_bitmap; } @@ -119,6 +122,10 @@ bool sanitize_vm_config(void) } } + if (((vm_config->epc.size | vm_config->epc.base) & ~PAGE_MASK) != 0UL) { + ret = false; + } + if (ret) { /* make sure no identical UUID in following VM configurations */ ret = check_vm_uuid_collision(vm_id); diff --git a/hypervisor/include/arch/x86/vm_config.h b/hypervisor/include/arch/x86/vm_config.h index b181c48d7..c4ae96237 100644 --- a/hypervisor/include/arch/x86/vm_config.h +++ b/hypervisor/include/arch/x86/vm_config.h @@ -13,6 +13,7 @@ #include #include #include +#include #define PLUG_CPU(n) (1U << (n)) #define MAX_VUART_NUM_PER_VM 2U @@ -84,6 +85,7 @@ struct acrn_vm_config { * We could add more guest flags in future; */ struct acrn_vm_mem_config memory; /* memory configuration of VM */ + struct epc_section epc; /* EPC memory configuration of VM */ uint16_t pci_ptdev_num; /* indicate how many PCI PT devices in VM */ struct acrn_vm_pci_ptdev_config *pci_ptdevs; /* point to PCI PT devices BDF list */ struct acrn_vm_os_config os_config; /* OS information the VM */