Skip to content

Commit 77900bf

Browse files
committed
KVM: nVMX: remove unnecessary #ifdef
nested_vmx_check_controls() has already run by the time KVM checks host state, so the "host address space size" exit control can only be set on x86-64 hosts. Simplify the condition at the cost of adding some dead code to 32-bit kernels. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 112e660 commit 77900bf

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,7 @@ static int nested_vmx_check_address_space_size(struct kvm_vcpu *vcpu,
29032903
static int nested_vmx_check_host_state(struct kvm_vcpu *vcpu,
29042904
struct vmcs12 *vmcs12)
29052905
{
2906-
bool ia32e;
2906+
bool ia32e = !!(vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE);
29072907

29082908
if (CC(!nested_host_cr0_valid(vcpu, vmcs12->host_cr0)) ||
29092909
CC(!nested_host_cr4_valid(vcpu, vmcs12->host_cr4)) ||
@@ -2923,12 +2923,6 @@ static int nested_vmx_check_host_state(struct kvm_vcpu *vcpu,
29232923
vmcs12->host_ia32_perf_global_ctrl)))
29242924
return -EINVAL;
29252925

2926-
#ifdef CONFIG_X86_64
2927-
ia32e = !!(vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE);
2928-
#else
2929-
ia32e = false;
2930-
#endif
2931-
29322926
if (ia32e) {
29332927
if (CC(!(vmcs12->host_cr4 & X86_CR4_PAE)))
29342928
return -EINVAL;

0 commit comments

Comments
 (0)