]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
ioapic: Implement polarity
authorJan Kiszka <jan.kiszka@siemens.com>
Mon, 22 Aug 2011 15:46:42 +0000 (17:46 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 22 Aug 2011 19:37:03 +0000 (14:37 -0500)
If the polarity bit is set in the redirection table, the input level
simply has to inverted as it is low active in this case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/ioapic.c

index 5916387f0d8c1659e348751bd1370df83941cea0..61991d76797af0837e0a5249131be346cdd9b4e8 100644 (file)
@@ -148,6 +148,9 @@ static void ioapic_set_irq(void *opaque, int vector, int level)
         uint32_t mask = 1 << vector;
         uint64_t entry = s->ioredtbl[vector];
 
+        if (entry & (1 << IOAPIC_LVT_POLARITY_SHIFT)) {
+            level = !level;
+        }
         if (((entry >> IOAPIC_LVT_TRIGGER_MODE_SHIFT) & 1) ==
             IOAPIC_TRIGGER_LEVEL) {
             /* level triggered */