qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC v1 1/2] arm: Add the cortex-a9 CPU to the a9mpcore


From: Andreas Färber
Subject: Re: [Qemu-devel] [RFC v1 1/2] arm: Add the cortex-a9 CPU to the a9mpcore device
Date: Mon, 16 Jun 2014 12:26:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

Am 16.06.2014 08:04, schrieb Alistair Francis:
> On Mon, Jun 16, 2014 at 2:43 PM, Peter Crosthwaite
> <address@hidden> wrote:
>> On Tue, Jun 10, 2014 at 11:32 AM, Alistair Francis
>> <address@hidden> wrote:
>>> This patch adds the Cortex-A9 ARM CPU to the A9MPCore. It
>>> first does a check to make sure no other CPUs exist and if
>>> they do the Cortex-A9 won't be added. This is implemented to
>>> maintain compatibility and can be removed once all machines
>>> have been updated
>>>
>>> This patch also allows the midr and reset-property to be set
>>>
>>> Signed-off-by: Alistair Francis <address@hidden>
>>> ---
>>> There comments in the code explaining the reason that the CPU
>>> is initiated in the realize function. This is because it relies
>>> on the num_cpu property, which isn't yet set in the initfn
>>> Is this an acceptable compromise?
>>>
>>>  hw/cpu/a9mpcore.c         |   43 
>>> +++++++++++++++++++++++++++++++++++++++++++
>>>  include/hw/cpu/a9mpcore.h |    4 ++++
>>>  2 files changed, 47 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c
>>> index c09358c..1159044 100644
>>> --- a/hw/cpu/a9mpcore.c
>>> +++ b/hw/cpu/a9mpcore.c
>>> @@ -21,6 +21,12 @@ static void a9mp_priv_initfn(Object *obj)
>>>  {
>>>      A9MPPrivState *s = A9MPCORE_PRIV(obj);
>>>
>>> +    /* Ideally would init the CPUs here, but the num_cpu property has not 
>>> been
>>> +     * set yet. So that only works if assuming a single CPU
>>> +     * object_initialize(&s->cpu, sizeof(s->cpu), "cortex-a9-" 
>>> TYPE_ARM_CPU);
>>> +     * object_property_add_child(obj, "cpu", OBJECT(&s->cpu), NULL);
>>> +     */
>>> +
>>
>> So you could add an integer property listener to init them earlier (or
>> even do dynamic extending/freeing or the allocated CPUs). I'm not sure
>> exactly what we are really supposed to do though, when the number of
>> child object depends on a prop like this? Andreas?
> 
> I'm open for ideas/opinions. The method used here seemed to be the easiest
> to implement (and actually the only reliable method that I could think of).

The point is that it needs to happen before realize, so that the object
can be inspected and modified before it's too late, and allocations may
fail so should be able to return an error to the caller. If there is
nothing that suits your needs, you can either implement a new type of
static qdev property or, easiest, implement a dynamic QOM property that
takes actions once the number-of-CPUs value is set. An example using
dynamic properties may be found around the sPAPR interrupt controllers.

Cheers,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]