diff options
author | Akash Bagdia <akash.bagdia@ARM.com> | 2014-12-09 10:42:08 +0000 |
---|---|---|
committer | Akash Bagdia <akash.bagdia@ARM.com> | 2014-12-09 10:42:08 +0000 |
commit | 1c34ee20dfbbd557e394d61825232b10c0f3d37f (patch) | |
tree | b3a6cedf9cb10fec3c0722df7301bc1c5cca1507 /src/cpu/base.cc | |
parent | 3ee4957b4930a252c0185a6bc71bdf1c6ebc5ed9 (diff) | |
download | gem5-1c34ee20dfbbd557e394d61825232b10c0f3d37f.tar.xz |
power: Low-power idle power state for idle CPUs
Add functionality to the BaseCPU that will put the entire CPU into a low-power
idle state whenever all threads in it are idle.
Diffstat (limited to 'src/cpu/base.cc')
-rw-r--r-- | src/cpu/base.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/cpu/base.cc b/src/cpu/base.cc index 624843f42..0f9fe49ea 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -64,6 +64,7 @@ #include "debug/SyscallVerbose.hh" #include "mem/page_table.hh" #include "params/BaseCPU.hh" +#include "sim/clocked_object.hh" #include "sim/full_system.hh" #include "sim/process.hh" #include "sim/sim_events.hh" @@ -355,6 +356,11 @@ BaseCPU::startup() if (params()->progress_interval) { new CPUProgressEvent(this, params()->progress_interval); } + + // Assumption CPU start to operate instantaneously without any latency + if (ClockedObject::pwrState() == Enums::PwrState::UNDEFINED) + ClockedObject::pwrState(Enums::PwrState::ON); + } ProbePoints::PMUUPtr @@ -473,6 +479,27 @@ BaseCPU::findContext(ThreadContext *tc) } void +BaseCPU::activateContext(ThreadID thread_num) +{ + // For any active thread running, update CPU power state to active (ON) + ClockedObject::pwrState(Enums::PwrState::ON); +} + +void +BaseCPU::suspendContext(ThreadID thread_num) +{ + // Check if all threads are suspended + for (auto t : threadContexts) { + if (t->status() != ThreadContext::Suspended) { + return; + } + } + + // All CPU threads suspended, enter lower power state for the CPU + ClockedObject::pwrState(Enums::PwrState::CLK_GATED); +} + +void BaseCPU::switchOut() { assert(!_switchedOut); |