summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-10-14 17:51:15 -0700
committerGabe Black <gabeblack@google.com>2019-10-25 22:42:31 +0000
commitea267682e6936ce1a6cfb8edd42bab8676a8a649 (patch)
tree2faee3238fb7254db07d038dd71e8e1ea3a426aa
parent44831fabfb74993a2222a67f55c9f21d7843cbdb (diff)
downloadgem5-ea267682e6936ce1a6cfb8edd42bab8676a8a649.tar.xz
cpu: Get rid of the nextInstEventCount method.
This was only used by the KVM CPU, and it has access to all it needs to figure out that value locally without requiring all the ThreadContexts to implement an equivalent function. Change-Id: I17a14ce669db2519edf129db761ebd8dc3bd4129 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22114 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
-rw-r--r--src/arch/arm/fastmodel/iris/thread_context.hh1
-rw-r--r--src/cpu/checker/thread_context.hh5
-rw-r--r--src/cpu/kvm/base.cc10
-rw-r--r--src/cpu/o3/thread_context.hh6
-rw-r--r--src/cpu/simple_thread.hh6
-rw-r--r--src/cpu/thread_context.hh1
6 files changed, 6 insertions, 23 deletions
diff --git a/src/arch/arm/fastmodel/iris/thread_context.hh b/src/arch/arm/fastmodel/iris/thread_context.hh
index ef5214333..acb325cdb 100644
--- a/src/arch/arm/fastmodel/iris/thread_context.hh
+++ b/src/arch/arm/fastmodel/iris/thread_context.hh
@@ -96,7 +96,6 @@ class ThreadContext : public ::ThreadContext
bool schedule(PCEvent *e) override { return false; }
bool remove(PCEvent *e) override { return false; }
- Tick nextInstEventCount() override { return MaxTick; }
void scheduleInstCountEvent(Event *event, Tick count) override {}
void descheduleInstCountEvent(Event *event) override {}
Tick getCurrentInstCount() override;
diff --git a/src/cpu/checker/thread_context.hh b/src/cpu/checker/thread_context.hh
index d32e0fa70..347c4bab6 100644
--- a/src/cpu/checker/thread_context.hh
+++ b/src/cpu/checker/thread_context.hh
@@ -92,11 +92,6 @@ class CheckerThreadContext : public ThreadContext
bool schedule(PCEvent *e) override { return actualTC->schedule(e); }
bool remove(PCEvent *e) override { return actualTC->remove(e); }
- Tick
- nextInstEventCount() override
- {
- return actualTC->nextInstEventCount();
- }
void
scheduleInstCountEvent(Event *event, Tick count) override
{
diff --git a/src/cpu/kvm/base.cc b/src/cpu/kvm/base.cc
index 2522eeeb2..83cb04f47 100644
--- a/src/cpu/kvm/base.cc
+++ b/src/cpu/kvm/base.cc
@@ -630,7 +630,9 @@ BaseKvmCPU::tick()
case RunningServiceCompletion:
case Running: {
- const uint64_t nextInstEvent(tc->nextInstEventCount());
+ auto &queue = thread->comInstEventQueue;
+ const uint64_t nextInstEvent(
+ queue.empty() ? MaxTick : queue.nextTick());
// Enter into KVM and complete pending IO instructions if we
// have an instruction event pending.
const Tick ticksToExecute(
@@ -686,7 +688,7 @@ BaseKvmCPU::tick()
// Service any pending instruction events. The vCPU should
// have exited in time for the event using the instruction
// counter configured by setupInstStop().
- thread->comInstEventQueue.serviceEvents(ctrInsts);
+ queue.serviceEvents(ctrInsts);
if (tryDrain())
_status = Idle;
@@ -1346,10 +1348,10 @@ BaseKvmCPU::ioctlRun()
void
BaseKvmCPU::setupInstStop()
{
- Tick next = tc->nextInstEventCount();
- if (next == MaxTick) {
+ if (thread->comInstEventQueue.empty()) {
setupInstCounter(0);
} else {
+ Tick next = thread->comInstEventQueue.nextTick();
assert(next > ctrInsts);
setupInstCounter(next - ctrInsts);
}
diff --git a/src/cpu/o3/thread_context.hh b/src/cpu/o3/thread_context.hh
index 65496429b..c68f34c07 100644
--- a/src/cpu/o3/thread_context.hh
+++ b/src/cpu/o3/thread_context.hh
@@ -86,12 +86,6 @@ class O3ThreadContext : public ThreadContext
return thread->pcEventQueue.remove(e);
}
- Tick
- nextInstEventCount() override
- {
- return thread->comInstEventQueue.empty() ?
- MaxTick : thread->comInstEventQueue.nextTick();
- }
void
scheduleInstCountEvent(Event *event, Tick count) override
{
diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh
index 367eceab3..3a7c85a90 100644
--- a/src/cpu/simple_thread.hh
+++ b/src/cpu/simple_thread.hh
@@ -198,12 +198,6 @@ class SimpleThread : public ThreadState, public ThreadContext
bool schedule(PCEvent *e) override { return pcEventQueue.schedule(e); }
bool remove(PCEvent *e) override { return pcEventQueue.remove(e); }
- Tick
- nextInstEventCount() override
- {
- return comInstEventQueue.empty() ?
- MaxTick : comInstEventQueue.nextTick();
- }
void
scheduleInstCountEvent(Event *event, Tick count) override
{
diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh
index 2e1b572e6..a77ac4848 100644
--- a/src/cpu/thread_context.hh
+++ b/src/cpu/thread_context.hh
@@ -192,7 +192,6 @@ class ThreadContext : public PCEventScope
virtual EndQuiesceEvent *getQuiesceEvent() = 0;
- virtual Tick nextInstEventCount() = 0;
virtual void scheduleInstCountEvent(Event *event, Tick count) = 0;
virtual void descheduleInstCountEvent(Event *event) = 0;
virtual Tick getCurrentInstCount() = 0;