Commit becdad85 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: VMX: Rename vmx_*_supported() helpers to cpu_has_vmx_*()

Rename helpers for a few controls to conform to the more prevelant style
of cpu_has_vmx_<feature>().  Consistent names will allow adding macros
to consolidate the boilerplate code for adjusting secondary execution
controls.

No functional change intended.
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200923165048.20486-2-sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b785a442
...@@ -196,7 +196,7 @@ static inline bool cpu_has_vmx_ple(void) ...@@ -196,7 +196,7 @@ static inline bool cpu_has_vmx_ple(void)
SECONDARY_EXEC_PAUSE_LOOP_EXITING; SECONDARY_EXEC_PAUSE_LOOP_EXITING;
} }
static inline bool vmx_rdrand_supported(void) static inline bool cpu_has_vmx_rdrand(void)
{ {
return vmcs_config.cpu_based_2nd_exec_ctrl & return vmcs_config.cpu_based_2nd_exec_ctrl &
SECONDARY_EXEC_RDRAND_EXITING; SECONDARY_EXEC_RDRAND_EXITING;
...@@ -233,7 +233,7 @@ static inline bool cpu_has_vmx_encls_vmexit(void) ...@@ -233,7 +233,7 @@ static inline bool cpu_has_vmx_encls_vmexit(void)
SECONDARY_EXEC_ENCLS_EXITING; SECONDARY_EXEC_ENCLS_EXITING;
} }
static inline bool vmx_rdseed_supported(void) static inline bool cpu_has_vmx_rdseed(void)
{ {
return vmcs_config.cpu_based_2nd_exec_ctrl & return vmcs_config.cpu_based_2nd_exec_ctrl &
SECONDARY_EXEC_RDSEED_EXITING; SECONDARY_EXEC_RDSEED_EXITING;
...@@ -244,13 +244,13 @@ static inline bool cpu_has_vmx_pml(void) ...@@ -244,13 +244,13 @@ static inline bool cpu_has_vmx_pml(void)
return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_ENABLE_PML; return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_ENABLE_PML;
} }
static inline bool vmx_xsaves_supported(void) static inline bool cpu_has_vmx_xsaves(void)
{ {
return vmcs_config.cpu_based_2nd_exec_ctrl & return vmcs_config.cpu_based_2nd_exec_ctrl &
SECONDARY_EXEC_XSAVES; SECONDARY_EXEC_XSAVES;
} }
static inline bool vmx_waitpkg_supported(void) static inline bool cpu_has_vmx_waitpkg(void)
{ {
return vmcs_config.cpu_based_2nd_exec_ctrl & return vmcs_config.cpu_based_2nd_exec_ctrl &
SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE; SECONDARY_EXEC_ENABLE_USR_WAIT_PAUSE;
......
...@@ -4121,7 +4121,7 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx) ...@@ -4121,7 +4121,7 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx)
if (!enable_pml) if (!enable_pml)
exec_control &= ~SECONDARY_EXEC_ENABLE_PML; exec_control &= ~SECONDARY_EXEC_ENABLE_PML;
if (vmx_xsaves_supported()) { if (cpu_has_vmx_xsaves()) {
/* Exposing XSAVES only when XSAVE is exposed */ /* Exposing XSAVES only when XSAVE is exposed */
bool xsaves_enabled = bool xsaves_enabled =
boot_cpu_has(X86_FEATURE_XSAVE) && boot_cpu_has(X86_FEATURE_XSAVE) &&
...@@ -4179,7 +4179,7 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx) ...@@ -4179,7 +4179,7 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx)
} }
} }
if (vmx_rdrand_supported()) { if (cpu_has_vmx_rdrand()) {
bool rdrand_enabled = guest_cpuid_has(vcpu, X86_FEATURE_RDRAND); bool rdrand_enabled = guest_cpuid_has(vcpu, X86_FEATURE_RDRAND);
if (rdrand_enabled) if (rdrand_enabled)
exec_control &= ~SECONDARY_EXEC_RDRAND_EXITING; exec_control &= ~SECONDARY_EXEC_RDRAND_EXITING;
...@@ -4194,7 +4194,7 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx) ...@@ -4194,7 +4194,7 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx)
} }
} }
if (vmx_rdseed_supported()) { if (cpu_has_vmx_rdseed()) {
bool rdseed_enabled = guest_cpuid_has(vcpu, X86_FEATURE_RDSEED); bool rdseed_enabled = guest_cpuid_has(vcpu, X86_FEATURE_RDSEED);
if (rdseed_enabled) if (rdseed_enabled)
exec_control &= ~SECONDARY_EXEC_RDSEED_EXITING; exec_control &= ~SECONDARY_EXEC_RDSEED_EXITING;
...@@ -4209,7 +4209,7 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx) ...@@ -4209,7 +4209,7 @@ static void vmx_compute_secondary_exec_control(struct vcpu_vmx *vmx)
} }
} }
if (vmx_waitpkg_supported()) { if (cpu_has_vmx_waitpkg()) {
bool waitpkg_enabled = bool waitpkg_enabled =
guest_cpuid_has(vcpu, X86_FEATURE_WAITPKG); guest_cpuid_has(vcpu, X86_FEATURE_WAITPKG);
...@@ -4317,7 +4317,7 @@ static void init_vmcs(struct vcpu_vmx *vmx) ...@@ -4317,7 +4317,7 @@ static void init_vmcs(struct vcpu_vmx *vmx)
if (vmx->vpid != 0) if (vmx->vpid != 0)
vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid); vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
if (vmx_xsaves_supported()) if (cpu_has_vmx_xsaves())
vmcs_write64(XSS_EXIT_BITMAP, VMX_XSS_EXIT_BITMAP); vmcs_write64(XSS_EXIT_BITMAP, VMX_XSS_EXIT_BITMAP);
if (enable_pml) { if (enable_pml) {
...@@ -7254,14 +7254,14 @@ static __init void vmx_set_cpu_caps(void) ...@@ -7254,14 +7254,14 @@ static __init void vmx_set_cpu_caps(void)
/* CPUID 0xD.1 */ /* CPUID 0xD.1 */
supported_xss = 0; supported_xss = 0;
if (!vmx_xsaves_supported()) if (!cpu_has_vmx_xsaves())
kvm_cpu_cap_clear(X86_FEATURE_XSAVES); kvm_cpu_cap_clear(X86_FEATURE_XSAVES);
/* CPUID 0x80000001 */ /* CPUID 0x80000001 */
if (!cpu_has_vmx_rdtscp()) if (!cpu_has_vmx_rdtscp())
kvm_cpu_cap_clear(X86_FEATURE_RDTSCP); kvm_cpu_cap_clear(X86_FEATURE_RDTSCP);
if (vmx_waitpkg_supported()) if (cpu_has_vmx_waitpkg())
kvm_cpu_cap_check_and_set(X86_FEATURE_WAITPKG); kvm_cpu_cap_check_and_set(X86_FEATURE_WAITPKG);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment