diff --git a/src/cpu/base.cc b/src/cpu/base.cc index 1676061359..29095f12ac 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -389,24 +389,6 @@ BaseCPU::ProfileEvent::process() cpu->schedule(this, curTick + interval); } -void -BaseCPU::postInterrupt(int int_num, int index) -{ - interrupts->post(int_num, index); -} - -void -BaseCPU::clearInterrupt(int int_num, int index) -{ - interrupts->clear(int_num, index); -} - -void -BaseCPU::clearInterrupts() -{ - interrupts->clearAll(); -} - void BaseCPU::serialize(std::ostream &os) { diff --git a/src/cpu/base.hh b/src/cpu/base.hh index 83d73ede04..c8215e047c 100644 --- a/src/cpu/base.hh +++ b/src/cpu/base.hh @@ -125,9 +125,26 @@ class BaseCPU : public MemObject return interrupts; } - virtual void postInterrupt(int int_num, int index); - virtual void clearInterrupt(int int_num, int index); - virtual void clearInterrupts(); + virtual void wakeup() = 0; + + void + postInterrupt(int int_num, int index) + { + interrupts->post(int_num, index); + wakeup(); + } + + void + clearInterrupt(int int_num, int index) + { + interrupts->clear(int_num, index); + } + + void + clearInterrupts() + { + interrupts->clearAll(); + } bool checkInterrupts(ThreadContext *tc) const diff --git a/src/cpu/o3/cpu.cc b/src/cpu/o3/cpu.cc index f567c18687..4f6d5d41c3 100644 --- a/src/cpu/o3/cpu.cc +++ b/src/cpu/o3/cpu.cc @@ -893,18 +893,6 @@ FullO3CPU::activateWhenReady(int tid) } #if FULL_SYSTEM -template -void -FullO3CPU::postInterrupt(int int_num, int index) -{ - BaseCPU::postInterrupt(int_num, index); - - if (this->thread[0]->status() == ThreadContext::Suspended) { - DPRINTF(IPI,"Suspended Processor awoke\n"); - this->threadContexts[0]->activate(); - } -} - template Fault FullO3CPU::hwrei(unsigned tid) @@ -1689,6 +1677,21 @@ FullO3CPU::wakeCPU() schedule(tickEvent, nextCycle()); } +#if FULL_SYSTEM +template +void +FullO3CPU::wakeup() +{ + if (this->thread[0]->status() != ThreadContext::Suspended) + return; + + this->wakeCPU(); + + DPRINTF(Quiesce, "Suspended Processor woken\n"); + this->threadContexts[0]->activate(); +} +#endif + template int FullO3CPU::getFreeTid() diff --git a/src/cpu/o3/cpu.hh b/src/cpu/o3/cpu.hh index d24e8c3834..d14001d0d9 100644 --- a/src/cpu/o3/cpu.hh +++ b/src/cpu/o3/cpu.hh @@ -402,9 +402,6 @@ class FullO3CPU : public BaseO3CPU void trap(Fault fault, unsigned tid); #if FULL_SYSTEM - /** Posts an interrupt. */ - void postInterrupt(int int_num, int index); - /** HW return from error interrupt. */ Fault hwrei(unsigned tid); @@ -701,6 +698,10 @@ class FullO3CPU : public BaseO3CPU /** Wakes the CPU, rescheduling the CPU if it's not already active. */ void wakeCPU(); +#if FULL_SYSTEM + virtual void wakeup(); +#endif + /** Gets a free thread id. Use if thread ids change across system. */ int getFreeTid(); diff --git a/src/cpu/ozone/cpu.hh b/src/cpu/ozone/cpu.hh index 6b5e7282d4..55ad7b3fb8 100644 --- a/src/cpu/ozone/cpu.hh +++ b/src/cpu/ozone/cpu.hh @@ -333,7 +333,7 @@ class OzoneCPU : public BaseCPU Status _status; public: - void postInterrupt(int int_num, int index); + void wakeup(); void zero_fill_64(Addr addr) { static int warned = 0; diff --git a/src/cpu/ozone/cpu_impl.hh b/src/cpu/ozone/cpu_impl.hh index 1402f4b727..84ee694649 100644 --- a/src/cpu/ozone/cpu_impl.hh +++ b/src/cpu/ozone/cpu_impl.hh @@ -582,10 +582,8 @@ OzoneCPU::dbg_vtophys(Addr addr) #if FULL_SYSTEM template void -OzoneCPU::postInterrupt(int int_num, int index) +OzoneCPU::wakeup() { - BaseCPU::postInterrupt(int_num, index); - if (_status == Idle) { DPRINTF(IPI,"Suspended Processor awoke\n"); // thread.activate(); diff --git a/src/cpu/simple/base.cc b/src/cpu/simple/base.cc index 3c154afb6b..89d9ce3830 100644 --- a/src/cpu/simple/base.cc +++ b/src/cpu/simple/base.cc @@ -303,14 +303,13 @@ BaseSimpleCPU::dbg_vtophys(Addr addr) #if FULL_SYSTEM void -BaseSimpleCPU::postInterrupt(int int_num, int index) +BaseSimpleCPU::wakeup() { - BaseCPU::postInterrupt(int_num, index); + if (thread->status() != ThreadContext::Suspended) + return; - if (thread->status() == ThreadContext::Suspended) { - DPRINTF(Quiesce,"Suspended Processor awoke\n"); - thread->activate(); - } + DPRINTF(Quiesce,"Suspended Processor awoke\n"); + thread->activate(); } #endif // FULL_SYSTEM diff --git a/src/cpu/simple/base.hh b/src/cpu/simple/base.hh index 6e72b8f6ce..34d0f59542 100644 --- a/src/cpu/simple/base.hh +++ b/src/cpu/simple/base.hh @@ -98,7 +98,7 @@ class BaseSimpleCPU : public BaseCPU } public: - void postInterrupt(int int_num, int index); + void wakeup(); void zero_fill_64(Addr addr) { static int warned = 0;