Skip to contentSkip to conversation

qemu: test-irq device

PATCH New Michael S. Tsirkin 1 participant 1 message Jul 20, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: test-irq device

This device is used to test uio_pci_generic driver I submitted to linux kernel. The device implements standard interrupt disable and interrupt status bits, as well as custom set interrupt and interrupt counter registers used for debugging the driver.

The implementation is on top of kraxel-qdev.v9 branch, and can also be seen as a demotnstration of the new infrastructure: to add the device, user simply adds -device test-irq to qemu command line.

---

Posting the patch here in case someone finds it useful. Does it make sense to have such a test device in qemu?

 Makefile.hw     |    2 +-
 Makefile.target |    2 +-
 hw/pci.h        |    1 +
 hw/test-irq.c   |  116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 119 insertions(+), 2 deletions(-)
 create mode 100644 hw/test-irq.c
Makefile.hw +1 -1
index f7a9507..e393693 100644
@@ -16,7 +16,7 @@ CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 CPPFLAGS+=-I$(SRC_PATH)/fpu
 
 obj-y =
-obj-y += virtio.o virtio-pci.o
+obj-y += virtio.o virtio-pci.o test-irq.o
 obj-y += fw_cfg.o
 obj-y += watchdog.o
 obj-y += nand.o ecc.o
Makefile.target +1 -1
index a593503..11e99f5 100644
@@ -492,7 +492,7 @@ obj-y = vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
         gdbstub.o gdbstub-xml.o msix.o
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
-obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
+obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o test-irq.o
 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
 
 LIBS+=-lz
hw/pci.h +1 -0
index ab92092..355896f 100644
@@ -99,6 +99,7 @@ typedef struct PCIIORegion {
 #define  PCI_COMMAND_IO		0x1	/* Enable response in I/O space */
 #define  PCI_COMMAND_MEMORY	0x2	/* Enable response in Memory space */
 #define  PCI_COMMAND_MASTER	0x4	/* Enable bus master */
+#define  PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
 #define PCI_STATUS              0x06    /* 16 bits */
 #define PCI_REVISION_ID         0x08    /* 8 bits  */
 #define PCI_CLASS_PROG		0x09	/* Reg. Level Programming Interface */
hw/test-irq.c new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
1.6.2.5