cache.cc (12722:d84f756891fe) cache.cc (12723:530dc4bf1a00)
1/*
2 * Copyright (c) 2010-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

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

298 DPRINTF(CacheVerbose, "%s for %s\n", __func__, pkt->print());
299
300 if (pkt->req->isUncacheable()) {
301 DPRINTF(Cache, "uncacheable: %s\n", pkt->print());
302
303 // flush and invalidate any existing block
304 CacheBlk *old_blk(tags->findBlock(pkt->getAddr(), pkt->isSecure()));
305 if (old_blk && old_blk->isValid()) {
1/*
2 * Copyright (c) 2010-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

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

298 DPRINTF(CacheVerbose, "%s for %s\n", __func__, pkt->print());
299
300 if (pkt->req->isUncacheable()) {
301 DPRINTF(Cache, "uncacheable: %s\n", pkt->print());
302
303 // flush and invalidate any existing block
304 CacheBlk *old_blk(tags->findBlock(pkt->getAddr(), pkt->isSecure()));
305 if (old_blk && old_blk->isValid()) {
306 if (old_blk->isDirty() || writebackClean)
307 writebacks.push_back(writebackBlk(old_blk));
308 else
309 writebacks.push_back(cleanEvictBlk(old_blk));
310 invalidateBlock(old_blk);
306 evictBlock(old_blk, writebacks);
311 }
312
313 blk = nullptr;
314 // lookupLatency is the latency in case the request is uncacheable.
315 lat = lookupLatency;
316 return false;
317 }
318

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

1243 } else {
1244 // the writeback/clean eviction happens after the call to
1245 // recvAtomic has finished (but before any successive
1246 // calls), so that the response handling from the fill is
1247 // allowed to happen first
1248 schedule(writebackTempBlockAtomicEvent, curTick());
1249 }
1250
307 }
308
309 blk = nullptr;
310 // lookupLatency is the latency in case the request is uncacheable.
311 lat = lookupLatency;
312 return false;
313 }
314

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

1239 } else {
1240 // the writeback/clean eviction happens after the call to
1241 // recvAtomic has finished (but before any successive
1242 // calls), so that the response handling from the fill is
1243 // allowed to happen first
1244 schedule(writebackTempBlockAtomicEvent, curTick());
1245 }
1246
1251 tempBlockWriteback = (blk->isDirty() || writebackClean) ?
1252 writebackBlk(blk) : cleanEvictBlk(blk);
1253 invalidateBlock(blk);
1247 tempBlockWriteback = evictBlock(blk);
1254 }
1255
1256 if (pkt->needsResponse()) {
1257 pkt->makeAtomicResponse();
1258 }
1259
1260 return lat * clockPeriod();
1261}

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

1638 clockEdge());
1639 if (next_pf_time != MaxTick)
1640 schedMemSideSendEvent(next_pf_time);
1641 }
1642 }
1643
1644 // if we used temp block, check to see if its valid and then clear it out
1645 if (blk == tempBlock && tempBlock->isValid()) {
1248 }
1249
1250 if (pkt->needsResponse()) {
1251 pkt->makeAtomicResponse();
1252 }
1253
1254 return lat * clockPeriod();
1255}

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

1632 clockEdge());
1633 if (next_pf_time != MaxTick)
1634 schedMemSideSendEvent(next_pf_time);
1635 }
1636 }
1637
1638 // if we used temp block, check to see if its valid and then clear it out
1639 if (blk == tempBlock && tempBlock->isValid()) {
1646 PacketPtr wb_pkt = tempBlock->isDirty() || writebackClean ?
1647 writebackBlk(blk) : cleanEvictBlk(blk);
1648 writebacks.push_back(wb_pkt);
1649 invalidateBlock(tempBlock);
1640 evictBlock(blk, writebacks);
1650 }
1651
1652 const Tick forward_time = clockEdge(forwardLatency) + pkt->headerDelay;
1653 // copy writebacks to write buffer
1654 doWritebacks(writebacks, forward_time);
1655
1656 DPRINTF(CacheVerbose, "%s: Leaving with %s\n", __func__, pkt->print());
1657 delete pkt;
1658}
1659
1660PacketPtr
1641 }
1642
1643 const Tick forward_time = clockEdge(forwardLatency) + pkt->headerDelay;
1644 // copy writebacks to write buffer
1645 doWritebacks(writebacks, forward_time);
1646
1647 DPRINTF(CacheVerbose, "%s: Leaving with %s\n", __func__, pkt->print());
1648 delete pkt;
1649}
1650
1651PacketPtr
1652Cache::evictBlock(CacheBlk *blk)
1653{
1654 PacketPtr pkt = (blk->isDirty() || writebackClean) ?
1655 writebackBlk(blk) : cleanEvictBlk(blk);
1656
1657 invalidateBlock(blk);
1658
1659 return pkt;
1660}
1661
1662void
1663Cache::evictBlock(CacheBlk *blk, PacketList &writebacks)
1664{
1665 PacketPtr pkt = evictBlock(blk);
1666 if (pkt) {
1667 writebacks.push_back(pkt);
1668 }
1669}
1670
1671PacketPtr
1661Cache::writebackBlk(CacheBlk *blk)
1662{
1663 chatty_assert(!isReadOnly || writebackClean,
1664 "Writeback from read-only cache");
1665 assert(blk && blk->isValid() && (blk->isDirty() || writebackClean));
1666
1667 writebacks[Request::wbMasterId]++;
1668

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

1845 DPRINTF(Cache, "replacement: replacing %#llx (%s) with %#llx "
1846 "(%s): %s\n", repl_addr, blk->isSecure() ? "s" : "ns",
1847 addr, is_secure ? "s" : "ns",
1848 blk->isDirty() ? "writeback" : "clean");
1849
1850 if (blk->wasPrefetched()) {
1851 unusedPrefetches++;
1852 }
1672Cache::writebackBlk(CacheBlk *blk)
1673{
1674 chatty_assert(!isReadOnly || writebackClean,
1675 "Writeback from read-only cache");
1676 assert(blk && blk->isValid() && (blk->isDirty() || writebackClean));
1677
1678 writebacks[Request::wbMasterId]++;
1679

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

1856 DPRINTF(Cache, "replacement: replacing %#llx (%s) with %#llx "
1857 "(%s): %s\n", repl_addr, blk->isSecure() ? "s" : "ns",
1858 addr, is_secure ? "s" : "ns",
1859 blk->isDirty() ? "writeback" : "clean");
1860
1861 if (blk->wasPrefetched()) {
1862 unusedPrefetches++;
1863 }
1853 // Will send up Writeback/CleanEvict snoops via isCachedAbove
1854 // when pushing this writeback list into the write buffer.
1855 if (blk->isDirty() || writebackClean) {
1856 // Save writeback packet for handling by caller
1857 writebacks.push_back(writebackBlk(blk));
1858 } else {
1859 writebacks.push_back(cleanEvictBlk(blk));
1860 }
1861 invalidateBlock(blk);
1864 evictBlock(blk, writebacks);
1862 replacements++;
1863 }
1864 }
1865
1866 return blk;
1867}
1868
1869void

--- 1027 unchanged lines hidden ---
1865 replacements++;
1866 }
1867 }
1868
1869 return blk;
1870}
1871
1872void

--- 1027 unchanged lines hidden ---