mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 10:17:28 +00:00
hv: nested: enable multiple active VMCS12 support
This patch changes the size of vvmcs[] array from 1 to PER_VCPU_ACTIVE_VVMCS_NUM, and actually enables multiple active VMCS12 support in ACRN. The basic operations: - if L1 VMPTRLDs a VMCS12 without previously VMCLEAR the current VMCS12, ACRN no longer unconditionally flushes the current VMCS12 back to L1. Instead, it tries to keep both the current and the newly loaded VMCS12 in the nested->vvmcs[] array, unless: - if there is no more available vvmcs[] entry, ACRN flushes one active VMCS12 to make room for this new VMCS12. Tracked-On: #6289 Signed-off-by: Zide Chen <zide.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#ifndef NESTED_H
|
||||
#define NESTED_H
|
||||
|
||||
#include <asm/vm_config.h>
|
||||
#include <lib/errno.h>
|
||||
|
||||
/* helper data structure to make VMX capability MSR manipulation easier */
|
||||
@@ -333,12 +334,15 @@ struct acrn_vvmcs {
|
||||
uint8_t vmcs02[PAGE_SIZE]; /* VMCS to run L2 and as Link Pointer in VMCS01 */
|
||||
struct acrn_vmcs12 vmcs12; /* To cache L1's VMCS12*/
|
||||
uint64_t vmcs12_gpa; /* The corresponding L1 GPA for this VMCS12 */
|
||||
uint32_t ref_cnt; /* Count of being VMPTRLDed without VMCLEARed */
|
||||
bool host_state_dirty; /* To indicate need to merge VMCS12 host-state fields to VMCS01 */
|
||||
bool control_fields_dirty; /* For all other non-host-state fields that need to be merged */
|
||||
} __aligned(PAGE_SIZE);
|
||||
|
||||
#define MAX_ACTIVE_VVMCS_NUM 4
|
||||
|
||||
struct acrn_nested {
|
||||
struct acrn_vvmcs vvmcs[1];
|
||||
struct acrn_vvmcs vvmcs[MAX_ACTIVE_VVMCS_NUM];
|
||||
struct acrn_vvmcs *current_vvmcs; /* Refer to the current loaded VMCS12 */
|
||||
uint64_t vmxon_ptr; /* GPA */
|
||||
bool vmxon; /* To indicate if vCPU entered VMX operation */
|
||||
|
@@ -215,7 +215,7 @@ struct iwkey {
|
||||
};
|
||||
|
||||
struct acrn_vcpu_arch {
|
||||
/* vmcs region for this vcpu, MUST be 4KB-aligned */
|
||||
/* vmcs region for this vcpu, MUST be 4KB-aligned. This is VMCS01 when nested VMX is enabled */
|
||||
uint8_t vmcs[PAGE_SIZE];
|
||||
|
||||
/* context for nested virtualization, 4KB-aligned */
|
||||
|
Reference in New Issue
Block a user