Skip to contentSkip to conversation

qemu-kvm: Fix in-kernel PIC reset

PATCH Applied Jan Kiszka 2 participants 2 messages Jun 27, 2011 – Jun 28, 2011 KVM

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 qemu-kvm: Fix in-kernel PIC reset

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.

---
 hw/i8259.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
hw/i8259.c +6 -1
index 1c545c7..463ce72 100644
@@ -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)
 {
Signature · 1 line
1.7.1
Applied
#1 lore raw
Quoted 3 lines · Jan Kiszka

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.

Signature · 1 line
error compiling committee.c: too many arguments to function