[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: make qdev to use already assigned memory
From: |
Juan Quintela |
Subject: |
[Qemu-devel] Re: make qdev to use already assigned memory |
Date: |
Fri, 11 Sep 2009 17:34:07 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Gerd Hoffmann <address@hidden> 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.