In nested_enable_evmcs() evmcs_already_enabled check doesn't really do anything: controls are already sanitized and we return '0' regardless. Just drop the check.
Unified · Split
| @@ -350,17 +350,12 @@ int nested_enable_evmcs(struct kvm_vcpu *vcpu, · 349 unmodified lines | |||
| 350 | uint16_t *vmcs_version) | 350 | uint16_t *vmcs_version) |
| 351 | { | 351 | { |
| 352 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 352 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| 353 | bool evmcs_already_enabled = vmx->nested.enlightened_vmcs_enabled; | ||
| 354 | 353 | ||
| 355 | vmx->nested.enlightened_vmcs_enabled = true; | 354 | vmx->nested.enlightened_vmcs_enabled = true; |
| 356 | 355 | ||
| 357 | if (vmcs_version) | 356 | if (vmcs_version) |
| 358 | *vmcs_version = nested_get_evmcs_version(vcpu); | 357 | *vmcs_version = nested_get_evmcs_version(vcpu); |
| 359 | 358 | ||
| 360 | /* We don't support disabling the feature for simplicity. */ | ||
| 361 | if (evmcs_already_enabled) | ||
| 362 | return 0; | ||
| 363 | |||
| 364 | vmx->nested.msrs.pinbased_ctls_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; | 359 | vmx->nested.msrs.pinbased_ctls_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; |
| 365 | vmx->nested.msrs.entry_ctls_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; | 360 | vmx->nested.msrs.entry_ctls_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; |
| 366 | vmx->nested.msrs.exit_ctls_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; | 361 | vmx->nested.msrs.exit_ctls_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; |