base.cc (13222:0dbcc7d7d66f) | base.cc (13350:247e4108a5e8) |
---|---|
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 --- 460 unchanged lines hidden (view full) --- 469 assert(pkt->req->masterId() < system->maxMasters()); 470 mshr_miss_latency[stats_cmd_idx][pkt->req->masterId()] += 471 miss_latency; 472 } 473 474 PacketList writebacks; 475 476 bool is_fill = !mshr->isForward && | 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 --- 460 unchanged lines hidden (view full) --- 469 assert(pkt->req->masterId() < system->maxMasters()); 470 mshr_miss_latency[stats_cmd_idx][pkt->req->masterId()] += 471 miss_latency; 472 } 473 474 PacketList writebacks; 475 476 bool is_fill = !mshr->isForward && |
477 (pkt->isRead() || pkt->cmd == MemCmd::UpgradeResp); | 477 (pkt->isRead() || pkt->cmd == MemCmd::UpgradeResp || 478 mshr->wasWholeLineWrite); |
478 | 479 |
480 // make sure that if the mshr was due to a whole line write then 481 // the response is an invalidation 482 assert(!mshr->wasWholeLineWrite || pkt->isInvalidate()); 483 |
|
479 CacheBlk *blk = tags->findBlock(pkt->getAddr(), pkt->isSecure()); 480 481 if (is_fill && !is_error) { 482 DPRINTF(Cache, "Block for addr %#llx being updated in Cache\n", 483 pkt->getAddr()); 484 485 blk = handleFill(pkt, blk, writebacks, mshr->allocOnFill()); 486 assert(blk != nullptr); --- 629 unchanged lines hidden (view full) --- 1116 invalidateBlock(blk); 1117 } 1118} 1119 1120CacheBlk* 1121BaseCache::handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks, 1122 bool allocate) 1123{ | 484 CacheBlk *blk = tags->findBlock(pkt->getAddr(), pkt->isSecure()); 485 486 if (is_fill && !is_error) { 487 DPRINTF(Cache, "Block for addr %#llx being updated in Cache\n", 488 pkt->getAddr()); 489 490 blk = handleFill(pkt, blk, writebacks, mshr->allocOnFill()); 491 assert(blk != nullptr); --- 629 unchanged lines hidden (view full) --- 1121 invalidateBlock(blk); 1122 } 1123} 1124 1125CacheBlk* 1126BaseCache::handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks, 1127 bool allocate) 1128{ |
1124 assert(pkt->isResponse() || pkt->cmd == MemCmd::WriteLineReq); | 1129 assert(pkt->isResponse()); |
1125 Addr addr = pkt->getAddr(); 1126 bool is_secure = pkt->isSecure(); 1127#if TRACING_ON 1128 CacheBlk::State old_state = blk ? blk->status : 0; 1129#endif 1130 1131 // When handling a fill, we should have no writes to this line. 1132 assert(addr == pkt->getBlockAddr(blkSize)); 1133 assert(!writeBuffer.findMatch(addr, is_secure)); 1134 1135 if (!blk) { 1136 // better have read new data... | 1130 Addr addr = pkt->getAddr(); 1131 bool is_secure = pkt->isSecure(); 1132#if TRACING_ON 1133 CacheBlk::State old_state = blk ? blk->status : 0; 1134#endif 1135 1136 // When handling a fill, we should have no writes to this line. 1137 assert(addr == pkt->getBlockAddr(blkSize)); 1138 assert(!writeBuffer.findMatch(addr, is_secure)); 1139 1140 if (!blk) { 1141 // better have read new data... |
1137 assert(pkt->hasData()); | 1142 assert(pkt->hasData() || pkt->cmd == MemCmd::InvalidateResp); |
1138 | 1143 |
1139 // only read responses and write-line requests have data; 1140 // note that we don't write the data here for write-line - that 1141 // happens in the subsequent call to satisfyRequest 1142 assert(pkt->isRead() || pkt->cmd == MemCmd::WriteLineReq); 1143 | |
1144 // need to do a replacement if allocating, otherwise we stick 1145 // with the temporary storage 1146 blk = allocate ? allocateBlock(pkt, writebacks) : nullptr; 1147 1148 if (!blk) { 1149 // No replaceable block or a mostly exclusive 1150 // cache... just use temporary storage to complete the 1151 // current request and then get rid of it --- 16 unchanged lines hidden (view full) --- 1168 // don't want to lose that 1169 } 1170 1171 blk->status |= BlkValid | BlkReadable; 1172 1173 // sanity check for whole-line writes, which should always be 1174 // marked as writable as part of the fill, and then later marked 1175 // dirty as part of satisfyRequest | 1144 // need to do a replacement if allocating, otherwise we stick 1145 // with the temporary storage 1146 blk = allocate ? allocateBlock(pkt, writebacks) : nullptr; 1147 1148 if (!blk) { 1149 // No replaceable block or a mostly exclusive 1150 // cache... just use temporary storage to complete the 1151 // current request and then get rid of it --- 16 unchanged lines hidden (view full) --- 1168 // don't want to lose that 1169 } 1170 1171 blk->status |= BlkValid | BlkReadable; 1172 1173 // sanity check for whole-line writes, which should always be 1174 // marked as writable as part of the fill, and then later marked 1175 // dirty as part of satisfyRequest |
1176 if (pkt->cmd == MemCmd::WriteLineReq) { | 1176 if (pkt->cmd == MemCmd::InvalidateResp) { |
1177 assert(!pkt->hasSharers()); 1178 } 1179 1180 // here we deal with setting the appropriate state of the line, 1181 // and we start by looking at the hasSharers flag, and ignore the 1182 // cacheResponding flag (normally signalling dirty data) if the 1183 // packet has sharers, thus the line is never allocated as Owned 1184 // (dirty but not writable), and always ends up being either --- 275 unchanged lines hidden (view full) --- 1460 PacketPtr tgt_pkt = mshr->getTarget()->pkt; 1461 1462 DPRINTF(Cache, "%s: MSHR %s\n", __func__, tgt_pkt->print()); 1463 1464 CacheBlk *blk = tags->findBlock(mshr->blkAddr, mshr->isSecure); 1465 1466 // either a prefetch that is not present upstream, or a normal 1467 // MSHR request, proceed to get the packet to send downstream | 1177 assert(!pkt->hasSharers()); 1178 } 1179 1180 // here we deal with setting the appropriate state of the line, 1181 // and we start by looking at the hasSharers flag, and ignore the 1182 // cacheResponding flag (normally signalling dirty data) if the 1183 // packet has sharers, thus the line is never allocated as Owned 1184 // (dirty but not writable), and always ends up being either --- 275 unchanged lines hidden (view full) --- 1460 PacketPtr tgt_pkt = mshr->getTarget()->pkt; 1461 1462 DPRINTF(Cache, "%s: MSHR %s\n", __func__, tgt_pkt->print()); 1463 1464 CacheBlk *blk = tags->findBlock(mshr->blkAddr, mshr->isSecure); 1465 1466 // either a prefetch that is not present upstream, or a normal 1467 // MSHR request, proceed to get the packet to send downstream |
1468 PacketPtr pkt = createMissPacket(tgt_pkt, blk, mshr->needsWritable()); | 1468 PacketPtr pkt = createMissPacket(tgt_pkt, blk, mshr->needsWritable(), 1469 mshr->isWholeLineWrite()); |
1469 1470 mshr->isForward = (pkt == nullptr); 1471 1472 if (mshr->isForward) { 1473 // not a cache block request, but a response is expected 1474 // make copy of current packet to forward, keep current 1475 // copy for response handling 1476 pkt = new Packet(tgt_pkt, false, true); --- 882 unchanged lines hidden --- | 1470 1471 mshr->isForward = (pkt == nullptr); 1472 1473 if (mshr->isForward) { 1474 // not a cache block request, but a response is expected 1475 // make copy of current packet to forward, keep current 1476 // copy for response handling 1477 pkt = new Packet(tgt_pkt, false, true); --- 882 unchanged lines hidden --- |