Patchwork [v2,08/20] kvm: x86: Do not leave halt if interrupts are disabled

login
register
mail settings
Submitter Jan Kiszka
Date March 15, 2011, 11:26 a.m.
Message ID <d071e9c9eea2c594d2c02fbe75689ee21a530072.1300188374.git.jan.kiszka@siemens.com>
Download mbox | patch
Permalink /patch/86946/
State New
Headers show

Comments

Jan Kiszka - March 15, 2011, 11:26 a.m.
When an external interrupt is pending but IF is cleared, we must not
leave the halt state prematurely.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 target-i386/kvm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index f7995bd..3a07fce 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1590,7 +1590,9 @@  int kvm_arch_process_async_events(CPUState *env)
         return 0;
     }
 
-    if (env->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI)) {
+    if (((env->interrupt_request & CPU_INTERRUPT_HARD) &&
+         (env->eflags & IF_MASK)) ||
+        (env->interrupt_request & CPU_INTERRUPT_NMI)) {
         env->halted = 0;
     }
     if (env->interrupt_request & CPU_INTERRUPT_INIT) {