mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-12-24 06:02:32 +00:00
'struct nept_desc' is used to associate guest EPTP with a shadow EPTP. It's created in the first reference and be freed while no reference. The life cycle seems like, While guest VMCS VMX_EPT_POINTER_FULL is changed, the 'struct nept_desc' of the new guest EPTP is referenced; the 'struct nept_desc' of the old guest EPTP is dereferenced. While guest VMCS be cleared(by VMCLEAR in L1 VM), the 'struct nept_desc' of the old guest EPTP is dereferenced. While a new guest VMCS be loaded(by VMPTRLD in L1 VM), the 'struct nept_desc' of the new guest EPTP is referenced. The 'struct nept_desc' of the old guest EPTP is dereferenced. 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>
40 lines
1.0 KiB
C
40 lines
1.0 KiB
C
/*
|
|
* Copyright (C) 2021 Intel Corporation. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
#ifndef VEPT_H
|
|
#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);
|
|
bool handle_l2_ept_violation(struct acrn_vcpu *vcpu);
|
|
int32_t invept_vmexit_handler(struct acrn_vcpu *vcpu);
|
|
#else
|
|
static inline void reserve_buffer_for_sept_pages(void) {};
|
|
#endif /* CONFIG_NVMX_ENABLED */
|
|
#endif /* VEPT_H */
|