[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-devel RFC v2 1/4] msf2: Add Smartfusion2 System t
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [Qemu-devel RFC v2 1/4] msf2: Add Smartfusion2 System timer |
Date: |
Mon, 24 Apr 2017 18:58:54 +0100 |
On 24 April 2017 at 18:44, Alistair Francis <address@hidden> wrote:
> Basically the simple explanation is that init is called when the
> object is created and realize is called when the object is realized.
>
> Generally for devices it will go something like this:
> 1. init
> 2. Set properties
> 3. Connect things
> 4. realize
> 5. Map to memory
>
>> Don't we need to use realize function for new models?
>
> AFAIK we still put things like: sysbus_init_irq(),
> memory_region_init_io() and sysbus_init_mmio() in the init function.
>
> I don't think we are at a stage yet to not use init functions.
Two-phase init is here to stay -- some things must be done in
init, some must be done in realize, and some can be done in
either. Some simple devices may find they can do everything
in only one function.
Must be done in init:
* creating properties (for the cases where that is done "by hand"
by calling object_property_add_*())
* calling init on child objects which you want to pass through
alias properties for
Must be done in realize:
* anything that can fail such that we need to report the
error and abandon creation of the device
* anything which depends on the values of QOM properties that
the caller might have set
We should probably sit down and write up some guidelines for
how we recommend dealing with the various things that could
be called in either function -- this is basically a code
style and consistency question.
thanks
-- PMM
[Qemu-devel] [Qemu-devel RFC v2 2/4] msf2: Microsemi Smartfusion2 System Register block., Subbaraya Sundeep, 2017/04/09
[Qemu-devel] [Qemu-devel RFC v2 3/4] msf2: Add Smartfusion2 SPI controller, Subbaraya Sundeep, 2017/04/09
[Qemu-devel] [Qemu-devel RFC v2 4/4] msf2: Add Emcraft's Smartfusion2 SOM kit., Subbaraya Sundeep, 2017/04/09