diff options
author | Gleb Natapov <gleb@redhat.com> | 2009-05-11 06:35:55 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-06-10 04:48:59 -0400 |
commit | 20f65983e30f222e5383f77206e3f571d1d64610 (patch) | |
tree | efe95952e9e25746515373266e0977aebf650eb4 /arch/x86/kvm/vmx.c | |
parent | 8db3baa2db34035b2ddb7d0e8b186eb92a056532 (diff) |
KVM: Move "exit due to NMI" handling into vmx_complete_interrupts()
To save us one reading of VM_EXIT_INTR_INFO.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 29b49f09a019..fe2ce2b40504 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3261,8 +3261,17 @@ static void vmx_complete_interrupts(struct vcpu_vmx *vmx) | |||
3261 | int type; | 3261 | int type; |
3262 | bool idtv_info_valid; | 3262 | bool idtv_info_valid; |
3263 | 3263 | ||
3264 | idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; | ||
3265 | exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); | 3264 | exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO); |
3265 | |||
3266 | /* We need to handle NMIs before interrupts are enabled */ | ||
3267 | if ((exit_intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR && | ||
3268 | (exit_intr_info & INTR_INFO_VALID_MASK)) { | ||
3269 | KVMTRACE_0D(NMI, &vmx->vcpu, handler); | ||
3270 | asm("int $2"); | ||
3271 | } | ||
3272 | |||
3273 | idtv_info_valid = idt_vectoring_info & VECTORING_INFO_VALID_MASK; | ||
3274 | |||
3266 | if (cpu_has_virtual_nmis()) { | 3275 | if (cpu_has_virtual_nmis()) { |
3267 | unblock_nmi = (exit_intr_info & INTR_INFO_UNBLOCK_NMI) != 0; | 3276 | unblock_nmi = (exit_intr_info & INTR_INFO_UNBLOCK_NMI) != 0; |
3268 | vector = exit_intr_info & INTR_INFO_VECTOR_MASK; | 3277 | vector = exit_intr_info & INTR_INFO_VECTOR_MASK; |
@@ -3363,7 +3372,6 @@ static void fixup_rmode_irq(struct vcpu_vmx *vmx) | |||
3363 | static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | 3372 | static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) |
3364 | { | 3373 | { |
3365 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 3374 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
3366 | u32 intr_info; | ||
3367 | 3375 | ||
3368 | /* Record the guest's net vcpu time for enforced NMI injections. */ | 3376 | /* Record the guest's net vcpu time for enforced NMI injections. */ |
3369 | if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked)) | 3377 | if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked)) |
@@ -3490,15 +3498,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
3490 | asm("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); | 3498 | asm("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS)); |
3491 | vmx->launched = 1; | 3499 | vmx->launched = 1; |
3492 | 3500 | ||
3493 | intr_info = vmcs_read32(VM_EXIT_INTR_INFO); | ||
3494 | |||
3495 | /* We need to handle NMIs before interrupts are enabled */ | ||
3496 | if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR && | ||
3497 | (intr_info & INTR_INFO_VALID_MASK)) { | ||
3498 | KVMTRACE_0D(NMI, vcpu, handler); | ||
3499 | asm("int $2"); | ||
3500 | } | ||
3501 | |||
3502 | vmx_complete_interrupts(vmx); | 3501 | vmx_complete_interrupts(vmx); |
3503 | } | 3502 | } |
3504 | 3503 | ||