i8259: Do not clear level-triggered lines in IRR on init

When an input line is handled as level-triggered, it will immediately
raise an IRQ on the output of a PIC again that goes through an init
reset. So only clear the edge-triggered inputs from IRR in that
scenario.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/hw/i8259.c b/hw/i8259.c
index 1a4b1ab..53daf78 100644
--- a/hw/i8259.c
+++ b/hw/i8259.c
@@ -231,8 +231,8 @@
 {
     PICCommonState *s = DO_UPCAST(PICCommonState, dev.qdev, dev);
 
-    pic_init_reset(s);
     s->elcr = 0;
+    pic_init_reset(s);
 }
 
 static void pic_ioport_write(void *opaque, target_phys_addr_t addr64,