From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QepIF-00077e-Tn for qemu-devel@nongnu.org; Thu, 07 Jul 2011 10:11:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QepID-0000zX-Ob for qemu-devel@nongnu.org; Thu, 07 Jul 2011 10:11:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34112 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QepID-0000zM-3Y for qemu-devel@nongnu.org; Thu, 07 Jul 2011 10:11:01 -0400 Message-ID: <4E15BE6B.4000101@suse.de> Date: Thu, 07 Jul 2011 16:10:51 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1306403566-31597-1-git-send-email-pbonzini@redhat.com> <1306403566-31597-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1306403566-31597-2-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/3] spapr: proper qdevification List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, david@gibson.dropbear.id.au On 05/26/2011 11:52 AM, Paolo Bonzini wrote: > Right now the spapr devices cannot be instantiated with -device, > because the IRQs need to be passed to the spapr_*_create functions. > Do this instead in the bus's init wrapper. > > This is particularly important with the conversion from scsi-disk > to scsi-{cd,hd} that Markus made. After his patches, if you > specify a scsi-cd device attached to an if=none drive, the default > VSCSI controller will not be created and, without qdevification, > you will not be able to add yours. > > Signed-off-by: Paolo Bonzini > Cc: Alexander Graf > Cc: David Gibson > --- > hw/spapr.c | 15 +++++---------- > hw/spapr.h | 6 ++++++ > hw/spapr_llan.c | 7 +------ > hw/spapr_vio.c | 5 +++++ > hw/spapr_vio.h | 13 ++++--------- > hw/spapr_vscsi.c | 8 +------- > hw/spapr_vty.c | 8 +------- > 7 files changed, 23 insertions(+), 39 deletions(-) > > diff --git a/hw/spapr.c b/hw/spapr.c > index 109b774..07b2165 100644 > --- a/hw/spapr.c > +++ b/hw/spapr.c > @@ -298,7 +298,6 @@ static void ppc_spapr_init(ram_addr_t ram_size, > long kernel_size, initrd_size, fw_size; > long pteg_shift = 17; > char *filename; > - int irq = 16; > > spapr = qemu_malloc(sizeof(*spapr)); > cpu_ppc_hypercall = emulate_spapr_hypercall; > @@ -360,15 +359,14 @@ static void ppc_spapr_init(ram_addr_t ram_size, > /* Set up VIO bus */ > spapr->vio_bus = spapr_vio_bus_init(); > > - for (i = 0; i< MAX_SERIAL_PORTS; i++, irq++) { > + for (i = 0; i< MAX_SERIAL_PORTS; i++) { > if (serial_hds[i]) { > spapr_vty_create(spapr->vio_bus, SPAPR_VTY_BASE_ADDRESS + i, > - serial_hds[i], xics_find_qirq(spapr->icp, irq), > - irq); > + serial_hds[i]); > } > } > > - for (i = 0; i< nb_nics; i++, irq++) { > + for (i = 0; i< nb_nics; i++) { > NICInfo *nd =&nd_table[i]; > > if (!nd->model) { > @@ -376,8 +374,7 @@ static void ppc_spapr_init(ram_addr_t ram_size, > } > > if (strcmp(nd->model, "ibmveth") == 0) { > - spapr_vlan_create(spapr->vio_bus, 0x1000 + i, nd, > - xics_find_qirq(spapr->icp, irq), irq); > + spapr_vlan_create(spapr->vio_bus, 0x1000 + i, nd); > } else { > fprintf(stderr, "pSeries (sPAPR) platform does not support " > "NIC model '%s' (only ibmveth is supported)\n", > @@ -387,9 +384,7 @@ static void ppc_spapr_init(ram_addr_t ram_size, > } > > for (i = 0; i<= drive_get_max_bus(IF_SCSI); i++) { > - spapr_vscsi_create(spapr->vio_bus, 0x2000 + i, > - xics_find_qirq(spapr->icp, irq), irq); > - irq++; > + spapr_vscsi_create(spapr->vio_bus, 0x2000 + i); > } > > if (kernel_filename) { > diff --git a/hw/spapr.h b/hw/spapr.h > index b52133a..4130c13 100644 > --- a/hw/spapr.h > +++ b/hw/spapr.h > @@ -278,6 +278,12 @@ void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn); > target_ulong spapr_hypercall(CPUState *env, target_ulong opcode, > target_ulong *args); > > +static inline qemu_irq *spapr_find_qirq(sPAPREnvironment *spapr, > + int irq_num) > +{ > + return xics_find_qirq(spapr->icp, irq_num); > +} > + This breaks with current HEAD. I've added a fix to my tree: diff --git a/hw/spapr.h b/hw/spapr.h index 4130c13..a725d4a 100644 --- a/hw/spapr.h +++ b/hw/spapr.h @@ -1,6 +1,8 @@ #if !defined(__HW_SPAPR_H__) #define __HW_SPAPR_H__ +#include "hw/xics.h" + struct VIOsPAPRBus; struct icp_state; @@ -278,7 +280,7 @@ void spapr_register_hypercall(target_ulong opcode, spapr_hcall_fn fn); target_ulong spapr_hypercall(CPUState *env, target_ulong opcode, target_ulong *args); -static inline qemu_irq *spapr_find_qirq(sPAPREnvironment *spapr, +static inline qemu_irq spapr_find_qirq(sPAPREnvironment *spapr, int irq_num) { return xics_find_qirq(spapr->icp, irq_num); Alex