[PATCH] qemu-kvm: Fix in-kernel PIC reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 hw/i8259.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

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)
 {
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux