mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 01:37:44 +00:00
hv: nested: Introduce shadow EPT infrastructure
To shadow guest EPT, the hypervisor needs construct a shadow EPT for each guest EPT. The key to associate a shadow EPT and a guest EPT is the EPTP (EPT pointer). This patch provides following structure to do the association. struct nept_desc { /* * A shadow EPTP. * The format is same with 'EPT pointer' in VMCS. * Its PML4 address field is a HVA of the hypervisor. */ uint64_t shadow_eptp; /* * An guest EPTP configured by L1 VM. * The format is same with 'EPT pointer' in VMCS. * Its PML4 address field is a GPA of the L1 VM. */ uint64_t guest_eptp; uint32_t ref_count; }; Due to lack of dynamic memory allocation of the hypervisor, a array nept_bucket of type 'struct nept_desc' is introduced to store those association information. A guest EPT might be shared between different L2 vCPUs, so this patch provides several functions to handle the reference of the structure. Interface get_shadow_eptp() also is introduced. To find the shadow EPTP of a specified guest EPTP. Tracked-On: #5923 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Signed-off-by: Zide Chen <zide.chen@intel.com> Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -7,8 +7,30 @@
|
||||
#define VEPT_H
|
||||
|
||||
#ifdef CONFIG_NVMX_ENABLED
|
||||
/*
|
||||
* A descriptor to store info of nested EPT
|
||||
*/
|
||||
struct nept_desc {
|
||||
/*
|
||||
* A shadow EPTP.
|
||||
* The format is same with 'EPT pointer' in VMCS.
|
||||
* Its PML4 address field is a HVA of the hypervisor.
|
||||
*/
|
||||
uint64_t shadow_eptp;
|
||||
/*
|
||||
* An guest EPTP configured by L1 VM.
|
||||
* The format is same with 'EPT pointer' in VMCS.
|
||||
* Its PML4 address field is a GPA of the L1 VM.
|
||||
*/
|
||||
uint64_t guest_eptp;
|
||||
uint32_t ref_count;
|
||||
};
|
||||
|
||||
void reserve_buffer_for_sept_pages(void);
|
||||
void init_vept(void);
|
||||
uint64_t get_shadow_eptp(uint64_t guest_eptp);
|
||||
struct nept_desc *get_nept_desc(uint64_t guest_eptp);
|
||||
void put_nept_desc(uint64_t guest_eptp);
|
||||
int32_t invept_vmexit_handler(struct acrn_vcpu *vcpu);
|
||||
#else
|
||||
static inline void reserve_buffer_for_sept_pages(void) {};
|
||||
|
Reference in New Issue
Block a user