diff options
author | Ruben Ayrapetyan <ruben.ayrapetyan@arm.com> | 2019-01-29 19:19:51 +0000 |
---|---|---|
committer | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2019-02-08 09:41:25 +0000 |
commit | c2b6aac2a8b2ee650a9c220daa6ef75635781f2a (patch) | |
tree | 68c988492d9f10061c8f1379f0bc39ec27a55788 /src/arch/arm/pmu.cc | |
parent | 34b73dea1b144fcc5707d618acd950f7f1506806 (diff) | |
download | gem5-c2b6aac2a8b2ee650a9c220daa6ef75635781f2a.tar.xz |
arch-arm: Fix initialization of PMU counters
A version of Linux kernel initializes counters before enabling them.
Without this change, gem5 overwrites the value of counter, which causes
incorrect counter values derived by kernel.
Change-Id: If0c515111103018d5f65f74434d7711a67aeaee4
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/16203
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/arch/arm/pmu.cc')
-rw-r--r-- | src/arch/arm/pmu.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/arch/arm/pmu.cc b/src/arch/arm/pmu.cc index f6cf87294..30425153f 100644 --- a/src/arch/arm/pmu.cc +++ b/src/arch/arm/pmu.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2014, 2017-2018 ARM Limited + * Copyright (c) 2011-2014, 2017-2019 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -532,7 +532,10 @@ PMU::CounterState::detach() void PMU::CounterState::attach(PMUEvent* event) { - value = 0; + if (!resetValue) { + value = 0; + resetValue = true; + } sourceEvent = event; sourceEvent->attachEvent(this); } |