@@ -218,12 +218,13 @@ static void init_cpus(MachineState *ms, const char *cpu_type,
/* Create the actual CPUs */
for (n = 0; n < smp_cpus; n++) {
Object *cpuobj = object_new(cpu_type);
+ ARMCPU *cpu = ARM_CPU(cpuobj);
if (!secure) {
object_property_set_bool(cpuobj, "has_el3", false, NULL);
}
if (!virt) {
- if (object_property_find(cpuobj, "has_el2")) {
+ if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) {
object_property_set_bool(cpuobj, "has_el2", false, NULL);
}
}
@@ -2146,7 +2146,7 @@ static void machvirt_init(MachineState *machine)
object_property_set_bool(cpuobj, "has_el3", false, NULL);
}
- if (!vms->virt && object_property_find(cpuobj, "has_el2")) {
+ if (!vms->virt && arm_feature(cpu_env(cs), ARM_FEATURE_EL2)) {
object_property_set_bool(cpuobj, "has_el2", false, NULL);
}
@@ -74,9 +74,12 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp)
&error_abort));
}
/* Similarly for virtualization support */
- has_el2 = object_property_find(cpuobj, "has_el2") &&
- object_property_get_bool(cpuobj, "has_el2", &error_abort);
- qdev_prop_set_bit(gicdev, "has-virtualization-extensions", has_el2);
+ has_el2 = arm_feature(cpu_env(cpu), ARM_FEATURE_EL2);
+ if (has_el2) {
+ qdev_prop_set_bit(gicdev, "has-virtualization-extensions",
+ object_property_get_bool(cpuobj, "has_el2",
+ &error_abort));
+ }
}
if (!sysbus_realize(SYS_BUS_DEVICE(&s->gic), errp)) {
The "has_el2" property is added to ARMCPU when the ARM_FEATURE_EL2 feature is available. Rather than checking whether the QOM property is present, directly check the feature. Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/arm/vexpress.c | 3 ++- hw/arm/virt.c | 2 +- hw/cpu/a15mpcore.c | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-)