KVM: VMX: refactor/fix IRQ and NMI injectability determination

There are currently two ways in VMX to check if an IRQ or NMI can be
injected:
 - vmx_{nmi|irq}_enabled and
 - vcpu.arch.{nmi|interrupt}_window_open.
Even worse, one test (at the end of vmx_vcpu_run) uses an inconsistent,
likely incorrect logic.

This patch consolidates and unifies the tests over
{nmi|interrupt}_window_open as cache + vmx_update_window_states
for updating the cache content.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
Jan Kiszka
2008-09-26 09:30:49 +02:00
committed by Avi Kivity
parent 448fa4a9c5
commit 33f089ca5a
2 changed files with 22 additions and 25 deletions

View File

@@ -327,6 +327,7 @@ struct kvm_vcpu_arch {
bool nmi_pending;
bool nmi_injected;
bool nmi_window_open;
u64 mtrr[0x100];
};