Skip to content

Commit 4335edb

Browse files
duanzhenzhongbonzini
authored andcommitted
KVM: x86: Remove redundant vm_entry_controls_clearbit() call
When emulating exit from long mode, EFER_LMA is cleared with vmx_set_efer(). This will already unset the VM_ENTRY_IA32E_MODE control bit as requested by SDM, so there is no need to unset VM_ENTRY_IA32E_MODE again in exit_lmode() explicitly. In case EFER isn't supported by hardware, long mode isn't supported, so exit_lmode() cannot be reached. Note that, thanks to the shadow controls mechanism, this change doesn't eliminate vmread or vmwrite. Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Message-Id: <20220311102643.807507-3-zhenzhong.duan@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent b76edfe commit 4335edb

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

arch/x86/kvm/vmx/vmx.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2902,7 +2902,6 @@ static void enter_lmode(struct kvm_vcpu *vcpu)
29022902

29032903
static void exit_lmode(struct kvm_vcpu *vcpu)
29042904
{
2905-
vm_entry_controls_clearbit(to_vmx(vcpu), VM_ENTRY_IA32E_MODE);
29062905
vmx_set_efer(vcpu, vcpu->arch.efer & ~EFER_LMA);
29072906
}
29082907

0 commit comments

Comments
 (0)