VMM: Make the ioapic emulation handle destination writes.
authorGan Shun Lim <ganshun@gmail.com>
Thu, 22 Dec 2016 02:34:43 +0000 (10:34 +0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 17 Jan 2017 19:16:49 +0000 (14:16 -0500)
This stores the ioapic destination into the virtio mmio dest field.

Change-Id: I8604c13533c58d35f7f694b74a44d3146ef11d5e
Signed-off-by: Gan Shun Lim <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/vmm/ioapic.c

index 507ba6f..bd0ed0e 100644 (file)
@@ -31,7 +31,7 @@
 #define IOAPIC_CONFIG 0x100
 #define IOAPIC_NUM_PINS 24
 
-int debug_ioapic = 1;
+int debug_ioapic;
 int apic_id_mask = 0xf0;
 
 #define DPRINTF(fmt, ...) \
@@ -111,6 +111,15 @@ static void ioapic_write(struct guest_thread *vm_thread, int ix,
                        vm->virtio_mmio_devices[i]->vec = value & 0xff;
                        DPRINTF("irq vector for irq number %d is: %lx\n",
                                 vm->virtio_mmio_devices[i]->irq, value & 0xff);
+               } else if (reg == irqreg + 1) {
+                       vm->virtio_mmio_devices[i]->dest = value >> 24;
+                       if (value >> 24 == 0xff)
+                               vm->virtio_mmio_devices[i]->dest = 0xffffffff;
+
+                       DPRINTF("high value for irq number %d is: %lx\n",
+                                vm->virtio_mmio_devices[i]->irq, value);
+                       DPRINTF("irq destination for irq number %d is: %lx\n",
+                                vm->virtio_mmio_devices[i]->irq, value >> 24);
                }
        }