qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Alistair Francis <alistair.francis@xilinx.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>
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	[thread overview]
Message-ID: <539EC63B.4030401@suse.de> (raw)
In-Reply-To: <CAKmqyKNhKNX6nYo5EeMjzky-6xZB=uy1OMRvsT+_ppgGM90mkA@mail.gmail.com>

Am 16.06.2014 08:04, schrieb Alistair Francis:
> On Mon, Jun 16, 2014 at 2:43 PM, Peter Crosthwaite
> <peter.crosthwaite@xilinx.com> wrote:
>> On Tue, Jun 10, 2014 at 11:32 AM, Alistair Francis
>> <alistair.francis@xilinx.com> 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 <alistair.francis@xilinx.com>
>>> ---
>>> 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	other threads:[~2014-06-16 10:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10  1:32 [Qemu-devel] [RFC v1 1/2] arm: Add the cortex-a9 CPU to the a9mpcore device Alistair Francis
2014-06-10  1:33 ` [Qemu-devel] [RFC v1 2/2] zynq: Update Zynq to init the CPU in " Alistair Francis
2014-06-16  4:42   ` Peter Crosthwaite
2014-06-16  6:50     ` Alistair Francis
2014-06-16  1:17 ` [Qemu-devel] [RFC v1 1/2] arm: Add the cortex-a9 CPU to " Alistair Francis
2014-06-16  4:43 ` Peter Crosthwaite
2014-06-16  6:04   ` Alistair Francis
2014-06-16 10:26     ` Andreas Färber [this message]
2014-06-16 10:19   ` Andreas Färber
2014-06-16 10:34     ` Peter Crosthwaite
2014-06-16 10:58       ` Andreas Färber
2014-06-16 11:11         ` Peter Maydell
2014-06-16 11:17           ` Andreas Färber
2014-06-16 11:22           ` Peter Crosthwaite
2014-06-16 11:23             ` Andreas Färber
2014-06-16 10:44     ` Peter Maydell
2014-06-16 11:18       ` Andreas Färber
2014-06-16 11:20         ` Peter Maydell
2014-06-16  7:40 ` Peter Maydell
2014-06-16  7:46   ` Peter Crosthwaite
2014-06-17  7:16     ` Stefan Hajnoczi
2014-06-17  8:05       ` Paolo Bonzini
2014-06-17 10:12         ` Peter Crosthwaite
2014-06-17 23:33           ` Alistair Francis

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=539EC63B.4030401@suse.de \
    --to=afaerber@suse.de \
    --cc=alistair.francis@xilinx.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).