diff mbox

qemu-kvm: Fix in-kernel PIC reset

Message ID 4E0859E4.20509@siemens.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kiszka June 27, 2011, 10:22 a.m. UTC
Lacking sync of the user space state to the kernel after system reset
left the PIC behind in an undefined state. This broke IRQ delivery in
some scenarios, e.g. when resetting while in the BIOS.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/i8259.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Comments

Avi Kivity June 28, 2011, 8:19 a.m. UTC | #1
On 06/27/2011 01:22 PM, Jan Kiszka wrote:
> Lacking sync of the user space state to the kernel after system reset
> left the PIC behind in an undefined state. This broke IRQ delivery in
> some scenarios, e.g. when resetting while in the BIOS.

Applied, thanks.
diff mbox

Patch

diff --git a/hw/i8259.c b/hw/i8259.c
index 1c545c7..463ce72 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -278,6 +278,8 @@  int pic_read_irq(PicState2 *s)
     return intno;
 }
 
+static int kvm_kernel_pic_load_from_user(PicState *s);
+
 static void pic_reset(void *opaque)
 {
     PicState *s = opaque;
@@ -298,6 +300,10 @@  static void pic_reset(void *opaque)
     s->init4 = 0;
     s->single_mode = 0;
     /* Note: ELCR is not reset */
+
+    if (kvm_enabled() && kvm_irqchip_in_kernel()) {
+        kvm_kernel_pic_load_from_user(s);
+    }
 }
 
 static void pic_ioport_write(void *opaque, uint32_t addr, uint32_t val)
@@ -465,7 +471,6 @@  static uint32_t elcr_ioport_read(void *opaque, uint32_t addr1)
 }
 
 static void kvm_kernel_pic_save_to_user(PicState *s);
-static int kvm_kernel_pic_load_from_user(PicState *s);
 
 static void pic_pre_save(void *opaque)
 {