qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 1/6] Add cfgend parameter for ARM CPU selecti


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 1/6] Add cfgend parameter for ARM CPU selection.
Date: Thu, 19 Jan 2017 15:12:49 +0000

On 18 January 2017 at 16:52, Eduardo Habkost <address@hidden> wrote:
> On Tue, Jan 17, 2017 at 11:52:24AM +0000, Peter Maydell wrote:
>> Oops, I'd forgotten there was board-specific code for handling
>> cpu feature flags. I think we want to change the other boards
>> to do it like the virt board does, but maybe I'm wrong.
>> I've cc'd Eduardo who will hopefully know the right way to handle
>> this.
>
> I don't understand what's missing here: cpu_arm_init() already
> calls cpu_generic_init(), which already calls
> CPUClass::parse_features() after splitting the cpu_model string
> and calling CPUClass::class_by_name().

Well, the 'virt' board calls cc->parse_features() directly,
and so (judging by grep) do a handful of other boards, but most
don't. Is this the right new thing going forward, and do we
need to convert the remaining boards over to match?

> Which board aree you using to test this? Is the board calling
> cpu_arm_init() to create the CPU?

It looks like only a very few ARM boards still call
cpu_arm_init() [just musicpal, omap, pxa2xx, strongarm and the
v7m ones] -- most do something like:

   ObjectClass *cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
   [...]

        Object *cpuobj = object_new(object_class_get_name(cpu_oc));

        if (!secure) {
            object_property_set_bool(cpuobj, false, "has_el3", NULL);
        }

        if (object_property_find(cpuobj, "reset-cbar", NULL)) {
            object_property_set_int(cpuobj, periphbase,
                                    "reset-cbar", &error_abort);
        }
        object_property_set_bool(cpuobj, true, "realized", &error_fatal);

(that example is from hw/arm/vexpress.c)

This is because cpu_generic_init() provides no way for the
board to set CPU properties -- it does both the object init
and realize in one go.

I'm actually looking at a patch at the moment that attempts
to fix this by adding a cpu_generic_init_unrealized(),
which does everything that cpu_generic_init() does except
the final "set the realized prop to true" step, so that you
can call it, set CPU properties and then realize the CPU
yourself. Does that sound like a good idea, or a bad idea?
[https://github.com/mdavidsaver/qemu/commit/82823fb6f97859dc5f2945bd3b2733df2c81b2d8]

I'm not sure which board Julian is using, but I guess it's one
of the ones that doesn't call cpu_generic_init().

thanks
-- PMM



reply via email to

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