Introduce the QOM arm_cpu_is_64bit() helper, which checks whether a vCPU parent class is TYPE_AARCH64_CPU. Use it in arm_cpu_initfn() to remove a TARGET_AARCH64 definition use.
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> --- target/arm/cpu.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 95afa9b72f1..ef95f31f249 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1471,6 +1471,13 @@ uint64_t arm_cpu_mp_affinity(ARMCPU *cpu) return cpu->mp_affinity; } +#ifdef CONFIG_USER_ONLY +static bool arm_cpu_is_64bit(ARMCPU *cpu) +{ + return !!object_dynamic_cast(OBJECT(cpu), TYPE_AARCH64_CPU); +} +#endif + static void arm_cpu_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); @@ -1482,16 +1489,16 @@ static void arm_cpu_initfn(Object *obj) QLIST_INIT(&cpu->el_change_hooks); #ifdef CONFIG_USER_ONLY -# ifdef TARGET_AARCH64 - /* - * The linux kernel defaults to 512-bit for SVE, and 256-bit for SME. - * These values were chosen to fit within the default signal frame. - * See documentation for /proc/sys/abi/{sve,sme}_default_vector_length, - * and our corresponding cpu property. - */ - cpu->sve_default_vq = 4; - cpu->sme_default_vq = 2; -# endif + if (arm_cpu_is_64bit(cpu)) { + /* + * The linux kernel defaults to 512-bit for SVE, and 256-bit for SME. + * These values were chosen to fit within the default signal frame. + * See documentation for /proc/sys/abi/{sve,sme}_default_vector_length, + * and our corresponding cpu property. + */ + cpu->sve_default_vq = 4; + cpu->sme_default_vq = 2; + } #else /* Our inbound IRQ and FIQ lines */ if (kvm_enabled()) { -- 2.47.1