qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Ramy Sameh <ramysameh26@gmail.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Mona Safar <Mona.Safar@eng.asu.edu.eg>, Watheq <watheq@gmail.com>,
	Ahmed Aly <ahmedaly50@gmail.com>
Subject: Re: [Qemu-devel] Questions regarding how QEMU initializes virtual peripherals
Date: Thu, 8 Feb 2018 11:59:14 +0100	[thread overview]
Message-ID: <20180208115914.7df7bf87@redhat.com> (raw)
In-Reply-To: <CAF6HrYx6fKVAACMN1TFV_9xKU42RP1yULQpwjvV9jtDExZq8JA@mail.gmail.com>

On Thu, 8 Feb 2018 12:06:44 +0200
Ramy Sameh <ramysameh26@gmail.com> wrote:

> Hello all,
> 
> I am working with QEMU to simulate VersatilePB board.
> 
> I am trying to understand how QEMU initialize the virtual peripherals (e.g.
> UART, vectored Interrupt controller .. etc).
> 
> When I traced the code, I found a function called "object_init_with_type"
> in object.c, in which the function pointer "ti->instance_init(obj)" seems
> to call the peripherals initialization functions.
> 
> *I have couple of questions here:*
> 1.) Some peripheral initialization functions are called multiple times such
> as pl011_init, why is that ?
function is called once for each instance of pl011 object.

QEMU uses custom OOM framework (dubbed QOM), good point to start with it
is probably to read doc comment in the beginning of include/qom/object.h

Device objects are typically inherited from TYPE_DEVICE or its derivatives.
Device init sequence typically looks like:
   foo = object_new(TYPE_FOO);
   // set_properties on foo, see object_property_set_...

   // and set special property 'realize' which would call 'realize' method
   object_property_set_bool(foo, true, "realized");

See qdev_device_add() for details

> 2.) Where is the entry point for the whole initialization functionalities
> (that will eventually call "object_init_with_type")

object_new() & co + object_initialize_with_type()

> Thank you.
> 

  reply	other threads:[~2018-02-08 10:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 10:06 [Qemu-devel] Questions regarding how QEMU initializes virtual peripherals Ramy Sameh
2018-02-08 10:59 ` Igor Mammedov [this message]
2018-02-09 12:56   ` Ramy Sameh

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=20180208115914.7df7bf87@redhat.com \
    --to=imammedo@redhat.com \
    --cc=Mona.Safar@eng.asu.edu.eg \
    --cc=ahmedaly50@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ramysameh26@gmail.com \
    --cc=watheq@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).