From: Andreas Sandberg Date: Fri, 31 Jul 2015 16:04:59 +0000 (+0100) Subject: cpu: Fix Minor drain issues when switched out X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f73b05431a55e25d831c4bc8847f99f39a8d6b7d;p=gem5.git cpu: Fix Minor drain issues when switched out The Minor CPU currently doesn't drain properly when it is switched out. This happens because Fetch 1 expects to be in the FetchHalted state when it is drained. However, because the CPU is switched out, it is stuck in the FetchWaitingForPC state. Fix this by ignoring drain requests and returning DrainState::Drained from MinorCPU::drain() if the CPU is switched out. This is always safe since a switched out CPU, by definition, doesn't have any instructions in flight. --- diff --git a/src/cpu/minor/cpu.cc b/src/cpu/minor/cpu.cc index b49c1ecda..51a3f3ae8 100644 --- a/src/cpu/minor/cpu.cc +++ b/src/cpu/minor/cpu.cc @@ -201,6 +201,11 @@ MinorCPU::startup() DrainState MinorCPU::drain() { + if (switchedOut()) { + DPRINTF(Drain, "Minor CPU switched out, draining not needed.\n"); + return DrainState::Drained; + } + DPRINTF(Drain, "MinorCPU drain\n"); /* Need to suspend all threads and wait for Execute to idle.