cache.cc (12748:ae5ce8e42de7) cache.cc (12749:223c83ed9979)
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

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

372 // There's no reason to add a prefetch as an additional target
373 // to an existing MSHR. If an outstanding request is already
374 // in progress, there is nothing for the prefetch to do.
375 // If this is the case, we don't even create a request at all.
376 PacketPtr pf = nullptr;
377
378 if (!mshr) {
379 // copy the request and create a new SoftPFReq packet
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

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

372 // There's no reason to add a prefetch as an additional target
373 // to an existing MSHR. If an outstanding request is already
374 // in progress, there is nothing for the prefetch to do.
375 // If this is the case, we don't even create a request at all.
376 PacketPtr pf = nullptr;
377
378 if (!mshr) {
379 // copy the request and create a new SoftPFReq packet
380 RequestPtr req = new Request(pkt->req->getPaddr(),
381 pkt->req->getSize(),
382 pkt->req->getFlags(),
383 pkt->req->masterId());
380 RequestPtr req = std::make_shared<Request>(pkt->req->getPaddr(),
381 pkt->req->getSize(),
382 pkt->req->getFlags(),
383 pkt->req->masterId());
384 pf = new Packet(req, pkt->cmd);
385 pf->allocate();
386 assert(pf->getAddr() == pkt->getAddr());
387 assert(pf->getSize() == pkt->getSize());
388 }
389
390 pkt->makeTimingResponse();
391

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

691 completion_time = pkt->headerDelay;
692
693 // Software prefetch handling for cache closest to core
694 if (tgt_pkt->cmd.isSWPrefetch()) {
695 // a software prefetch would have already been ack'd
696 // immediately with dummy data so the core would be able to
697 // retire it. This request completes right here, so we
698 // deallocate it.
384 pf = new Packet(req, pkt->cmd);
385 pf->allocate();
386 assert(pf->getAddr() == pkt->getAddr());
387 assert(pf->getSize() == pkt->getSize());
388 }
389
390 pkt->makeTimingResponse();
391

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

691 completion_time = pkt->headerDelay;
692
693 // Software prefetch handling for cache closest to core
694 if (tgt_pkt->cmd.isSWPrefetch()) {
695 // a software prefetch would have already been ack'd
696 // immediately with dummy data so the core would be able to
697 // retire it. This request completes right here, so we
698 // deallocate it.
699 delete tgt_pkt->req;
700 delete tgt_pkt;
701 break; // skip response
702 }
703
704 // unlike the other packet flows, where data is found in other
705 // caches or memory and brought back, write-line requests always
706 // have the data right away, so the above check for "is fill?"
707 // cannot actually be determined until examining the stored MSHR

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

798 tgt_pkt->headerDelay = tgt_pkt->payloadDelay = 0;
799 cpuSidePort.schedTimingResp(tgt_pkt, completion_time, true);
800 break;
801
802 case MSHR::Target::FromPrefetcher:
803 assert(tgt_pkt->cmd == MemCmd::HardPFReq);
804 if (blk)
805 blk->status |= BlkHWPrefetched;
699 delete tgt_pkt;
700 break; // skip response
701 }
702
703 // unlike the other packet flows, where data is found in other
704 // caches or memory and brought back, write-line requests always
705 // have the data right away, so the above check for "is fill?"
706 // cannot actually be determined until examining the stored MSHR

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

797 tgt_pkt->headerDelay = tgt_pkt->payloadDelay = 0;
798 cpuSidePort.schedTimingResp(tgt_pkt, completion_time, true);
799 break;
800
801 case MSHR::Target::FromPrefetcher:
802 assert(tgt_pkt->cmd == MemCmd::HardPFReq);
803 if (blk)
804 blk->status |= BlkHWPrefetched;
806 delete tgt_pkt->req;
807 delete tgt_pkt;
808 break;
809
810 case MSHR::Target::FromSnoop:
811 // I don't believe that a snoop can be in an error state
812 assert(!is_error);
813 // response to snoop request
814 DPRINTF(Cache, "processing deferred snoop...\n");

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

