From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bkOqb-0002vF-8k for qemu-devel@nongnu.org; Thu, 15 Sep 2016 01:04:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bkOqa-00035e-8r for qemu-devel@nongnu.org; Thu, 15 Sep 2016 01:04:29 -0400 From: Wei Huang Date: Thu, 15 Sep 2016 01:04:16 -0400 Message-Id: <1473915856-23801-3-git-send-email-wei@redhat.com> In-Reply-To: <1473915856-23801-1-git-send-email-wei@redhat.com> References: <1473915856-23801-1-git-send-email-wei@redhat.com> Subject: [Qemu-devel] [PATCH V3 2/2] arm: virt: add PMU property to mach-virt machine type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org, drjones@redhat.com, shannon.zhao@linaro.org, abologna@redhat.com 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 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index a781ad0..a3fc454 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -84,6 +84,7 @@ typedef struct { MachineClass parent; VirtBoardInfo *daughterboard; bool disallow_affinity_adjustment; + bool pmu_default_on; } VirtMachineClass; typedef struct { @@ -1317,6 +1318,11 @@ static void machvirt_init(MachineState *machine) } } + if (vmc->pmu_default_on) { + /* Property name is "pmu", defined in arm_cpu_has_pmu_property */ + 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); @@ -1514,6 +1520,9 @@ static void virt_2_7_instance_init(Object *obj) static void virt_machine_2_7_options(MachineClass *mc) { + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc)); + + vmc->pmu_default_on = true; } DEFINE_VIRT_MACHINE_AS_LATEST(2, 7) @@ -1532,5 +1541,9 @@ static void virt_machine_2_6_options(MachineClass *mc) virt_machine_2_7_options(mc); SET_MACHINE_COMPAT(mc, VIRT_COMPAT_2_6); vmc->disallow_affinity_adjustment = true; + /* Disable PMU for 2.6 and down as PMU support was first introduced + * and enabled in 2.7. + */ + vmc->pmu_default_on = false; } DEFINE_VIRT_MACHINE(2, 6) -- 1.8.3.1