summaryrefslogtreecommitdiffstats
path: root/hw/irq.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-09-18 15:58:26 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2011-09-23 11:51:05 -0500
commit22ec3283efba9ba0792790da786d6776d83f2a92 (patch)
tree79557ca07b0d21f73ff43c4b7258e47b5ec971dc /hw/irq.c
parente22517086bbdf8d09de2b9ba8b3dfa4c42ec0f6c (diff)
downloadhqemu-22ec3283efba9ba0792790da786d6776d83f2a92.zip
hqemu-22ec3283efba9ba0792790da786d6776d83f2a92.tar.gz
irq: introduce qemu_irq_proxy()
In some cases we have a circular dependency involving irqs - the irq controller depends on a bus, which in turn depends on the irq controller. Add qemu_irq_proxy() which acts as a passthrough, except that the target irq may be set later on. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/irq.c')
-rw-r--r--hw/irq.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/irq.c b/hw/irq.c
index 60eabe8..62f766e 100644
--- a/hw/irq.c
+++ b/hw/irq.c
@@ -90,3 +90,17 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2)
s[1] = irq2;
return qemu_allocate_irqs(qemu_splitirq, s, 1)[0];
}
+
+static void proxy_irq_handler(void *opaque, int n, int level)
+{
+ qemu_irq **target = opaque;
+
+ if (*target) {
+ qemu_set_irq((*target)[n], level);
+ }
+}
+
+qemu_irq *qemu_irq_proxy(qemu_irq **target, int n)
+{
+ return qemu_allocate_irqs(proxy_irq_handler, target, n);
+}
OpenPOWER on IntegriCloud