866 }
867}
868
869PacketPtr
870Cache::cleanEvictBlk(CacheBlk *blk)
871{
872 assert(!writebackClean);
873 assert(blk && blk->isValid() && !blk->isDirty());
805 delete tgt_pkt;
806 break;
807
808 case MSHR::Target::FromSnoop:
809 // I don't believe that a snoop can be in an error state
810 assert(!is_error);
811 // response to snoop request
812 DPRINTF(Cache, "processing deferred snoop...\n");

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

864 }
865}
866
867PacketPtr
868Cache::cleanEvictBlk(CacheBlk *blk)
869{
870 assert(!writebackClean);
871 assert(blk && blk->isValid() && !blk->isDirty());
872
874 // Creating a zero sized write, a message to the snoop filter
873 // Creating a zero sized write, a message to the snoop filter
874 RequestPtr req = std::make_shared<Request>(
875 regenerateBlkAddr(blk), blkSize, 0, Request::wbMasterId);
875
876
876 RequestPtr req =
877 new Request(regenerateBlkAddr(blk), blkSize, 0,
878 Request::wbMasterId);
879 if (blk->isSecure())
880 req->setFlags(Request::SECURE);
881
882 req->taskId(blk->task_id);
883
884 PacketPtr pkt = new Packet(req, MemCmd::CleanEvict);
885 pkt->allocate();
886 DPRINTF(Cache, "Create CleanEvict %s\n", pkt->print());

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

1133 // payload
1134 if (pkt->hasData())
1135 pkt->setDataFromBlock(blk->data, blkSize);
1136 }
1137 }
1138
1139 if (!respond && is_deferred) {
1140 assert(pkt->needsResponse());
877 if (blk->isSecure())
878 req->setFlags(Request::SECURE);
879
880 req->taskId(blk->task_id);
881
882 PacketPtr pkt = new Packet(req, MemCmd::CleanEvict);
883 pkt->allocate();
884 DPRINTF(Cache, "Create CleanEvict %s\n", pkt->print());

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

1131 // payload
1132 if (pkt->hasData())
1133 pkt->setDataFromBlock(blk->data, blkSize);
1134 }
1135 }
1136
1137 if (!respond && is_deferred) {
1138 assert(pkt->needsResponse());
1141
1142 // if we copied the deferred packet with the intention to
1143 // respond, but are not responding, then a cache above us must
1144 // be, and we can use this as the indication of whether this
1145 // is a packet where we created a copy of the request or not
1146 if (!pkt->cacheResponding()) {
1147 delete pkt->req;
1148 }
1149
1150 delete pkt;
1151 }
1152
1153 // Do this last in case it deallocates block data or something
1154 // like that
1155 if (blk_valid && invalidate) {
1156 invalidateBlock(blk);
1157 DPRINTF(Cache, "new state is %s\n", blk->print());

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

1391 // Deallocate the mshr target
1392 if (mshrQueue.forceDeallocateTarget(mshr)) {
1393 // Clear block if this deallocation resulted freed an
1394 // mshr when all had previously been utilized
1395 clearBlocked(Blocked_NoMSHRs);
1396 }
1397
1398 // given that no response is expected, delete Request and Packet
1139 delete pkt;
1140 }
1141
1142 // Do this last in case it deallocates block data or something
1143 // like that
1144 if (blk_valid && invalidate) {
1145 invalidateBlock(blk);
1146 DPRINTF(Cache, "new state is %s\n", blk->print());

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

1380 // Deallocate the mshr target
1381 if (mshrQueue.forceDeallocateTarget(mshr)) {
1382 // Clear block if this deallocation resulted freed an
1383 // mshr when all had previously been utilized
1384 clearBlocked(Blocked_NoMSHRs);
1385 }
1386
1387 // given that no response is expected, delete Request and Packet
1399 delete tgt_pkt->req;
1400 delete tgt_pkt;
1401
1402 return false;
1403 }
1404 }
1405
1406 return BaseCache::sendMSHRQueuePacket(mshr);
1407}
1408
1409Cache*
1410CacheParams::create()
1411{
1412 assert(tags);
1413 assert(replacement_policy);
1414
1415 return new Cache(this);
1416}
1388 delete tgt_pkt;
1389
1390 return false;
1391 }
1392 }
1393
1394 return BaseCache::sendMSHRQueuePacket(mshr);
1395}
1396
1397Cache*
1398CacheParams::create()
1399{
1400 assert(tags);
1401 assert(replacement_policy);
1402
1403 return new Cache(this);
1404}