From: Ruben Ayrapetyan Date: Tue, 29 Jan 2019 19:19:51 +0000 (+0000) Subject: arch-arm: Fix initialization of PMU counters X-Git-Tag: v19.0.0.0~1182 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2b6aac2a8b2ee650a9c220daa6ef75635781f2a;p=gem5.git 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 Reviewed-on: https://gem5-review.googlesource.com/c/16203 Maintainer: Andreas Sandberg --- 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); }