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 <arm...@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> --- hw/arm/vexpress.c | 3 ++- hw/arm/virt.c | 2 +- hw/cpu/a15mpcore.c | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index fd981f4c33..753a645c05 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -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); } } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 2793121cb4..35eb01a3dc 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -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); } diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c index cebfe142cf..1fa079b3b8 100644 --- a/hw/cpu/a15mpcore.c +++ b/hw/cpu/a15mpcore.c @@ -73,9 +73,11 @@ static void a15mp_priv_realize(DeviceState *dev, Error **errp) qdev_prop_set_bit(gicdev, "has-security-extensions", true); } /* Similarly for virtualization support */ - has_el2 = object_property_find(cpuobj, "has_el2") && + has_el2 = arm_feature(cpu_env(cpu), ARM_FEATURE_EL2); + if (has_el2) { object_property_get_bool(cpuobj, "has_el2", &error_abort); - qdev_prop_set_bit(gicdev, "has-virtualization-extensions", has_el2); + qdev_prop_set_bit(gicdev, "has-virtualization-extensions", true); + } } if (!sysbus_realize(SYS_BUS_DEVICE(&s->gic), errp)) { -- 2.41.0