mem: Properly set cache block status fields on writebacks
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.
This commit is contained in:
parent
66904b9584
commit
f6f6ae461e
2 changed files with 7 additions and 4 deletions
6
src/mem/cache/cache_impl.hh
vendored
6
src/mem/cache/cache_impl.hh
vendored
|
@ -336,7 +336,11 @@ Cache<TagStore>::access(PacketPtr pkt, BlkType *&blk,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
tags->insertBlock(pkt, blk);
|
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);
|
std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize);
|
||||||
blk->status |= BlkDirty;
|
blk->status |= BlkDirty;
|
||||||
|
|
5
src/mem/cache/tags/base_set_assoc.hh
vendored
5
src/mem/cache/tags/base_set_assoc.hh
vendored
|
@ -247,7 +247,7 @@ public:
|
||||||
Addr addr = pkt->getAddr();
|
Addr addr = pkt->getAddr();
|
||||||
MasterID master_id = pkt->req->masterId();
|
MasterID master_id = pkt->req->masterId();
|
||||||
uint32_t task_id = pkt->req->taskId();
|
uint32_t task_id = pkt->req->taskId();
|
||||||
bool is_secure = pkt->isSecure();
|
|
||||||
if (!blk->isTouched) {
|
if (!blk->isTouched) {
|
||||||
tagsInUse++;
|
tagsInUse++;
|
||||||
blk->isTouched = true;
|
blk->isTouched = true;
|
||||||
|
@ -275,10 +275,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
blk->isTouched = true;
|
blk->isTouched = true;
|
||||||
|
|
||||||
// Set tag for new block. Caller is responsible for setting status.
|
// Set tag for new block. Caller is responsible for setting status.
|
||||||
blk->tag = extractTag(addr);
|
blk->tag = extractTag(addr);
|
||||||
if (is_secure)
|
|
||||||
blk->status |= BlkSecure;
|
|
||||||
|
|
||||||
// deal with what we are bringing in
|
// deal with what we are bringing in
|
||||||
assert(master_id < cache->system->maxMasters());
|
assert(master_id < cache->system->maxMasters());
|
||||||
|
|
Loading…
Reference in a new issue