diff options
author | Avi Kivity <avi@redhat.com> | 2009-01-05 05:10:54 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-03-24 05:03:00 -0400 |
commit | 8b3079a5c0c031de07c8390aa160a4229088274f (patch) | |
tree | 6e5a4cb6dee2cfe0dcdc9aeafbec81e22fa77059 /arch/x86/kvm/vmx.c | |
parent | 350f69dcd169d536307aa4a8c38c480e3a51c0db (diff) |
KVM: VMX: When emulating on invalid vmx state, don't return to userspace unnecessarily
If we aren't doing mmio there's no need to exit to userspace (which will
just be confused).
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a309be6788e7..df454de8acfa 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -91,6 +91,7 @@ struct vcpu_vmx { | |||
91 | } rmode; | 91 | } rmode; |
92 | int vpid; | 92 | int vpid; |
93 | bool emulation_required; | 93 | bool emulation_required; |
94 | enum emulation_result invalid_state_emulation_result; | ||
94 | 95 | ||
95 | /* Support for vnmi-less CPUs */ | 96 | /* Support for vnmi-less CPUs */ |
96 | int soft_vnmi_blocked; | 97 | int soft_vnmi_blocked; |
@@ -3130,7 +3131,8 @@ static int handle_nmi_window(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
3130 | static void handle_invalid_guest_state(struct kvm_vcpu *vcpu, | 3131 | static void handle_invalid_guest_state(struct kvm_vcpu *vcpu, |
3131 | struct kvm_run *kvm_run) | 3132 | struct kvm_run *kvm_run) |
3132 | { | 3133 | { |
3133 | int err; | 3134 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
3135 | enum emulation_result err = EMULATE_DONE; | ||
3134 | 3136 | ||
3135 | preempt_enable(); | 3137 | preempt_enable(); |
3136 | local_irq_enable(); | 3138 | local_irq_enable(); |
@@ -3154,6 +3156,8 @@ static void handle_invalid_guest_state(struct kvm_vcpu *vcpu, | |||
3154 | 3156 | ||
3155 | local_irq_disable(); | 3157 | local_irq_disable(); |
3156 | preempt_disable(); | 3158 | preempt_disable(); |
3159 | |||
3160 | vmx->invalid_state_emulation_result = err; | ||
3157 | } | 3161 | } |
3158 | 3162 | ||
3159 | /* | 3163 | /* |
@@ -3205,7 +3209,7 @@ static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) | |||
3205 | if (vmx->emulation_required && emulate_invalid_guest_state) { | 3209 | if (vmx->emulation_required && emulate_invalid_guest_state) { |
3206 | if (guest_state_valid(vcpu)) | 3210 | if (guest_state_valid(vcpu)) |
3207 | vmx->emulation_required = 0; | 3211 | vmx->emulation_required = 0; |
3208 | return 0; | 3212 | return vmx->invalid_state_emulation_result != EMULATE_DO_MMIO; |
3209 | } | 3213 | } |
3210 | 3214 | ||
3211 | /* Access CR3 don't cause VMExit in paging mode, so we need | 3215 | /* Access CR3 don't cause VMExit in paging mode, so we need |