summaryrefslogtreecommitdiff
path: root/src/mem/cache/mshr.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2015-12-31 09:33:39 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2015-12-31 09:33:39 -0500
commit7fca994d04230f1e41b9443b33f891460fc5368d (patch)
tree3bd62bc958f5c81b68c3517d3ed3251203790036 /src/mem/cache/mshr.cc
parentf1ec326be59b137ff0955b4d80e6516754016fd5 (diff)
downloadgem5-7fca994d04230f1e41b9443b33f891460fc5368d.tar.xz
mem: Do not allocate space for packet data if not needed
This patch looks at the request and response command to determine if either actually has any data payload, and if not, we do not allocate any space for packet data. The only tricky case is where the command type is changed as part of the MSHR functionality. In these cases where the original packet had no data, but the new packet does, we need to explicitly call allocate().
Diffstat (limited to 'src/mem/cache/mshr.cc')
-rw-r--r--src/mem/cache/mshr.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mem/cache/mshr.cc b/src/mem/cache/mshr.cc
index e2141a429..1d18a2861 100644
--- a/src/mem/cache/mshr.cc
+++ b/src/mem/cache/mshr.cc
@@ -115,6 +115,9 @@ MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
static void
replaceUpgrade(PacketPtr pkt)
{
+ // remember if the current packet has data allocated
+ bool has_data = pkt->hasData() || pkt->hasRespData();
+
if (pkt->cmd == MemCmd::UpgradeReq) {
pkt->cmd = MemCmd::ReadExReq;
DPRINTF(Cache, "Replacing UpgradeReq with ReadExReq\n");
@@ -125,6 +128,19 @@ replaceUpgrade(PacketPtr pkt)
pkt->cmd = MemCmd::StoreCondFailReq;
DPRINTF(Cache, "Replacing StoreCondReq with StoreCondFailReq\n");
}
+
+ if (!has_data) {
+ // there is no sensible way of setting the data field if the
+ // new command actually would carry data
+ assert(!pkt->hasData());
+
+ if (pkt->hasRespData()) {
+ // we went from a packet that had no data (neither request,
+ // nor response), to one that does, and therefore we need to
+ // actually allocate space for the data payload
+ pkt->allocate();
+ }
+ }
}