All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Huang <wei@redhat.com>
To: qemu-arm@nongnu.org
Cc: peter.maydell@linaro.org, drjones@redhat.com,
	qemu-devel@nongnu.org, abologna@redhat.com,
	shannon.zhao@linaro.org
Subject: [Qemu-arm] [PATCH V7 2/2] arm: virt: add PMU property to mach-virt machine type
Date: Fri, 21 Oct 2016 17:53:02 -0400	[thread overview]
Message-ID: <1477086782-10479-3-git-send-email-wei@redhat.com> (raw)
In-Reply-To: <1477086782-10479-1-git-send-email-wei@redhat.com>

CPU vPMU is now turned ON by default, but this feature wasn't introduced
until 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 off in
virt-2.6 machine type.

Signed-off-by: Wei Huang <wei@redhat.com>
---
 hw/arm/virt.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 074d11c..e64dc4a 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -85,6 +85,7 @@ typedef struct {
     VirtBoardInfo *daughterboard;
     bool disallow_affinity_adjustment;
     bool no_its;
+    bool no_pmu;
 } VirtMachineClass;
 
 typedef struct {
@@ -1353,6 +1354,10 @@ static void machvirt_init(MachineState *machine)
             }
         }
 
+        if (vmc->no_pmu && object_property_find(cpuobj, "pmu", NULL)) {
+            object_property_set_bool(cpuobj, false, "pmu", NULL);
+        }
+
         if (object_property_find(cpuobj, "reset-cbar", NULL)) {
             object_property_set_int(cpuobj, vbi->memmap[VIRT_CPUPERIPHS].base,
                                     "reset-cbar", &error_abort);
@@ -1588,5 +1593,7 @@ 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 as PMU support was first introduced in 2.7 */
+    vmc->no_pmu = true;
 }
 DEFINE_VIRT_MACHINE(2, 6)
-- 
1.8.3.1


WARNING: multiple messages have this Message-ID (diff)
From: Wei Huang <wei@redhat.com>
To: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org,
	drjones@redhat.com, shannon.zhao@linaro.org, abologna@redhat.com
Subject: [Qemu-devel] [PATCH V7 2/2] arm: virt: add PMU property to mach-virt machine type
Date: Fri, 21 Oct 2016 17:53:02 -0400	[thread overview]
Message-ID: <1477086782-10479-3-git-send-email-wei@redhat.com> (raw)
In-Reply-To: <1477086782-10479-1-git-send-email-wei@redhat.com>

CPU vPMU is now turned ON by default, but this feature wasn't introduced
until 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 off in
virt-2.6 machine type.

Signed-off-by: Wei Huang <wei@redhat.com>
---
 hw/arm/virt.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 074d11c..e64dc4a 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -85,6 +85,7 @@ typedef struct {
     VirtBoardInfo *daughterboard;
     bool disallow_affinity_adjustment;
     bool no_its;
+    bool no_pmu;
 } VirtMachineClass;
 
 typedef struct {
@@ -1353,6 +1354,10 @@ static void machvirt_init(MachineState *machine)
             }
         }
 
+        if (vmc->no_pmu && object_property_find(cpuobj, "pmu", NULL)) {
+            object_property_set_bool(cpuobj, false, "pmu", NULL);
+        }
+
         if (object_property_find(cpuobj, "reset-cbar", NULL)) {
             object_property_set_int(cpuobj, vbi->memmap[VIRT_CPUPERIPHS].base,
                                     "reset-cbar", &error_abort);
@@ -1588,5 +1593,7 @@ 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 as PMU support was first introduced in 2.7 */
+    vmc->no_pmu = true;
 }
 DEFINE_VIRT_MACHINE(2, 6)
-- 
1.8.3.1

  parent reply	other threads:[~2016-10-21 21:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-21 21:53 [Qemu-arm] [PATCH V7 0/2] Add option to configure guest vPMU Wei Huang
2016-10-21 21:53 ` [Qemu-devel] " Wei Huang
2016-10-21 21:53 ` [Qemu-arm] [PATCH V7 1/2] arm: Add an option to turn on/off vPMU support Wei Huang
2016-10-21 21:53   ` [Qemu-devel] " Wei Huang
2016-10-27 14:24   ` [Qemu-arm] " Peter Maydell
2016-10-27 14:24     ` [Qemu-devel] " Peter Maydell
2016-10-21 21:53 ` Wei Huang [this message]
2016-10-21 21:53   ` [Qemu-devel] [PATCH V7 2/2] arm: virt: add PMU property to mach-virt machine type Wei Huang
2016-10-24  9:13   ` [Qemu-arm] " Andrew Jones
2016-10-24  9:13     ` Andrew Jones
2016-10-24  8:49 ` [Qemu-arm] [Qemu-devel] [PATCH V7 0/2] Add option to configure guest vPMU Andrew Jones
2016-10-24  8:49   ` Andrew Jones
2016-10-25  4:39   ` [Qemu-arm] " Wei Huang
2016-10-25  4:39     ` Wei Huang
2016-10-25  7:33     ` [Qemu-arm] " Andrew Jones
2016-10-25  7:33       ` Andrew Jones
2016-10-25 15:26       ` [Qemu-arm] " Peter Maydell
2016-10-25 15:26         ` Peter Maydell
2016-10-25 15:59         ` [Qemu-arm] " Peter Maydell
2016-10-25 15:59           ` Peter Maydell
2016-10-25 17:16           ` [Qemu-arm] " Wei Huang
2016-10-25 17:16             ` Wei Huang
2016-10-25 16:55         ` [Qemu-arm] " Wei Huang
2016-10-25 16:55           ` Wei Huang
2016-10-25 17:56           ` [Qemu-arm] " Andrew Jones
2016-10-25 17:56             ` Andrew Jones
2016-10-25 18:50             ` [Qemu-arm] " Wei Huang
2016-10-25 18:50               ` Wei Huang
2016-10-26  6:54               ` [Qemu-arm] " Andrew Jones
2016-10-26  6:54                 ` Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477086782-10479-3-git-send-email-wei@redhat.com \
    --to=wei@redhat.com \
    --cc=abologna@redhat.com \
    --cc=drjones@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.