[Top][All Lists]

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

Re: Dynamic instance properties in TYPE_ARM_CPU

From: Peter Maydell
Subject: Re: Dynamic instance properties in TYPE_ARM_CPU
Date: Mon, 26 Oct 2020 17:32:16 +0000

On Mon, 26 Oct 2020 at 17:22, Eduardo Habkost <ehabkost@redhat.com> wrote:
> I've been trying to clean up the qdev property code (to bridge
> the gaps between qdev and QOM, and between QOM and QAPI), and
> I've noticed that TYPE_ARM_CPU is the only remaining user of
> qdev_property_add_static().
> qdev_property_add_static() has a misleading name: it won't
> register a static property.  It is actually a hack to use a
> static Property variable (defined using DEFINE_PROP*), but
> register it as a dynamic instance property.
> Dynamic instance properties make introspection hard.  What can we
> do to get rid of them in TYPE_ARM_CPU?

I'm in principle in favour of this because the Arm handling
of this is a bit odd and it would make sense to bring it
into line with how other parts of QEMU work. (Do other CPU
architectures just provide the properties on all CPUs?)

> Can we just register all the properties unconditionally, and
> error out on realize if the requested CPU configuration is
> incompatible with the available CPU features?

I think you would probably also need to check for and
adjust board/SoC code which assumes that presence of a
property implies that it's OK to set it, eg this in virt.c:

        if (object_property_find(cpuobj, "reset-cbar")) {
            object_property_set_int(cpuobj, "reset-cbar",

or which uses presence-of-property as its check for
"does the CPU support this feature", eg this;
                 * The property exists only if MemTag is supported.
                 * If it is, we must allocate the ram to back that up.
                if (!object_property_find(cpuobj, "tag-memory")) {
                    error_report("MTE requested, but not supported "
                                 "by the guest CPU");

> The following properties are registered as dynamic instance
> properties at arm_cpu_post_init():
> "cntfrq", "reset-cbar", "reset-hivecs", "rvbar", "has_el2",
> "has_el3", "cfgend", "vfp", "neon", "dsp", "has-mpu",
> "pmsav7-dregion", "secure-memory", "pmu", "idau", "init-svtor",
> "tag-memory", "secure-tag-memory".

-- PMM

reply via email to

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