[PATCH 2/2] test-device: add support for irq injection

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

 



This allows apic.flat to pass.

Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
---
 hw/pc.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 360dbfb..ea31b0f 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1131,12 +1131,20 @@ static uint32_t test_device_memsize_read(void *opaque, uint32_t addr)
     return (intptr_t)opaque;
 }
 
-static void create_test_device(ram_addr_t ram_size)
+static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
+{
+    qemu_irq *isa_irq = opaque;
+
+    qemu_set_irq(isa_irq[addr - 0x2000], !!data);
+}
+
+static void create_test_device(ram_addr_t ram_size, qemu_irq *isa_irq)
 {
     register_ioport_write(0xf1, 1, 1, test_device_serial_write, NULL);
     register_ioport_write(0xf4, 1, 4, test_device_exit, NULL);
     register_ioport_read(0xd1, 1, 4, test_device_memsize_read,
                          (void *)(intptr_t)ram_size);
+    register_ioport_write(0x2000, 24, 1, test_device_irq_line, isa_irq);
 }
 
 /* PC hardware initialisation */
@@ -1169,10 +1177,6 @@ static void pc_init1(ram_addr_t ram_size,
     void *fw_cfg;
     extern int testdevice;
 
-    if (testdevice) {
-        create_test_device(ram_size);
-    }
-
     if (ram_size >= 0xe0000000 ) {
         above_4g_mem_size = ram_size - 0xe0000000;
         below_4g_mem_size = 0xe0000000;
@@ -1499,6 +1503,10 @@ static void pc_init1(ram_addr_t ram_size,
         assigned_dev_load_option_roms(pci_option_rom_offset);
     }
 #endif /* USE_KVM_DEVICE_ASSIGNMENT */
+
+    if (testdevice) {
+        create_test_device(ram_size, isa_irq);
+    }
 }
 
 static void pc_init_pci(ram_addr_t ram_size,
-- 
1.6.4.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