mem: Do not treat CleanEvict as a write operation
authorAndreas Hansson <andreas.hansson@arm.com>
Fri, 6 Nov 2015 08:26:33 +0000 (03:26 -0500)
committerAndreas Hansson <andreas.hansson@arm.com>
Fri, 6 Nov 2015 08:26:33 +0000 (03:26 -0500)
This patch changes the CleanEvict command type to not be considered a
write. Initially it was made a zero-sized write to match the writeback
command, but as things developed it became clear that it causes more
problems than it solves. For example, the memory modules (and bridge)
should not consider the CleanEvict as a write, but instead discard
it. With this patch it will be neither a read, nor write, and as it
does not need a response the slave will simply sink it.

src/mem/cache/base.hh
src/mem/packet.cc

index 3baec36d90d7c99cb357b117115da75c29f2c17c..a992583fe600bb8297350b0342abcb2e21a348cf 100644 (file)
@@ -508,9 +508,12 @@ class BaseCache : public MemObject
 
     MSHR *allocateWriteBuffer(PacketPtr pkt, Tick time)
     {
-        // should only see clean evictions in a read-only cache
-        assert(!isReadOnly || pkt->cmd == MemCmd::CleanEvict);
-        assert(pkt->isWrite() && !pkt->isRead());
+        // should only see writes or clean evicts here
+        assert(pkt->isWrite() || pkt->cmd == MemCmd::CleanEvict);
+
+        // if this is a read-only cache we should never see any writes
+        assert(!(isReadOnly && pkt->isWrite()));
+
         return allocateBufferInternal(&writeBuffer,
                                       blockAlign(pkt->getAddr()), blkSize,
                                       pkt, time, true);
index b1e6dcd63373eb0429f99e6bbc3e214dac8a69ce..80b0791387f25be268c090e726ec27c7f980032b 100644 (file)
@@ -88,7 +88,7 @@ MemCmd::commandInfo[] =
     { SET4(IsWrite, NeedsExclusive, IsRequest, HasData),
             InvalidCmd, "Writeback" },
     /* CleanEvict */
-    { SET2(IsWrite, IsRequest), InvalidCmd, "CleanEvict" },
+    { SET1(IsRequest), InvalidCmd, "CleanEvict" },
     /* SoftPFReq */
     { SET4(IsRead, IsRequest, IsSWPrefetch, NeedsResponse),
             SoftPFResp, "SoftPFReq" },