* [Qemu-devel] [PATCH] irq: introduce qemu_irq_proxy()
@ 2011-09-18 12:58 Avi Kivity
2011-09-18 13:37 ` Avi Kivity
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Avi Kivity @ 2011-09-18 12:58 UTC (permalink / raw)
To: Richard Henderson, Anthony Liguori, qemu-devel
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.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
Turns out the circular dependency i8259->isa->pci->i8259 is widespread,
so introduce a general means of fixing it up. I'll update the patchset to
make use of it everywhere it occurs.
hw/irq.c | 14 ++++++++++++++
hw/irq.h | 5 +++++
2 files changed, 19 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);
+}
diff --git a/hw/irq.h b/hw/irq.h
index 389ed7a..64da2fd 100644
--- a/hw/irq.h
+++ b/hw/irq.h
@@ -33,4 +33,9 @@ qemu_irq qemu_irq_invert(qemu_irq irq);
/* Returns a new IRQ which feeds into both the passed IRQs */
qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
+/* Returns a new IRQ set which connects 1:1 to another IRQ set, which
+ * may be set later.
+ */
+qemu_irq *qemu_irq_proxy(qemu_irq **target, int n);
+
#endif
--
1.7.6.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] irq: introduce qemu_irq_proxy()
2011-09-18 12:58 [Qemu-devel] [PATCH] irq: introduce qemu_irq_proxy() Avi Kivity
@ 2011-09-18 13:37 ` Avi Kivity
2011-09-18 14:18 ` Richard Henderson
2011-09-23 18:51 ` Anthony Liguori
2 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2011-09-18 13:37 UTC (permalink / raw)
To: Richard Henderson, Anthony Liguori, qemu-devel
On 09/18/2011 03:58 PM, Avi Kivity wrote:
> 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.
>
> Signed-off-by: Avi Kivity<avi@redhat.com>
> ---
>
> Turns out the circular dependency i8259->isa->pci->i8259 is widespread,
> so introduce a general means of fixing it up. I'll update the patchset to
> make use of it everywhere it occurs.
In fact the other cases were solved without qemu_irq_proxy(), but I
think qemu_irq_proxy() is nicer than the previous patch, so I'll keep it
if no one objects.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] irq: introduce qemu_irq_proxy()
2011-09-18 12:58 [Qemu-devel] [PATCH] irq: introduce qemu_irq_proxy() Avi Kivity
2011-09-18 13:37 ` Avi Kivity
@ 2011-09-18 14:18 ` Richard Henderson
2011-09-23 18:51 ` Anthony Liguori
2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2011-09-18 14:18 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel
On 09/18/2011 05:58 AM, Avi Kivity wrote:
> 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.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
> ---
>
> Turns out the circular dependency i8259->isa->pci->i8259 is widespread,
> so introduce a general means of fixing it up. I'll update the patchset to
> make use of it everywhere it occurs.
>
> hw/irq.c | 14 ++++++++++++++
> hw/irq.h | 5 +++++
> 2 files changed, 19 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);
> +}
> diff --git a/hw/irq.h b/hw/irq.h
> index 389ed7a..64da2fd 100644
> --- a/hw/irq.h
> +++ b/hw/irq.h
> @@ -33,4 +33,9 @@ qemu_irq qemu_irq_invert(qemu_irq irq);
> /* Returns a new IRQ which feeds into both the passed IRQs */
> qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
>
> +/* Returns a new IRQ set which connects 1:1 to another IRQ set, which
> + * may be set later.
> + */
> +qemu_irq *qemu_irq_proxy(qemu_irq **target, int n);
> +
> #endif
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] irq: introduce qemu_irq_proxy()
2011-09-18 12:58 [Qemu-devel] [PATCH] irq: introduce qemu_irq_proxy() Avi Kivity
2011-09-18 13:37 ` Avi Kivity
2011-09-18 14:18 ` Richard Henderson
@ 2011-09-23 18:51 ` Anthony Liguori
2 siblings, 0 replies; 4+ messages in thread
From: Anthony Liguori @ 2011-09-23 18:51 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel, Richard Henderson
On 09/18/2011 07:58 AM, Avi Kivity wrote:
> 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.
>
> Signed-off-by: Avi Kivity<avi@redhat.com>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
>
> Turns out the circular dependency i8259->isa->pci->i8259 is widespread,
> so introduce a general means of fixing it up. I'll update the patchset to
> make use of it everywhere it occurs.
>
> hw/irq.c | 14 ++++++++++++++
> hw/irq.h | 5 +++++
> 2 files changed, 19 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);
> +}
> diff --git a/hw/irq.h b/hw/irq.h
> index 389ed7a..64da2fd 100644
> --- a/hw/irq.h
> +++ b/hw/irq.h
> @@ -33,4 +33,9 @@ qemu_irq qemu_irq_invert(qemu_irq irq);
> /* Returns a new IRQ which feeds into both the passed IRQs */
> qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
>
> +/* Returns a new IRQ set which connects 1:1 to another IRQ set, which
> + * may be set later.
> + */
> +qemu_irq *qemu_irq_proxy(qemu_irq **target, int n);
> +
> #endif
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-09-23 18:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-18 12:58 [Qemu-devel] [PATCH] irq: introduce qemu_irq_proxy() Avi Kivity
2011-09-18 13:37 ` Avi Kivity
2011-09-18 14:18 ` Richard Henderson
2011-09-23 18:51 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).