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 V5 2/2] arm: virt: add PMU property to mach-virt machine type
Date: Thu, 22 Sep 2016 11:13:23 -0400 [thread overview]
Message-ID: <1474557203-4977-3-git-send-email-wei@redhat.com> (raw)
In-Reply-To: <1474557203-4977-1-git-send-email-wei@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 <wei@redhat.com>
---
hw/arm/virt.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a781ad0..a211b22 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 {
@@ -1287,6 +1288,8 @@ static void machvirt_init(MachineState *machine)
for (n = 0; n < smp_cpus; n++) {
Object *cpuobj = object_new(typename);
+ ARMCPU *cpu = ARM_CPU(cpuobj);
+
if (!vmc->disallow_affinity_adjustment) {
/* Adjust MPIDR like 64-bit KVM hosts, which incorporate the
* GIC's target-list limitations. 32-bit KVM hosts currently
@@ -1317,6 +1320,12 @@ static void machvirt_init(MachineState *machine)
}
}
+ if (cpu->has_pmu == ON_OFF_AUTO_AUTO &&
+ object_property_find(cpuobj, "pmu", NULL)) {
+ cpu->has_pmu = vmc->pmu_default_on && kvm_enabled() ?
+ ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF;
+ }
+
if (object_property_find(cpuobj, "reset-cbar", NULL)) {
object_property_set_int(cpuobj, vbi->memmap[VIRT_CPUPERIPHS].base,
"reset-cbar", &error_abort);
@@ -1514,6 +1523,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 +1544,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
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 V5 2/2] arm: virt: add PMU property to mach-virt machine type
Date: Thu, 22 Sep 2016 11:13:23 -0400 [thread overview]
Message-ID: <1474557203-4977-3-git-send-email-wei@redhat.com> (raw)
In-Reply-To: <1474557203-4977-1-git-send-email-wei@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 <wei@redhat.com>
---
hw/arm/virt.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index a781ad0..a211b22 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 {
@@ -1287,6 +1288,8 @@ static void machvirt_init(MachineState *machine)
for (n = 0; n < smp_cpus; n++) {
Object *cpuobj = object_new(typename);
+ ARMCPU *cpu = ARM_CPU(cpuobj);
+
if (!vmc->disallow_affinity_adjustment) {
/* Adjust MPIDR like 64-bit KVM hosts, which incorporate the
* GIC's target-list limitations. 32-bit KVM hosts currently
@@ -1317,6 +1320,12 @@ static void machvirt_init(MachineState *machine)
}
}
+ if (cpu->has_pmu == ON_OFF_AUTO_AUTO &&
+ object_property_find(cpuobj, "pmu", NULL)) {
+ cpu->has_pmu = vmc->pmu_default_on && kvm_enabled() ?
+ ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF;
+ }
+
if (object_property_find(cpuobj, "reset-cbar", NULL)) {
object_property_set_int(cpuobj, vbi->memmap[VIRT_CPUPERIPHS].base,
"reset-cbar", &error_abort);
@@ -1514,6 +1523,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 +1544,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
next prev parent reply other threads:[~2016-09-22 15:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 15:13 [Qemu-devel] [PATCH V5 0/2] Add option to configure guest vPMU Wei Huang
2016-09-22 15:13 ` Wei Huang
2016-09-22 15:13 ` [Qemu-devel] [PATCH V5 1/2] arm64: Add an option to turn on/off vPMU support Wei Huang
2016-09-22 15:13 ` Wei Huang
2016-09-23 6:37 ` [Qemu-arm] " Andrew Jones
2016-09-23 6:37 ` Andrew Jones
2016-09-23 12:21 ` [Qemu-arm] " Andrea Bolognani
2016-09-23 12:21 ` [Qemu-devel] " Andrea Bolognani
2016-09-22 15:13 ` Wei Huang [this message]
2016-09-22 15:13 ` [Qemu-devel] [PATCH V5 2/2] arm: virt: add PMU property to mach-virt machine type Wei Huang
2016-09-23 6:43 ` [Qemu-arm] " Andrew Jones
2016-09-23 6:43 ` Andrew Jones
2016-09-23 12:21 ` [Qemu-arm] " Andrea Bolognani
2016-09-23 12:21 ` [Qemu-devel] " Andrea Bolognani
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=1474557203-4977-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.