From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:41215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7Aq1-00079q-QL for qemu-devel@nongnu.org; Fri, 23 Sep 2011 14:51:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R7Aq0-0000Ok-IW for qemu-devel@nongnu.org; Fri, 23 Sep 2011 14:51:05 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:50944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R7Aq0-0000Oc-A2 for qemu-devel@nongnu.org; Fri, 23 Sep 2011 14:51:04 -0400 Received: by gye5 with SMTP id 5so3523210gye.4 for ; Fri, 23 Sep 2011 11:51:03 -0700 (PDT) Message-ID: <4E7CD515.6010609@codemonkey.ws> Date: Fri, 23 Sep 2011 13:51:01 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1316350706-21602-1-git-send-email-avi@redhat.com> In-Reply-To: <1316350706-21602-1-git-send-email-avi@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] irq: introduce qemu_irq_proxy() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org, 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 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