From df56bf1d4d1c1a83a160315aa0cea4fe5e84181c Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 14 Sep 2021 01:10:55 -0700 Subject: [PATCH] sim: Move System specific code out of MemPools. Move that code into SEWorkload which already has to know about System objects. The MemPool(s) object(s) now only have to worry about AddrRanges and AddrRangeLists and don't have to know or care where they came from. Change-Id: Ic23aeb959d6f666b655d010c8572c41c60b5aa57 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50350 Tested-by: kokoro Maintainer: Gabe Black Reviewed-by: Matthew Poremba --- src/sim/mem_pool.cc | 11 +---------- src/sim/mem_pool.hh | 5 ++--- src/sim/se_workload.cc | 9 ++++++++- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/sim/mem_pool.cc b/src/sim/mem_pool.cc index e489110c9b..bd56df8241 100644 --- a/src/sim/mem_pool.cc +++ b/src/sim/mem_pool.cc @@ -33,11 +33,8 @@ #include "sim/mem_pool.hh" -#include - #include "base/addr_range.hh" #include "base/logging.hh" -#include "sim/system.hh" namespace gem5 { @@ -147,14 +144,8 @@ MemPool::unserialize(CheckpointIn &cp) } void -MemPools::populate(const System &sys) +MemPools::populate(const AddrRangeList &memories) { - AddrRangeList memories = sys.getPhysMem().getConfAddrRanges(); - const auto &m5op_range = sys.m5opRange(); - - if (m5op_range.valid()) - memories -= m5op_range; - for (const auto &mem : memories) pools.emplace_back(pageShift, mem.start(), mem.end()); } diff --git a/src/sim/mem_pool.hh b/src/sim/mem_pool.hh index 613d763923..a2a00d54bb 100644 --- a/src/sim/mem_pool.hh +++ b/src/sim/mem_pool.hh @@ -36,14 +36,13 @@ #include +#include "base/addr_range.hh" #include "base/types.hh" #include "sim/serialize.hh" namespace gem5 { -class System; - /** Class for handling allocation of physical pages in SE mode. */ class MemPool : public Serializable { @@ -96,7 +95,7 @@ class MemPools : public Serializable public: MemPools(Addr page_shift) : pageShift(page_shift) {} - void populate(const System &sys); + void populate(const AddrRangeList &memories); /// Allocate npages contiguous unused physical pages. /// @return Starting address of first page diff --git a/src/sim/se_workload.cc b/src/sim/se_workload.cc index 47bdb1cc09..d3c857048b 100644 --- a/src/sim/se_workload.cc +++ b/src/sim/se_workload.cc @@ -43,7 +43,14 @@ void SEWorkload::setSystem(System *sys) { Workload::setSystem(sys); - memPools.populate(*sys); + + AddrRangeList memories = sys->getPhysMem().getConfAddrRanges(); + const auto &m5op_range = sys->m5opRange(); + + if (m5op_range.valid()) + memories -= m5op_range; + + memPools.populate(memories); } void