diff options
author | Avi Kivity <avi@redhat.com> | 2011-03-07 07:54:28 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-05-11 07:56:54 -0400 |
commit | f4c63e5d5a356b652a3d984edbefca289176c40f (patch) | |
tree | 90c505354b7c8562da59d67c8704da88904ca8f9 /arch/x86 | |
parent | 6de12732c42c7070af42e3d6e42ecee2838fc920 (diff) |
KVM: VMX: Optimize vmx_get_cpl()
In long mode, vm86 mode is disallowed, so we need not check for
it. Reading rflags.vm may require a VMREAD, so it is expensive.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/vmx.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 4d117072acf..e8a35ee0073 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -2120,7 +2120,8 @@ static int vmx_get_cpl(struct kvm_vcpu *vcpu) | |||
2120 | if (!is_protmode(vcpu)) | 2120 | if (!is_protmode(vcpu)) |
2121 | return 0; | 2121 | return 0; |
2122 | 2122 | ||
2123 | if (kvm_get_rflags(vcpu) & X86_EFLAGS_VM) /* if virtual 8086 */ | 2123 | if (!is_long_mode(vcpu) |
2124 | && (kvm_get_rflags(vcpu) & X86_EFLAGS_VM)) /* if virtual 8086 */ | ||
2124 | return 3; | 2125 | return 3; |
2125 | 2126 | ||
2126 | return vmcs_read16(GUEST_CS_SELECTOR) & 3; | 2127 | return vmcs_read16(GUEST_CS_SELECTOR) & 3; |