summaryrefslogtreecommitdiff
path: root/qtest.c
diff options
context:
space:
mode:
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>2014-09-25 22:21:31 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2014-10-23 16:41:25 +0200
commit60a79016aed70c4ebcd45a8006c46dc9c397685a (patch)
tree9cb16a960c0625fc69a6ea36e0b16e67a7ecc7b1 /qtest.c
parent0c24db2b8c60cb578d7af6fb50c0ad60a723a02d (diff)
qtest/irq: Rework IRQ interception
Change the qtest intercept handler to accept just the individual IRQ being intercepted as opaque. n is still expected to be correctly set as for the original intercepted irq. qemu_intercept_irq_in is updated accordingly. Then covert the qemu_irq_intercept_out call to use qdev intercept version. This stops qtest from having to mess with the raw IRQ pointers (still has to mess with names and counts but a step in the right direction). Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qtest.c')
-rw-r--r--qtest.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/qtest.c b/qtest.c
index 4b85995de0..946b560d6a 100644
--- a/qtest.c
+++ b/qtest.c
@@ -201,8 +201,8 @@ static void GCC_FMT_ATTR(2, 3) qtest_send(CharDriverState *chr,
static void qtest_irq_handler(void *opaque, int n, int level)
{
- qemu_irq *old_irqs = opaque;
- qemu_set_irq(old_irqs[n], level);
+ qemu_irq old_irq = *(qemu_irq *)opaque;
+ qemu_set_irq(old_irq, level);
if (irq_levels[n] != level) {
CharDriverState *chr = qtest_chr;
@@ -264,8 +264,15 @@ static void qtest_process_command(CharDriverState *chr, gchar **words)
continue;
}
if (words[0][14] == 'o') {
- qemu_irq_intercept_out(&ngl->out, qtest_irq_handler,
- ngl->num_out);
+ int i;
+ for (i = 0; i < ngl->num_out; ++i) {
+ qemu_irq *disconnected = g_new0(qemu_irq, 1);
+ qemu_irq icpt = qemu_allocate_irq(qtest_irq_handler,
+ disconnected, i);
+
+ *disconnected = qdev_intercept_gpio_out(dev, icpt,
+ ngl->name, i);
+ }
} else {
qemu_irq_intercept_in(ngl->in, qtest_irq_handler,
ngl->num_in);