Deleted Added
sdiff udiff text old ( 12730:6c2ea88bf129 ) new ( 12744:d1ff0b42b747 )
full compact
1/*
2 * Copyright (c) 2012-2013, 2018 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 1195 unchanged lines hidden (view full) ---

1204
1205 return blk;
1206}
1207
1208CacheBlk*
1209BaseCache::allocateBlock(Addr addr, bool is_secure, PacketList &writebacks)
1210{
1211 // Find replacement victim
1212 CacheBlk *blk = tags->findVictim(addr);
1213
1214 // It is valid to return nullptr if there is no victim
1215 if (!blk)
1216 return nullptr;
1217
1218 if (blk->isValid()) {
1219 Addr repl_addr = regenerateBlkAddr(blk);
1220 MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure());
1221 if (repl_mshr) {
1222 // must be an outstanding upgrade or clean request
1223 // on a block we're about to replace...
1224 assert((!blk->isWritable() && repl_mshr->needsWritable()) ||
1225 repl_mshr->isCleaning());
1226 // too hard to replace block with transient state
1227 // allocation failed, block not inserted
1228 return nullptr;
1229 } else {
1230 DPRINTF(Cache, "replacement: replacing %#llx (%s) with %#llx "
1231 "(%s): %s\n", repl_addr, blk->isSecure() ? "s" : "ns",
1232 addr, is_secure ? "s" : "ns",
1233 blk->isDirty() ? "writeback" : "clean");
1234
1235 if (blk->wasPrefetched()) {
1236 unusedPrefetches++;
1237 }
1238 evictBlock(blk, writebacks);
1239 replacements++;
1240 }
1241 }
1242
1243 return blk;
1244}
1245
1246void
1247BaseCache::invalidateBlock(CacheBlk *blk)
1248{
1249 if (blk != tempBlock)
1250 tags->invalidate(blk);
1251 blk->invalidate();

--- 1057 unchanged lines hidden ---