qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Questions regarding how QEMU initializes virtual peripherals
@ 2018-02-08 10:06 Ramy Sameh
  2018-02-08 10:59 ` Igor Mammedov
  0 siblings, 1 reply; 3+ messages in thread
From: Ramy Sameh @ 2018-02-08 10:06 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Mona Safar, Watheq, Ahmed Aly

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 ?
2.) Where is the entry point for the whole initialization functionalities
(that will eventually call "object_init_with_type")

Thank you.

-- 
Best Regards,
Ramy Sameh
Embedded Software Engineer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Questions regarding how QEMU initializes virtual peripherals
  2018-02-08 10:06 [Qemu-devel] Questions regarding how QEMU initializes virtual peripherals Ramy Sameh
@ 2018-02-08 10:59 ` Igor Mammedov
  2018-02-09 12:56   ` Ramy Sameh
  0 siblings, 1 reply; 3+ messages in thread
From: Igor Mammedov @ 2018-02-08 10:59 UTC (permalink / raw)
  To: Ramy Sameh; +Cc: QEMU Developers, Mona Safar, Watheq, Ahmed Aly

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.
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Questions regarding how QEMU initializes virtual peripherals
  2018-02-08 10:59 ` Igor Mammedov
@ 2018-02-09 12:56   ` Ramy Sameh
  0 siblings, 0 replies; 3+ messages in thread
From: Ramy Sameh @ 2018-02-09 12:56 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: QEMU Developers, Mona Safar, Watheq, Ahmed Aly

Many thanks Igor for this valuable info.

On Thu, Feb 8, 2018 at 12:59 PM, Igor Mammedov <imammedo@redhat.com> wrote:

> 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.
> >
>
>


-- 
Best Regards,
Ramy Sameh
Embedded Software Engineer
+2-010-172-777-14

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-09 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-08 10:06 [Qemu-devel] Questions regarding how QEMU initializes virtual peripherals Ramy Sameh
2018-02-08 10:59 ` Igor Mammedov
2018-02-09 12:56   ` Ramy Sameh

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).