mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
hv: emulate IA32_EFER and adjust Load EFER VMX controls
This helps to improve performance: - Don't need to execute VMREAD in vcpu_get_efer(), which is frequently called. - VMX_EXIT_CTLS_SAVE_EFER can be removed from VM-Exit Controls. - If the value of IA32_EFER MSR is identical between the host and guest (highly likely), adjust the VMX controls not to load IA32_EFER on VMExit and VMEntry. It's convenient to continue use the exiting vcpu_s/get_efer() APIs, other than the common vcpu_s/get_guest_msr(). Tracked-On: #6289 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Signed-off-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
@@ -172,7 +172,7 @@ enum reset_mode;
|
||||
#define SECURE_WORLD 1
|
||||
|
||||
#define NUM_WORLD_MSRS 2U
|
||||
#define NUM_COMMON_MSRS 22U
|
||||
#define NUM_COMMON_MSRS 23U
|
||||
#ifdef CONFIG_NVMX_ENABLED
|
||||
#define NUM_GUEST_MSRS (NUM_WORLD_MSRS + NUM_COMMON_MSRS + NUM_VMX_MSRS)
|
||||
#else
|
||||
|
@@ -40,6 +40,25 @@ static inline uint64_t apic_access_offset(uint64_t qual)
|
||||
{
|
||||
return (qual & APIC_ACCESS_OFFSET);
|
||||
}
|
||||
|
||||
static inline void clear_vmcs_bit(uint32_t vmcs_field, uint32_t bit)
|
||||
{
|
||||
uint64_t val64;
|
||||
|
||||
val64 = exec_vmread(vmcs_field);
|
||||
val64 &= ~bit;
|
||||
exec_vmwrite(vmcs_field, val64);
|
||||
}
|
||||
|
||||
static inline void set_vmcs_bit(uint32_t vmcs_field, uint32_t bit)
|
||||
{
|
||||
uint64_t val64;
|
||||
|
||||
val64 = exec_vmread(vmcs_field);
|
||||
val64 |= bit;
|
||||
exec_vmwrite(vmcs_field, val64);
|
||||
}
|
||||
|
||||
void init_vmcs(struct acrn_vcpu *vcpu);
|
||||
void load_vmcs(const struct acrn_vcpu *vcpu);
|
||||
void init_host_state(void);
|
||||
|
Reference in New Issue
Block a user