From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPFPI-0000KU-5x for qemu-devel@nongnu.org; Wed, 25 May 2011 10:49:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPFPH-0000Jr-AY for qemu-devel@nongnu.org; Wed, 25 May 2011 10:49:56 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:37169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPFPH-0000JL-4s for qemu-devel@nongnu.org; Wed, 25 May 2011 10:49:55 -0400 Received: by wwj40 with SMTP id 40so7672074wwj.10 for ; Wed, 25 May 2011 07:49:54 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4DDCAFD6.1060900@redhat.com> Date: Wed, 25 May 2011 09:29:26 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1306237507-19189-1-git-send-email-pbonzini@redhat.com> <1306237507-19189-2-git-send-email-pbonzini@redhat.com> <20110524221222.GA11809@yookeroo.fritz.box> In-Reply-To: <20110524221222.GA11809@yookeroo.fritz.box> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] spapr: allow creating devices with -device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, agraf@suse.de, David Gibson On 05/25/2011 12:12 AM, David Gibson wrote: >> @@ -602,6 +604,8 @@ static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo) >> } >> >> dev->qdev.id = id; >> + dev->vio_irq_num = bus->irq++; >> + dev->qirq = xics_find_qirq(spapr->icp, dev->vio_irq_num); > > I'd prefer to see an spapr_allocate_irq() function, rather than open > coding this multiple times. I don't understand. This is the only call to xics_find_qirq, unlike before this patch. It's not open coded multiple times. I can surely add a spapr_allocate_irq() function that would keep the code independent of the particular interrupt controller. Would you prefer something that gives back the virtual IRQ number as well: qemu_irq *spapr_allocate_irq(uint32_t *p_vio_irq_num) or should I keep that in the VIOsPAPRBus, like this: qemu_irq *spapr_allocate_irq(uint32_t p_vio_irq_num) ? Should I pass a sPAPREnvironment too, or should it just use the global? Paolo