From patchwork Wed Sep 14 06:09:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Huang X-Patchwork-Id: 669740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sYrkZ6DGyz9sf6 for ; Wed, 14 Sep 2016 16:10:29 +1000 (AEST) Received: from localhost ([::1]:53325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bk3Os-0002Hx-7l for incoming@patchwork.ozlabs.org; Wed, 14 Sep 2016 02:10:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bk3Nh-0001LV-5p for qemu-devel@nongnu.org; Wed, 14 Sep 2016 02:09:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bk3Ng-0006Vq-5V for qemu-devel@nongnu.org; Wed, 14 Sep 2016 02:09:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bk3Nb-0006Uh-N1; Wed, 14 Sep 2016 02:09:07 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 60A8710570; Wed, 14 Sep 2016 06:09:07 +0000 (UTC) Received: from apm-mustang-ev3-30.khw.lab.eng.bos.redhat.com (apm-mustang-ev3-30.khw.lab.eng.bos.redhat.com [10.16.184.124]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8E694T0002896; Wed, 14 Sep 2016 02:09:06 -0400 From: Wei Huang To: qemu-arm@nongnu.org Date: Wed, 14 Sep 2016 02:09:03 -0400 Message-Id: <1473833343-31531-3-git-send-email-wei@redhat.com> In-Reply-To: <1473833343-31531-1-git-send-email-wei@redhat.com> References: <1473833343-31531-1-git-send-email-wei@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 14 Sep 2016 06:09:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH V2 2/2] arm: virt: add PMU property to machvirt machine type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, drjones@redhat.com, qemu-devel@nongnu.org, abologna@redhat.com, shannon.zhao@linaro.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" CPU vPMU is now turned off by default, but it was ON in virt-2.7 machine type. To solve this problem, this patch adds a PMU option in machine state, which is used to control CPU's vPMU status. This PMU option is not exposed to command line and is turned on in virt-2.7 machine type to make sure it is backward compatible. Signed-off-by: Wei Huang --- hw/arm/virt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index a781ad0..83cfea7 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -91,6 +91,7 @@ typedef struct { bool secure; bool highmem; int32_t gic_version; + bool pmu; } VirtMachineState; #define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt") @@ -1317,6 +1318,11 @@ static void machvirt_init(MachineState *machine) } } + if (vms->pmu) { + /* Note: the property name is "pmu", not "has_pmu" */ + object_property_set_bool(cpuobj, true, "pmu", NULL); + } + if (object_property_find(cpuobj, "reset-cbar", NULL)) { object_property_set_int(cpuobj, vbi->memmap[VIRT_CPUPERIPHS].base, "reset-cbar", &error_abort); @@ -1510,6 +1516,8 @@ static void virt_2_7_instance_init(Object *obj) object_property_set_description(obj, "gic-version", "Set GIC version. " "Valid values are 2, 3 and host", NULL); + /* Default PMU is on for 2.7 */ + vms->pmu = true; } static void virt_machine_2_7_options(MachineClass *mc) @@ -1522,7 +1530,11 @@ DEFINE_VIRT_MACHINE_AS_LATEST(2, 7) static void virt_2_6_instance_init(Object *obj) { + VirtMachineState *vms = VIRT_MACHINE(obj); + virt_2_7_instance_init(obj); + /* Default PMU is off for 2.6 */ + vms->pmu = false; } static void virt_machine_2_6_options(MachineClass *mc)