[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 09/16] qtest/irq: Rework IRQ interception
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH v1 09/16] qtest/irq: Rework IRQ interception |
Date: |
Sun, 3 Aug 2014 18:56:25 -0700 |
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 stop qtest from having to mess with the raw IRQ pointers
(still has to mess with names and counts but as step in the right
direction).
Signed-off-by: Peter Crosthwaite <address@hidden>
---
hw/core/irq.c | 2 +-
qtest.c | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/hw/core/irq.c b/hw/core/irq.c
index cffced0..7d6318a 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 04a6dc1..4dd5ff4 100644
--- a/qtest.c
+++ b/qtest.c
@@ -197,8 +197,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 = opaque;
+ qemu_set_irq(old_irq, level);
if (irq_levels[n] != level) {
CharDriverState *chr = qtest_chr;
@@ -260,8 +260,11 @@ 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) {
+ qdev_intercept_gpio_out(dev, qtest_irq_handler,
+ ngl->name, i);
+ }
} else {
qemu_irq_intercept_in(ngl->in, qtest_irq_handler,
ngl->num_in);
--
2.0.1.1.gfbfc394
- [Qemu-devel] [PATCH v1 02/16] qdev: gpio: Register GPIO inputs as child objects, (continued)
- [Qemu-devel] [PATCH v1 02/16] qdev: gpio: Register GPIO inputs as child objects, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 03/16] qdev: gpio: Register GPIO outputs as QOM links, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 04/16] qmp: qstring: Handle NULL strings, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 05/16] qom: Allow clearing of a Link property, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 06/16] qom: Demote already-has-a-parent to a regular error, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 07/16] qdev: gpio: Re-impement qdev_connect_gpio QOM style, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 08/16] qdev: gpio: Add API for intercepting an IRQ, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 09/16] qtest/irq: Rework IRQ interception,
Peter Crosthwaite <=
- [Qemu-devel] [PATCH v1 10/16] irq: Remove qemu_irq_intercept_out, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 11/16] qdev: gpio: delete NamedGPIOList::out, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 12/16] qdev: gpio: Remove qdev_init_gpio_out x1 restriction, Peter Crosthwaite, 2014/08/03
- [Qemu-devel] [PATCH v1 13/16] qdev: gpio: Define qdev_pass_gpios(), Peter Crosthwaite, 2014/08/03