diff mbox

[1/1] target/arm: clear PMUVER field of AA64DFR0 when vPMU=off

Message ID 1495123889-32301-1-git-send-email-wei@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Huang May 18, 2017, 4:11 p.m. UTC
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(-)

Comments

Peter Maydell May 30, 2017, 3:37 p.m. UTC | #1
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
diff mbox

Patch

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)) {