All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Alistair Francis <alistair23@gmail.com>
Cc: sundeep subbaraya <sundeep.lkml@gmail.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>
Subject: Re: [Qemu-devel] [Qemu-devel RFC v2 1/4] msf2: Add Smartfusion2 System timer
Date: Mon, 24 Apr 2017 18:58:54 +0100	[thread overview]
Message-ID: <CAFEAcA_PuC_B6GqL0n==SDZooQj9FtviHK3XixHd=m0Twmfp+A@mail.gmail.com> (raw)
In-Reply-To: <CAKmqyKMT9Bn7OPU+h6o2Xj4DZXrVSBHr=jtR6jMSvhph0koegA@mail.gmail.com>

On 24 April 2017 at 18:44, Alistair Francis <alistair23@gmail.com> 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

  reply	other threads:[~2017-04-24 17:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-09 11:19 [Qemu-devel] [Qemu-devel RFC v2 0/4] Add support for Smartfusion2 SoC Subbaraya Sundeep
2017-04-09 11:19 ` [Qemu-devel] [Qemu-devel RFC v2 1/4] msf2: Add Smartfusion2 System timer Subbaraya Sundeep
2017-04-14 21:28   ` Alistair Francis
2017-04-17 10:21     ` sundeep subbaraya
2017-04-24 17:44       ` Alistair Francis
2017-04-24 17:58         ` Peter Maydell [this message]
2017-04-25 10:07           ` sundeep subbaraya
2017-04-25 10:36         ` sundeep subbaraya
2017-04-27 18:53           ` Alistair Francis
2017-04-28 14:19             ` sundeep subbaraya
2017-04-09 11:19 ` [Qemu-devel] [Qemu-devel RFC v2 2/4] msf2: Microsemi Smartfusion2 System Register block Subbaraya Sundeep
2017-04-14 21:32   ` Alistair Francis
2017-04-17 10:25     ` sundeep subbaraya
2017-04-09 11:19 ` [Qemu-devel] [Qemu-devel RFC v2 3/4] msf2: Add Smartfusion2 SPI controller Subbaraya Sundeep
2017-04-09 11:19 ` [Qemu-devel] [Qemu-devel RFC v2 4/4] msf2: Add Emcraft's Smartfusion2 SOM kit Subbaraya Sundeep
2017-04-14 21:12   ` Alistair Francis
2017-04-17 10:44     ` sundeep subbaraya
2017-04-24 17:53       ` Alistair Francis
2017-04-25 10:04         ` sundeep subbaraya
2017-04-13  3:21 ` [Qemu-devel] [Qemu-devel RFC v2 0/4] Add support for Smartfusion2 SoC sundeep subbaraya
2017-04-13  9:44   ` Peter Maydell
2017-04-13 10:33     ` sundeep subbaraya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFEAcA_PuC_B6GqL0n==SDZooQj9FtviHK3XixHd=m0Twmfp+A@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=alistair23@gmail.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sundeep.lkml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.