aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/vmx/evmcs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c
index 95bc2247478d..5466c6d85cf3 100644
--- a/arch/x86/kvm/vmx/evmcs.c
+++ b/arch/x86/kvm/vmx/evmcs.c
@@ -332,16 +332,17 @@ int nested_enable_evmcs(struct kvm_vcpu *vcpu,
332 uint16_t *vmcs_version) 332 uint16_t *vmcs_version)
333{ 333{
334 struct vcpu_vmx *vmx = to_vmx(vcpu); 334 struct vcpu_vmx *vmx = to_vmx(vcpu);
335 bool evmcs_already_enabled = vmx->nested.enlightened_vmcs_enabled;
336
337 vmx->nested.enlightened_vmcs_enabled = true;
335 338
336 if (vmcs_version) 339 if (vmcs_version)
337 *vmcs_version = nested_get_evmcs_version(vcpu); 340 *vmcs_version = nested_get_evmcs_version(vcpu);
338 341
339 /* We don't support disabling the feature for simplicity. */ 342 /* We don't support disabling the feature for simplicity. */
340 if (vmx->nested.enlightened_vmcs_enabled) 343 if (evmcs_already_enabled)
341 return 0; 344 return 0;
342 345
343 vmx->nested.enlightened_vmcs_enabled = true;
344
345 vmx->nested.msrs.pinbased_ctls_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; 346 vmx->nested.msrs.pinbased_ctls_high &= ~EVMCS1_UNSUPPORTED_PINCTRL;
346 vmx->nested.msrs.entry_ctls_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; 347 vmx->nested.msrs.entry_ctls_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL;
347 vmx->nested.msrs.exit_ctls_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; 348 vmx->nested.msrs.exit_ctls_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL;