From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAncP-0005aH-Hy for qemu-devel@nongnu.org; Fri, 15 Apr 2011 14:19:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QAncL-0005tZ-NY for qemu-devel@nongnu.org; Fri, 15 Apr 2011 14:19:45 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:44435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAncL-0005sf-K5 for qemu-devel@nongnu.org; Fri, 15 Apr 2011 14:19:41 -0400 Received: by vws17 with SMTP id 17so2697516vws.4 for ; Fri, 15 Apr 2011 11:19:41 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1302801540-10491-1-git-send-email-weil@mail.berlios.de> References: <1302801540-10491-1-git-send-email-weil@mail.berlios.de> From: Blue Swirl Date: Fri, 15 Apr 2011 21:19:21 +0300 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] sparc: Fix assertion caused by empty memory slot with 0 byte List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: QEMU Developers Thanks, applied. On Thu, Apr 14, 2011 at 8:19 PM, Stefan Weil wrote: > If the memory size given on the command line is equal to the > maximum size of memory defined by the hardware, there is no > "empty slot" after physical memory. > > The following command > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0qemu-system-sparc = -m 256 > > raised an assertion: > exec.c:2614: cpu_register_physical_memory_offset: Assertion `size' failed > > This can be fixed either at the caller side (don't call empty_slot_init) > or in empty_slot_init (do nothing) when size =3D=3D 0. The second solutio= n > was choosen here because it is more robust. > > Signed-off-by: Stefan Weil > --- > =C2=A0hw/empty_slot.c | =C2=A0 21 ++++++++++++--------- > =C2=A01 files changed, 12 insertions(+), 9 deletions(-) > > diff --git a/hw/empty_slot.c b/hw/empty_slot.c > index 664b8d9..da8adc4 100644 > --- a/hw/empty_slot.c > +++ b/hw/empty_slot.c > @@ -53,18 +53,21 @@ static CPUWriteMemoryFunc * const empty_slot_write[3]= =3D { > > =C2=A0void empty_slot_init(target_phys_addr_t addr, uint64_t slot_size) > =C2=A0{ > - =C2=A0 =C2=A0DeviceState *dev; > - =C2=A0 =C2=A0SysBusDevice *s; > - =C2=A0 =C2=A0EmptySlot *e; > + =C2=A0 =C2=A0if (slot_size > 0) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Only empty slots larger than 0 byte need = handling. */ > + =C2=A0 =C2=A0 =C2=A0 =C2=A0DeviceState *dev; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0SysBusDevice *s; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0EmptySlot *e; > > - =C2=A0 =C2=A0dev =3D qdev_create(NULL, "empty_slot"); > - =C2=A0 =C2=A0s =3D sysbus_from_qdev(dev); > - =C2=A0 =C2=A0e =3D FROM_SYSBUS(EmptySlot, s); > - =C2=A0 =C2=A0e->size =3D slot_size; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0dev =3D qdev_create(NULL, "empty_slot"); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0s =3D sysbus_from_qdev(dev); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0e =3D FROM_SYSBUS(EmptySlot, s); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0e->size =3D slot_size; > > - =C2=A0 =C2=A0qdev_init_nofail(dev); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0qdev_init_nofail(dev); > > - =C2=A0 =C2=A0sysbus_mmio_map(s, 0, addr); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0sysbus_mmio_map(s, 0, addr); > + =C2=A0 =C2=A0} > =C2=A0} > > =C2=A0static int empty_slot_init1(SysBusDevice *dev) > -- > 1.7.2.5 > >