qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] target/arm: clear PMUVER field of AA64DFR0 when vPMU=off
@ 2017-05-18 16:11 Wei Huang
  2017-05-30 15:37 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Huang @ 2017-05-18 16:11 UTC (permalink / raw)
  To: qemu-arm; +Cc: qemu-devel, peter.maydell

The PMUv3 driver of linux kernel (in arch/arm64/kernel/perf_event.c)
relies on the PMUVER field of id_aa64dfr0_el1 to decide if PMU support
is present or not. This patch clears the PMUVER field under TCG mode
when vPMU=off. Without it, PMUv3 will init insider guest VMs even
with vPMU=off. This patch also removes a redundant line inside the
if-statement.

Signed-off-by: Wei Huang <wei@redhat.com>
---
 target/arm/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index c185eb1..4e8fe1c 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -750,8 +750,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
     }
 
     if (!cpu->has_pmu) {
-        cpu->has_pmu = false;
         unset_feature(env, ARM_FEATURE_PMU);
+        cpu->id_aa64dfr0 &= ~0xf00;
     }
 
     if (!arm_feature(env, ARM_FEATURE_EL2)) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] target/arm: clear PMUVER field of AA64DFR0 when vPMU=off
  2017-05-18 16:11 [Qemu-devel] [PATCH 1/1] target/arm: clear PMUVER field of AA64DFR0 when vPMU=off Wei Huang
@ 2017-05-30 15:37 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2017-05-30 15:37 UTC (permalink / raw)
  To: Wei Huang; +Cc: qemu-arm, QEMU Developers

On 18 May 2017 at 17:11, Wei Huang <wei@redhat.com> wrote:
> The PMUv3 driver of linux kernel (in arch/arm64/kernel/perf_event.c)
> relies on the PMUVER field of id_aa64dfr0_el1 to decide if PMU support
> is present or not. This patch clears the PMUVER field under TCG mode
> when vPMU=off. Without it, PMUv3 will init insider guest VMs even
> with vPMU=off. This patch also removes a redundant line inside the
> if-statement.
>
> Signed-off-by: Wei Huang <wei@redhat.com>
> ---
>  target/arm/cpu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index c185eb1..4e8fe1c 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -750,8 +750,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
>      }
>
>      if (!cpu->has_pmu) {
> -        cpu->has_pmu = false;
>          unset_feature(env, ARM_FEATURE_PMU);
> +        cpu->id_aa64dfr0 &= ~0xf00;
>      }
>
>      if (!arm_feature(env, ARM_FEATURE_EL2)) {
> --
> 1.8.3.1



Applied to target-arm.next, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-30 15:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-18 16:11 [Qemu-devel] [PATCH 1/1] target/arm: clear PMUVER field of AA64DFR0 when vPMU=off Wei Huang
2017-05-30 15:37 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).