base.cc (13863:f7391cb38ce7) base.cc (13866:d0829f20374a)
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

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

1302 if (!victim)
1303 return nullptr;
1304
1305 // Print victim block's information
1306 DPRINTF(CacheRepl, "Replacement victim: %s\n", victim->print());
1307
1308 // Check for transient state allocations. If any of the entries listed
1309 // for eviction has a transient state, the allocation fails
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

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

1302 if (!victim)
1303 return nullptr;
1304
1305 // Print victim block's information
1306 DPRINTF(CacheRepl, "Replacement victim: %s\n", victim->print());
1307
1308 // Check for transient state allocations. If any of the entries listed
1309 // for eviction has a transient state, the allocation fails
1310 bool replacement = false;
1310 for (const auto& blk : evict_blks) {
1311 if (blk->isValid()) {
1311 for (const auto& blk : evict_blks) {
1312 if (blk->isValid()) {
1313 replacement = true;
1314
1312 Addr repl_addr = regenerateBlkAddr(blk);
1313 MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure());
1314 if (repl_mshr) {
1315 // must be an outstanding upgrade or clean request
1316 // on a block we're about to replace...
1317 assert((!blk->isWritable() && repl_mshr->needsWritable()) ||
1318 repl_mshr->isCleaning());
1319
1320 // too hard to replace block with transient state
1321 // allocation failed, block not inserted
1322 return nullptr;
1323 }
1324 }
1325 }
1326
1327 // The victim will be replaced by a new entry, so increase the replacement
1328 // counter if a valid block is being replaced
1315 Addr repl_addr = regenerateBlkAddr(blk);
1316 MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure());
1317 if (repl_mshr) {
1318 // must be an outstanding upgrade or clean request
1319 // on a block we're about to replace...
1320 assert((!blk->isWritable() && repl_mshr->needsWritable()) ||
1321 repl_mshr->isCleaning());
1322
1323 // too hard to replace block with transient state
1324 // allocation failed, block not inserted
1325 return nullptr;
1326 }
1327 }
1328 }
1329
1330 // The victim will be replaced by a new entry, so increase the replacement
1331 // counter if a valid block is being replaced
1329 if (evict_blks.size() > 0) {
1332 if (replacement) {
1333 // Evict valid blocks associated to this victim block
1330 for (const auto& blk : evict_blks) {
1331 if (blk->isValid()) {
1332 DPRINTF(CacheRepl, "Evicting %s (%#llx) to make room for " \
1333 "%#llx (%s)\n", blk->print(), regenerateBlkAddr(blk),
1334 addr, is_secure);
1334 for (const auto& blk : evict_blks) {
1335 if (blk->isValid()) {
1336 DPRINTF(CacheRepl, "Evicting %s (%#llx) to make room for " \
1337 "%#llx (%s)\n", blk->print(), regenerateBlkAddr(blk),
1338 addr, is_secure);
1339
1340 if (blk->wasPrefetched()) {
1341 unusedPrefetches++;
1342 }
1343
1344 evictBlock(blk, writebacks);
1335 }
1336 }
1337
1338 replacements++;
1339 }
1340
1345 }
1346 }
1347
1348 replacements++;
1349 }
1350
1341 // Evict valid blocks associated to this victim block
1342 for (const auto& blk : evict_blks) {
1343 if (blk->isValid()) {
1344 if (blk->wasPrefetched()) {
1345 unusedPrefetches++;
1346 }
1347
1348 evictBlock(blk, writebacks);
1349 }
1350 }
1351
1352 // Insert new block at victimized entry
1353 tags->insertBlock(pkt, victim);
1354
1355 return victim;
1356}
1357
1358void
1359BaseCache::invalidateBlock(CacheBlk *blk)

--- 1155 unchanged lines hidden ---
1351 // Insert new block at victimized entry
1352 tags->insertBlock(pkt, victim);
1353
1354 return victim;
1355}
1356
1357void
1358BaseCache::invalidateBlock(CacheBlk *blk)

--- 1155 unchanged lines hidden ---