hv: nested: support for INVEPT and INVVPID emulation

invvpid and invept instructions cause VM exits unconditionally.
For initial support, we pass all the instruction operands as is
to the pCPU.

Tracked-On: #5923
Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
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-04-29 22:58:53 -07:00
committed by wenlingz
parent 4c29a0bb29
commit 4acc65eacc
6 changed files with 137 additions and 4 deletions

View File

@@ -93,6 +93,7 @@ union value_64 {
#define VMXERR_UNSUPPORTED_COMPONENT (12)
#define VMXERR_VMWRITE_RO_COMPONENT (13)
#define VMXERR_VMXON_IN_VMX_ROOT_OPERATION (15)
#define VMXERR_INVEPT_INVVPID_INVALID_OPERAND (28)
/*
* This VMCS12 revision id is chosen arbitrarily.
@@ -314,6 +315,8 @@ enum VMXResult {
VMfailInvalid,
};
void nested_vmx_result(enum VMXResult, int error_number);
int64_t get_invvpid_ept_operands(struct acrn_vcpu *vcpu, void *desc, size_t size);
bool check_vmx_permission(struct acrn_vcpu *vcpu);
int32_t vmxon_vmexit_handler(struct acrn_vcpu *vcpu);
int32_t vmxoff_vmexit_handler(struct acrn_vcpu *vcpu);
int32_t vmptrld_vmexit_handler(struct acrn_vcpu *vcpu);
@@ -322,6 +325,7 @@ int32_t vmread_vmexit_handler(struct acrn_vcpu *vcpu);
int32_t vmwrite_vmexit_handler(struct acrn_vcpu *vcpu);
int32_t vmresume_vmexit_handler(struct acrn_vcpu *vcpu);
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 {

View File

@@ -0,0 +1,12 @@
/*
* Copyright (C) 2021 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef VEPT_H
#define VEPT_H
#ifdef CONFIG_NVMX_ENABLED
int32_t invept_vmexit_handler(struct acrn_vcpu *vcpu);
#endif /* CONFIG_NVMX_ENABLED */
#endif /* VEPT_H */