[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v1 0/8] QOM prop overloading + ARM MPCore CP
From: |
Liviu Ionescu |
Subject: |
Re: [Qemu-devel] [RFC PATCH v1 0/8] QOM prop overloading + ARM MPCore CPUs |
Date: |
Mon, 15 Jun 2015 10:29:05 +0300 |
> On 15 Jun 2015, at 01:36, Peter Crosthwaite <address@hidden> wrote:
>
> Liviu recently brought up a desire for arguments to QOM constructors. P8
> would probably be cleaner if this feature existed, as the number of CPUs
> could be set as a constructor argument. There is no flexibility on when
> this has to be set, it must be done immediately after construction so it
> ideally should be part of construction.
as Peter mentioned in another thread, for some situations instance_init() is
too early, realize() is to late.
here is another one, from the implementation of my Cortex-M framework:
DeviceState *mcu = qdev_alloc(NULL, TYPE_STM32F103RB);
{
STM32F103RB_GET_CLASS(mcu)->construct(OBJECT(mcu), machine);
/* Set the board specific oscillator frequencies. */
qdev_prop_set_uint32(mcu, "hse-freq-hz", 8000000); /* 8.0 MHz */
qdev_prop_set_uint32(mcu, "lse-freq-hz", 32768); /* 32 KHz */
}
qdev_realize(mcu);
the two properties are in fact aliases to an internal object that handles
clocks. doing the MCU construction in .instance_init() is not possible, because
it depends on some data not available at that moment, and doing the
construction at realize() is too late, because setting properties will no
longer be possible after this point.
my solution was to add a custom constructor to each class, and manually chain
them up to the parent, as in any OO implementation.
regards,
Liviu
- [Qemu-devel] [RFC PATCH v1 0/8] QOM prop overloading + ARM MPCore CPUs, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [RFC PATCH v1 1/8] qom: Refactor array property code path, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [RFC PATCH v1 2/8] qom: Add property overloading, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [RFC PATCH v1 3/8] qom: Implement overloaded property setters, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [RFC PATCH v1 4/8] qom: Delete all instances of an overloaded property, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [RFC PATCH v1 5/8] qom: Disallow getting/resolving an overloaded property, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [RFC PATCH v1 6/8] qom: Enable overloading of Alias properties, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [RFC PATCH v1 7/8] arm: realview: Factor out CPU property setters, Peter Crosthwaite, 2015/06/14
- [Qemu-devel] [RFC PATCH v1 8/8] arm: axxmpcore: Add CPUs to MPCore, Peter Crosthwaite, 2015/06/14
- Re: [Qemu-devel] [RFC PATCH v1 0/8] QOM prop overloading + ARM MPCore CPUs,
Liviu Ionescu <=
- Re: [Qemu-devel] [RFC PATCH v1 0/8] QOM prop overloading + ARM MPCore CPUs, Alistair Francis, 2015/06/18