[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Questions regarding how QEMU initializes virtual periph
Re: [Qemu-devel] Questions regarding how QEMU initializes virtual peripherals
Thu, 8 Feb 2018 11:59:14 +0100
On Thu, 8 Feb 2018 12:06:44 +0200
Ramy Sameh <address@hidden> 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.