From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mm8BA-000446-NB for qemu-devel@nongnu.org; Fri, 11 Sep 2009 11:36:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mm8B6-00042F-69 for qemu-devel@nongnu.org; Fri, 11 Sep 2009 11:36:52 -0400 Received: from [199.232.76.173] (port=41090 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mm8B5-00042A-V4 for qemu-devel@nongnu.org; Fri, 11 Sep 2009 11:36:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28241) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mm8B5-0002O6-Gl for qemu-devel@nongnu.org; Fri, 11 Sep 2009 11:36:47 -0400 From: Juan Quintela In-Reply-To: <4AAA6C21.8060909@redhat.com> (Gerd Hoffmann's message of "Fri, 11 Sep 2009 17:26:25 +0200") References: <4AAA6C21.8060909@redhat.com> Date: Fri, 11 Sep 2009 17:34:07 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: make qdev to use already assigned memory List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Gerd Hoffmann wrote: > Hi, > >> DeviceState *qdev_create_here(DeviceState *dev, BusState *bus, const char *name) >> >> The only change is that it don't want qemu_malloc(), it just initialize >> the device in the memory that I bring there. Why do I want this? > > I'd prefer to not have such a function. > > At the end of the qdev conversion we want to have all drivers in a > state where you can create the devices using the basic sequence ... > > (1) qdev_create() > (2) setting properties > (2) qdev_init() > > ... from generic code. qdev_create_here() simply doesn't fit in > here. It can by definition not be called by generic code. Only a very > few special cases could actually make use of it. > > It would make alot of sense to allow *bus* data structures being > embedded though. A bus is never ever created on its own, it is > allways created by the parent device (lsi creates a scsi bus, ...). > Would that solve your problems? At least it is a big step in the right direction :) I think we would have to set with this one for now. If I found any other pattern, would let you know. > I think that one can also be solved by splitting pci bus registration > and pci bus irq setup into two functions. It will fix this one. >> hw/fdc.c > >> struct fdctrl_t { >> /* Command FIFO */ /* 1st field */ >> uint8_t fifo[512]; >> .... >> }; > >> And now I will call qemu_memalign() for the whole structure. > > Doesn't fly. isa-fdc is pretty close to the state where it can be > created via -device, we just need the drive windup. When creating the > floppy controller via '-device isa-fdc,driveA=foo,driveB=bar' or > simliar, who will call qemu_memalign then? Also note that DeviceState > must be at offset zero of the device state struct. I know this one in borderline (to say the less), but I was just putting the examples where i needed them in the last two days. I.e. that they weren't "theoretical" problems. Thanks, Juan.