On 08/15/2016 11:13 AM, Peter Maydell wrote: <snip> >> static inline int arm_feature(CPUARMState *env, int feature) >> diff --git a/target-arm/cpu64.c b/target-arm/cpu64.c >> index 1635deb..19e8127 100644 >> --- a/target-arm/cpu64.c >> +++ b/target-arm/cpu64.c >> @@ -111,6 +111,9 @@ static void aarch64_a57_initfn(Object *obj) >> set_feature(&cpu->env, ARM_FEATURE_V8_PMULL); >> set_feature(&cpu->env, ARM_FEATURE_CRC); >> set_feature(&cpu->env, ARM_FEATURE_EL3); >> + if (kvm_enabled()) { >> + set_feature(&cpu->env, ARM_FEATURE_HOST_PMU); >> + } >> cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A57; >> cpu->midr = 0x411fd070; >> cpu->revidr = 0x00000000; >> @@ -166,6 +169,9 @@ static void aarch64_a53_initfn(Object *obj) >> set_feature(&cpu->env, ARM_FEATURE_V8_PMULL); >> set_feature(&cpu->env, ARM_FEATURE_CRC); >> set_feature(&cpu->env, ARM_FEATURE_EL3); >> + if (kvm_enabled()) { >> + set_feature(&cpu->env, ARM_FEATURE_HOST_PMU); >> + } > > This definitely looks like the wrong place to be checking > kvm_enabled().
If we don't want to check kvm_enabled() in aarch64_a5x_initfn(), one viable place is to move it up to cpu.c file, like in arm_cpu_realizefn(). Do you have any other suggestions? > >> cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A53; >> cpu->midr = 0x410fd034; >> cpu->revidr = 0x00000000;