hv: nested: initial implementation of struct acrn_vvmcs

Add an array of struct acrn_vvmcs to struct acrn_nested, so it is
possible to cache multiple active VMCS12s.

This patch declares the size of this array to 1, meaning that there is
only one active VMCS12.  This is to minimize the logical code changes.

Add pointer current_vvmcs to struct acrn_nested, which refers to the
current vvmcs[] entry.  In this patch, if any VMCS12 is active, it
always points to vvmcs[0].

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:
Zide Chen
2021-07-15 22:22:45 -07:00
committed by wenlingz
parent cf697e753d
commit 799a4d332a
3 changed files with 60 additions and 47 deletions

View File

@@ -329,11 +329,14 @@ int32_t vmlaunch_vmexit_handler(struct acrn_vcpu *vcpu);
int32_t invvpid_vmexit_handler(struct acrn_vcpu *vcpu);
#ifdef CONFIG_NVMX_ENABLED
struct acrn_nested {
struct acrn_vvmcs {
uint8_t vmcs02[PAGE_SIZE]; /* VMCS to run L2 and as Link Pointer in VMCS01 */
/* TODO: change this to uint8_t vmcs12[PAGE_SIZE] */
struct acrn_vmcs12 vmcs12; /* To cache L1's VMCS12*/
} __aligned(PAGE_SIZE);
struct acrn_nested {
struct acrn_vvmcs vvmcs[1];
struct acrn_vvmcs *current_vvmcs; /* Refer to the current loaded VMCS12 */
uint64_t current_vmcs12_ptr; /* GPA */
uint64_t vmxon_ptr; /* GPA */
bool vmxon; /* To indicate if vCPU entered VMX operation */