From 87328c2fc15746ed50619d7c1785ae737e04cb54 Mon Sep 17 00:00:00 2001 From: Adrian Herrera Date: Wed, 8 Jul 2020 17:03:34 +0100 Subject: [PATCH] dev-arm: FVPBasePwrCtrl, fix vector resizing (1) ThreadContexts are registered into System in BaseCPU::init. (2) FVPBasePwrCtrl state is resized based on registered ThreadContexts in FVPBasePwrCtrl::init. FVPBasePwrCtrl::init may be called before BaseCPU::init based on the model names alphabetical order, leading to segmentation faults. To fix this, (2) is now carried out in FVPBasePwrCtrl::startup. Change-Id: Ica6c5b7448da556d61aee53f8777a709fcad2212 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35075 Reviewed-by: Giacomo Travaglini Maintainer: Giacomo Travaglini Tested-by: kokoro --- src/dev/arm/fvp_base_pwr_ctrl.cc | 4 ++-- src/dev/arm/fvp_base_pwr_ctrl.hh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dev/arm/fvp_base_pwr_ctrl.cc b/src/dev/arm/fvp_base_pwr_ctrl.cc index fc66e1c33..d6b6a5980 100644 --- a/src/dev/arm/fvp_base_pwr_ctrl.cc +++ b/src/dev/arm/fvp_base_pwr_ctrl.cc @@ -58,13 +58,13 @@ FVPBasePwrCtrl::FVPBasePwrCtrl(FVPBasePwrCtrlParams *const params) } void -FVPBasePwrCtrl::init() +FVPBasePwrCtrl::startup() { // All cores are ON by default (PwrStatus.{l0,l1} = 0b1) corePwrStatus.resize(sys->threads.size(), 0x60000000); for (const auto &tc : sys->threads) poweredCoresPerCluster[tc->socketId()] += 1; - BasicPioDevice::init(); + BasicPioDevice::startup(); } void diff --git a/src/dev/arm/fvp_base_pwr_ctrl.hh b/src/dev/arm/fvp_base_pwr_ctrl.hh index aa446a866..92c31980a 100644 --- a/src/dev/arm/fvp_base_pwr_ctrl.hh +++ b/src/dev/arm/fvp_base_pwr_ctrl.hh @@ -88,7 +88,7 @@ class FVPBasePwrCtrl : public BasicPioDevice */ void clearWakeRequest(ThreadContext *const tc); - void init() override; + void startup() override; protected: Tick read(PacketPtr pkt) override; -- 2.30.2