cache.cc (11275:fc2b0e6550ad) | cache.cc (11276:3561d002d8c7) |
---|---|
1/* 2 * Copyright (c) 2010-2015 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 --- 453 unchanged lines hidden (view full) --- 462 // complete miss on store conditional... just give up now 463 pkt->req->setExtraData(0); 464 return true; 465 } 466 467 return false; 468} 469 | 1/* 2 * Copyright (c) 2010-2015 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 --- 453 unchanged lines hidden (view full) --- 462 // complete miss on store conditional... just give up now 463 pkt->req->setExtraData(0); 464 return true; 465 } 466 467 return false; 468} 469 |
470 471class ForwardResponseRecord : public Packet::SenderState 472{ 473 public: 474 475 ForwardResponseRecord() {} 476}; 477 | |
478void 479Cache::doWritebacks(PacketList& writebacks, Tick forward_time) 480{ 481 while (!writebacks.empty()) { 482 PacketPtr wbPkt = writebacks.front(); 483 // We use forwardLatency here because we are copying writebacks to 484 // write buffer. Call isCachedAbove for both Writebacks and 485 // CleanEvicts. If isCachedAbove returns true we set BLOCK_CACHED flag --- 65 unchanged lines hidden (view full) --- 551 552void 553Cache::recvTimingSnoopResp(PacketPtr pkt) 554{ 555 DPRINTF(Cache, "%s for %s addr %#llx size %d\n", __func__, 556 pkt->cmdString(), pkt->getAddr(), pkt->getSize()); 557 558 assert(pkt->isResponse()); | 470void 471Cache::doWritebacks(PacketList& writebacks, Tick forward_time) 472{ 473 while (!writebacks.empty()) { 474 PacketPtr wbPkt = writebacks.front(); 475 // We use forwardLatency here because we are copying writebacks to 476 // write buffer. Call isCachedAbove for both Writebacks and 477 // CleanEvicts. If isCachedAbove returns true we set BLOCK_CACHED flag --- 65 unchanged lines hidden (view full) --- 543 544void 545Cache::recvTimingSnoopResp(PacketPtr pkt) 546{ 547 DPRINTF(Cache, "%s for %s addr %#llx size %d\n", __func__, 548 pkt->cmdString(), pkt->getAddr(), pkt->getSize()); 549 550 assert(pkt->isResponse()); |
559 560 // must be cache-to-cache response from upper to lower level 561 ForwardResponseRecord *rec = 562 dynamic_cast<ForwardResponseRecord *>(pkt->senderState); | |
563 assert(!system->bypassCaches()); 564 | 551 assert(!system->bypassCaches()); 552 |
565 if (rec == NULL) { 566 // @todo What guarantee do we have that this HardPFResp is 567 // actually for this cache, and not a cache closer to the 568 // memory? | 553 // determine if the response is from a snoop request we created 554 // (in which case it should be in the outstandingSnoop), or if we 555 // merely forwarded someone else's snoop request 556 const bool forwardAsSnoop = outstandingSnoop.find(pkt->req) == 557 outstandingSnoop.end(); 558 559 if (!forwardAsSnoop) { 560 // the packet came from this cache, so sink it here and do not 561 // forward it |
569 assert(pkt->cmd == MemCmd::HardPFResp); | 562 assert(pkt->cmd == MemCmd::HardPFResp); |
570 // Check if it's a prefetch response and handle it. We shouldn't 571 // get any other kinds of responses without FRRs. 572 DPRINTF(Cache, "Got prefetch response from above for addr %#llx (%s)\n", 573 pkt->getAddr(), pkt->isSecure() ? "s" : "ns"); | 563 564 outstandingSnoop.erase(pkt->req); 565 566 DPRINTF(Cache, "Got prefetch response from above for addr " 567 "%#llx (%s)\n", pkt->getAddr(), pkt->isSecure() ? "s" : "ns"); |
574 recvTimingResp(pkt); 575 return; 576 } 577 | 568 recvTimingResp(pkt); 569 return; 570 } 571 |
578 pkt->popSenderState(); 579 delete rec; | |
580 // forwardLatency is set here because there is a response from an 581 // upper level cache. 582 // To pay the delay that occurs if the packet comes from the bus, 583 // we charge also headerDelay. 584 Tick snoop_resp_time = clockEdge(forwardLatency) + pkt->headerDelay; 585 // Reset the timing of the packet. 586 pkt->headerDelay = pkt->payloadDelay = 0; 587 memSidePort->schedTimingSnoopResp(pkt, snoop_resp_time); --- 1304 unchanged lines hidden (view full) --- 1892 bool alreadyResponded = pkt->memInhibitAsserted(); 1893 if (is_timing) { 1894 // copy the packet so that we can clear any flags before 1895 // forwarding it upwards, we also allocate data (passing 1896 // the pointer along in case of static data), in case 1897 // there is a snoop hit in upper levels 1898 Packet snoopPkt(pkt, true, true); 1899 snoopPkt.setExpressSnoop(); | 572 // forwardLatency is set here because there is a response from an 573 // upper level cache. 574 // To pay the delay that occurs if the packet comes from the bus, 575 // we charge also headerDelay. 576 Tick snoop_resp_time = clockEdge(forwardLatency) + pkt->headerDelay; 577 // Reset the timing of the packet. 578 pkt->headerDelay = pkt->payloadDelay = 0; 579 memSidePort->schedTimingSnoopResp(pkt, snoop_resp_time); --- 1304 unchanged lines hidden (view full) --- 1884 bool alreadyResponded = pkt->memInhibitAsserted(); 1885 if (is_timing) { 1886 // copy the packet so that we can clear any flags before 1887 // forwarding it upwards, we also allocate data (passing 1888 // the pointer along in case of static data), in case 1889 // there is a snoop hit in upper levels 1890 Packet snoopPkt(pkt, true, true); 1891 snoopPkt.setExpressSnoop(); |
1900 snoopPkt.pushSenderState(new ForwardResponseRecord()); | |
1901 // the snoop packet does not need to wait any additional 1902 // time 1903 snoopPkt.headerDelay = snoopPkt.payloadDelay = 0; 1904 cpuSidePort->sendTimingSnoopReq(&snoopPkt); 1905 1906 // add the header delay (including crossbar and snoop 1907 // delays) of the upward snoop to the snoop delay for this 1908 // cache 1909 snoop_delay += snoopPkt.headerDelay; 1910 1911 if (snoopPkt.memInhibitAsserted()) { 1912 // cache-to-cache response from some upper cache 1913 assert(!alreadyResponded); 1914 pkt->assertMemInhibit(); | 1892 // the snoop packet does not need to wait any additional 1893 // time 1894 snoopPkt.headerDelay = snoopPkt.payloadDelay = 0; 1895 cpuSidePort->sendTimingSnoopReq(&snoopPkt); 1896 1897 // add the header delay (including crossbar and snoop 1898 // delays) of the upward snoop to the snoop delay for this 1899 // cache 1900 snoop_delay += snoopPkt.headerDelay; 1901 1902 if (snoopPkt.memInhibitAsserted()) { 1903 // cache-to-cache response from some upper cache 1904 assert(!alreadyResponded); 1905 pkt->assertMemInhibit(); |
1915 } else { 1916 // no cache (or anyone else for that matter) will 1917 // respond, so delete the ForwardResponseRecord here 1918 delete snoopPkt.popSenderState(); | |
1919 } 1920 if (snoopPkt.sharedAsserted()) { 1921 pkt->assertShared(); 1922 } 1923 // If this request is a prefetch or clean evict and an upper level 1924 // signals block present, make sure to propagate the block 1925 // presence to the requester. 1926 if (snoopPkt.isBlockCached()) { --- 418 unchanged lines hidden (view full) --- 2345 2346 // It is important to check memInhibitAsserted before 2347 // prefetchSquashed. If another cache has asserted MEM_INGIBIT, it 2348 // will be sending a response which will arrive at the MSHR 2349 // allocated ofr this request. Checking the prefetchSquash first 2350 // may result in the MSHR being prematurely deallocated. 2351 2352 if (snoop_pkt.memInhibitAsserted()) { | 1906 } 1907 if (snoopPkt.sharedAsserted()) { 1908 pkt->assertShared(); 1909 } 1910 // If this request is a prefetch or clean evict and an upper level 1911 // signals block present, make sure to propagate the block 1912 // presence to the requester. 1913 if (snoopPkt.isBlockCached()) { --- 418 unchanged lines hidden (view full) --- 2332 2333 // It is important to check memInhibitAsserted before 2334 // prefetchSquashed. If another cache has asserted MEM_INGIBIT, it 2335 // will be sending a response which will arrive at the MSHR 2336 // allocated ofr this request. Checking the prefetchSquash first 2337 // may result in the MSHR being prematurely deallocated. 2338 2339 if (snoop_pkt.memInhibitAsserted()) { |
2340 auto M5_VAR_USED r = outstandingSnoop.insert(snoop_pkt.req); 2341 assert(r.second); |
|
2353 // If we are getting a non-shared response it is dirty 2354 bool pending_dirty_resp = !snoop_pkt.sharedAsserted(); 2355 markInService(mshr, pending_dirty_resp); 2356 DPRINTF(Cache, "Upward snoop of prefetch for addr" 2357 " %#x (%s) hit\n", 2358 tgt_pkt->getAddr(), tgt_pkt->isSecure()? "s": "ns"); 2359 return NULL; 2360 } --- 294 unchanged lines hidden --- | 2342 // If we are getting a non-shared response it is dirty 2343 bool pending_dirty_resp = !snoop_pkt.sharedAsserted(); 2344 markInService(mshr, pending_dirty_resp); 2345 DPRINTF(Cache, "Upward snoop of prefetch for addr" 2346 " %#x (%s) hit\n", 2347 tgt_pkt->getAddr(), tgt_pkt->isSecure()? "s": "ns"); 2348 return NULL; 2349 } --- 294 unchanged lines hidden --- |