From 4df1ce63b8faf90401b5a9f0eb1de471aab59bfc Mon Sep 17 00:00:00 2001 From: Greg Bellows Date: Mon, 12 Feb 2018 13:51:29 -0500 Subject: [PATCH] target-arm: Add CPU property to disable AArch64 Adds registration and get/set functions for enabling/disabling the AArch64 execution state on AArch64 CPUs. By default AArch64 execution state is enabled on AArch64 CPUs, setting the property to off, will disable the execution state. The below QEMU invocation would have AArch64 execution state disabled. $ ./qemu-system-aarch64 -machine virt -cpu cortex-a57,aarch64=off Also adds stripping of features from CPU model string in acquiring the ARM CPU by name. Backports part of commit fb8d6c24b095c426151b9bba8c8b0e58b03d6503 from qemu --- qemu/target-arm/cpu.c | 2 +- qemu/target-arm/cpu64.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/qemu/target-arm/cpu.c b/qemu/target-arm/cpu.c index 4c4a470a..ec9d342d 100644 --- a/qemu/target-arm/cpu.c +++ b/qemu/target-arm/cpu.c @@ -272,7 +272,7 @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) } #endif -static bool arm_cpu_is_big_endian(CPUState *cs) +static QEMU_UNUSED_FUNC bool arm_cpu_is_big_endian(CPUState *cs) { ARMCPU *cpu = ARM_CPU(NULL, cs); CPUARMState *env = &cpu->env; diff --git a/qemu/target-arm/cpu64.c b/qemu/target-arm/cpu64.c index ce083e37..a84fce58 100644 --- a/qemu/target-arm/cpu64.c +++ b/qemu/target-arm/cpu64.c @@ -28,6 +28,11 @@ static inline void set_feature(CPUARMState *env, int feature) env->features |= 1ULL << feature; } +static inline QEMU_UNUSED_FUNC void unset_feature(CPUARMState *env, int feature) +{ + env->features &= ~(1ULL << feature); +} + #ifndef CONFIG_USER_ONLY static uint64_t a57_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) { @@ -154,6 +159,13 @@ static const ARMCPUInfo aarch64_cpus[] = { { NULL } }; +static QEMU_UNUSED_FUNC bool aarch64_cpu_get_aarch64(Object *obj, Error **errp) +{ + ARMCPU *cpu = ARM_CPU(NULL, obj); + + return arm_feature(&cpu->env, ARM_FEATURE_AARCH64); +} + static void aarch64_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque) { }