mem: Properly set cache block status fields on writebacks
authorMitch Hayenga <mitch.hayenga@arm.com>
Wed, 13 Aug 2014 10:57:24 +0000 (06:57 -0400)
committerMitch Hayenga <mitch.hayenga@arm.com>
Wed, 13 Aug 2014 10:57:24 +0000 (06:57 -0400)
When a cacheline is written back to a lower-level cache,
tags->insertBlock() sets various status parameters. However these
status bits were cleared immediately after calling. This patch makes
it so that these status fields are not cleared by moving them outside
of the tags->insertBlock() call.

src/mem/cache/cache_impl.hh
src/mem/cache/tags/base_set_assoc.hh

index 00ba0d24f957d448cd689c398b73723fc4fbded6..5ef45ea2f0563ad638d3d8b7fd11712bb186e251 100644 (file)
@@ -336,7 +336,11 @@ Cache<TagStore>::access(PacketPtr pkt, BlkType *&blk,
                 return false;
             }
             tags->insertBlock(pkt, blk);
-            blk->status = BlkValid | BlkReadable;
+
+            blk->status = (BlkValid | BlkReadable);
+            if (pkt->isSecure()) {
+                blk->status |= BlkSecure;
+            }
         }
         std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize);
         blk->status |= BlkDirty;
index 218d9cdd9b7ef09adb26a6ff823b97c738362851..ac575d2ffb3057c18ad5e62cc692579cff115392 100644 (file)
@@ -247,7 +247,7 @@ public:
          Addr addr = pkt->getAddr();
          MasterID master_id = pkt->req->masterId();
          uint32_t task_id = pkt->req->taskId();
-         bool is_secure = pkt->isSecure();
+
          if (!blk->isTouched) {
              tagsInUse++;
              blk->isTouched = true;
@@ -275,10 +275,9 @@ public:
          }
 
          blk->isTouched = true;
+
          // Set tag for new block.  Caller is responsible for setting status.
          blk->tag = extractTag(addr);
-         if (is_secure)
-             blk->status |= BlkSecure;
 
          // deal with what we are bringing in
          assert(master_id < cache->system->maxMasters());