[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] VMX/cpu-policy: check availability of RDTSCP and INVPCID
commit 233a8f20cfbe999505c7b07b359f03fc04111008 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Tue May 30 11:54:55 2023 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Tue May 30 11:54:55 2023 +0200 VMX/cpu-policy: check availability of RDTSCP and INVPCID Both have separate enable bits, which are optional. While on real hardware we can perhaps expect these VMX controls to be available if (and only if) the base CPU feature is available, when running virtualized ourselves this may not be the case. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> --- xen/arch/x86/cpu-policy.c | 6 ++++++ xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c index 74266d30b5..fbf0ecb7cc 100644 --- a/xen/arch/x86/cpu-policy.c +++ b/xen/arch/x86/cpu-policy.c @@ -600,6 +600,12 @@ static void __init calculate_hvm_max_policy(void) */ if ( cpu_has_vmx ) { + if ( !cpu_has_vmx_rdtscp ) + __clear_bit(X86_FEATURE_RDTSCP, fs); + + if ( !cpu_has_vmx_invpcid ) + __clear_bit(X86_FEATURE_INVPCID, fs); + if ( !cpu_has_vmx_mpx ) __clear_bit(X86_FEATURE_MPX, fs); diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h index 51641caa9f..d07fcb2bc9 100644 --- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h +++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h @@ -299,6 +299,8 @@ extern u64 vmx_ept_vpid_cap; (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT) #define cpu_has_vmx_dt_exiting \ (vmx_secondary_exec_control & SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING) +#define cpu_has_vmx_rdtscp \ + (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_RDTSCP) #define cpu_has_vmx_vpid \ (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID) #define cpu_has_monitor_trap_flag \ @@ -314,6 +316,8 @@ extern u64 vmx_ept_vpid_cap; SECONDARY_EXEC_UNRESTRICTED_GUEST) #define cpu_has_vmx_ple \ (vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING) +#define cpu_has_vmx_invpcid \ + (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_INVPCID) #define cpu_has_vmx_apic_reg_virt \ (vmx_secondary_exec_control & SECONDARY_EXEC_APIC_REGISTER_VIRT) #define cpu_has_vmx_virtual_intr_delivery \ -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |