[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/28] qtest/irq: Rework IRQ interception
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 09/28] qtest/irq: Rework IRQ interception |
Date: |
Mon, 27 Oct 2014 16:13:26 +0100 |
From: Peter Crosthwaite <address@hidden>
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 <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/core/irq.c | 2 +-
qtest.c | 15 +++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/hw/core/irq.c b/hw/core/irq.c
index cffced0..4a580a2 100644
--- a/hw/core/irq.c
+++ b/hw/core/irq.c
@@ -140,7 +140,7 @@ void qemu_irq_intercept_in(qemu_irq *gpio_in,
qemu_irq_handler handler, int n)
for (i = 0; i < n; i++) {
*old_irqs[i] = *gpio_in[i];
gpio_in[i]->handler = handler;
- gpio_in[i]->opaque = old_irqs;
+ gpio_in[i]->opaque = &old_irqs[i];
}
}
diff --git a/qtest.c b/qtest.c
index 4b85995..946b560 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);
--
1.8.3.1
- [Qemu-devel] [PULL 00/28] Changes for 2014-10-27, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 06/28] qom: Demote already-has-a-parent to a regular error, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 07/28] qdev: gpio: Re-implement qdev_connect_gpio QOM style, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 02/28] virtio-scsi: dataplane: print why starting failed, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 04/28] virtio-scsi: dataplane: stop trying on notifier error, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 01/28] virtio-scsi-dataplane: Add op blocker, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 05/28] qom: Allow clearing of a Link property, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 09/28] qtest/irq: Rework IRQ interception,
Paolo Bonzini <=
- [Qemu-devel] [PULL 03/28] virtio-scsi: dataplane: fail setup gracefully, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 10/28] irq: Remove qemu_irq_intercept_out, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 08/28] qdev: gpio: Add API for intercepting a GPIO, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 11/28] qdev: gpio: delete NamedGPIOList::out, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 12/28] qdev: gpio: Remove qdev_init_gpio_out x1 restriction, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 13/28] qdev: gpio: Define qdev_pass_gpios(), Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 14/28] sysbus: Use TYPE_DEVICE GPIO functionality, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 16/28] MAINTAINERS: grab more files from Anthony's pile, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 15/28] target-i386: warns users when CPU threads>1 for non-Intel CPUs, Paolo Bonzini, 2014/10/27
- [Qemu-devel] [PULL 18/28] MAINTAINERS: add myself for X86, Paolo Bonzini, 2014/10/27