summaryrefslogtreecommitdiff
path: root/src/mem/cache/miss/mshr.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2007-07-22 21:43:38 -0700
committerSteve Reinhardt <stever@eecs.umich.edu>2007-07-22 21:43:38 -0700
commit82e2a3557672864f0ea3ae64dad61681546aaf07 (patch)
tree1f0b74fe61274972525694ef6ad4bfbcb8b60231 /src/mem/cache/miss/mshr.cc
parentfe442f67adad74130bb496061f2e13a993bdfcdd (diff)
downloadgem5-82e2a3557672864f0ea3ae64dad61681546aaf07.tar.xz
Replace lowerMSHRPending flag with more robust scheme
based on following Packet senderState links. --HG-- extra : convert_revision : 9027d59bd7242aa0e4275bf94d8b1fb27bd59d79
Diffstat (limited to 'src/mem/cache/miss/mshr.cc')
-rw-r--r--src/mem/cache/miss/mshr.cc48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/mem/cache/miss/mshr.cc b/src/mem/cache/miss/mshr.cc
index b9dfdf729..9b05aea3f 100644
--- a/src/mem/cache/miss/mshr.cc
+++ b/src/mem/cache/miss/mshr.cc
@@ -63,7 +63,8 @@ MSHR::TargetList::TargetList()
inline void
-MSHR::TargetList::add(PacketPtr pkt, Tick readyTime, Counter order, bool cpuSide)
+MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
+ Counter order, bool cpuSide)
{
if (cpuSide) {
if (pkt->needsExclusive()) {
@@ -73,6 +74,12 @@ MSHR::TargetList::add(PacketPtr pkt, Tick readyTime, Counter order, bool cpuSide
if (pkt->cmd == MemCmd::UpgradeReq) {
hasUpgrade = true;
}
+
+ MSHR *mshr = dynamic_cast<MSHR*>(pkt->senderState);
+ if (mshr != NULL) {
+ assert(!mshr->downstreamPending);
+ mshr->downstreamPending = true;
+ }
}
push_back(Target(pkt, readyTime, order, cpuSide));
@@ -98,6 +105,20 @@ MSHR::TargetList::replaceUpgrades()
void
+MSHR::TargetList::clearDownstreamPending()
+{
+ Iterator end_i = end();
+ for (Iterator i = begin(); i != end_i; ++i) {
+ MSHR *mshr = dynamic_cast<MSHR*>(i->pkt->senderState);
+ if (mshr != NULL) {
+ assert(mshr->downstreamPending);
+ mshr->downstreamPending = false;
+ }
+ }
+}
+
+
+void
MSHR::allocate(Addr _addr, int _size, PacketPtr target,
Tick whenReady, Counter _order)
{
@@ -109,6 +130,7 @@ MSHR::allocate(Addr _addr, int _size, PacketPtr target,
isCacheFill = false;
_isUncacheable = target->req->isUncacheable();
inService = false;
+ downstreamPending = false;
threadNum = 0;
ntargets = 1;
// Don't know of a case where we would allocate a new MSHR for a
@@ -121,6 +143,28 @@ MSHR::allocate(Addr _addr, int _size, PacketPtr target,
data = NULL;
}
+
+bool
+MSHR::markInService()
+{
+ assert(!inService);
+ if (isSimpleForward()) {
+ // we just forwarded the request packet & don't expect a
+ // response, so get rid of it
+ assert(getNumTargets() == 1);
+ popTarget();
+ return true;
+ }
+ inService = true;
+ if (!downstreamPending) {
+ // let upstream caches know that the request has made it to a
+ // level where it's going to get a response
+ targets->clearDownstreamPending();
+ }
+ return false;
+}
+
+
void
MSHR::deallocate()
{
@@ -164,7 +208,7 @@ MSHR::allocateTarget(PacketPtr pkt, Tick whenReady, Counter _order)
bool
MSHR::handleSnoop(PacketPtr pkt, Counter _order)
{
- if (!inService || (pkt->isExpressSnoop() && pkt->lowerMSHRPending())) {
+ if (!inService || downstreamPending) {
// Request has not been issued yet, or it's been issued
// locally but is buffered unissued at some downstream cache
// which is forwarding us this snoop. Either way, the packet