From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1banF5-0007aO-Ni for qemu-devel@nongnu.org; Fri, 19 Aug 2016 13:06:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1banF4-0001KN-PO for qemu-devel@nongnu.org; Fri, 19 Aug 2016 13:06:03 -0400 References: <1471067570-7503-1-git-send-email-wei@redhat.com> From: Wei Huang Message-ID: Date: Fri, 19 Aug 2016 12:05:50 -0500 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V1 1/1] arm64: Add an option to turn on/off host-backed vPMU support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Andrew Jones , qemu-arm , Shannon Zhao , Andrea Bolognani On 08/15/2016 11:13 AM, Peter Maydell wrote: >> 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;