mshr.cc (12792:9af3470e24e7) mshr.cc (12793:dda6af979353)
1/*
2 * Copyright (c) 2012-2013, 2015-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

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

543 deferredTargets.populateFlags();
544 targets.populateFlags();
545 order = targets.front().order;
546 readyTime = std::max(curTick(), targets.front().readyTime);
547
548 return true;
549}
550
1/*
2 * Copyright (c) 2012-2013, 2015-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

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

543 deferredTargets.populateFlags();
544 targets.populateFlags();
545 order = targets.front().order;
546 readyTime = std::max(curTick(), targets.front().readyTime);
547
548 return true;
549}
550
551void
552MSHR::promoteIf(const std::function<bool (Target &)>& pred)
553{
554 // if any of the deferred targets were upper-level cache
555 // requests marked downstreamPending, need to clear that
556 assert(!downstreamPending); // not pending here anymore
551
557
558 // find the first target does not satisfy the condition
559 auto last_it = std::find_if_not(deferredTargets.begin(),
560 deferredTargets.end(),
561 pred);
562
563 // for the prefix of the deferredTargets [begin(), last_it) clear
564 // the downstreamPending flag and move them to the target list
565 deferredTargets.clearDownstreamPending(deferredTargets.begin(),
566 last_it);
567 targets.splice(targets.end(), deferredTargets,
568 deferredTargets.begin(), last_it);
569 // We need to update the flags for the target lists after the
570 // modifications
571 deferredTargets.populateFlags();
572}
573
552void
574void
575MSHR::promoteReadable()
576{
577 if (!deferredTargets.empty() && !hasPostInvalidate()) {
578 // We got a non invalidating response, and we have the block
579 // but we have deferred targets which are waiting and they do
580 // not need writable. This can happen if the original request
581 // was for a cache clean operation and we had a copy of the
582 // block. Since we serviced the cache clean operation and we
583 // have the block, there's no need to defer the targets, so
584 // move them up to the regular target list.
585
586 auto pred = [](Target &t) {
587 assert(t.source == Target::FromCPU);
588 return !t.pkt->req->isCacheInvalidate() &&
589 !t.pkt->needsWritable();
590 };
591 promoteIf(pred);
592 }
593}
594
595void
553MSHR::promoteWritable()
554{
555 if (deferredTargets.needsWritable &&
556 !(hasPostInvalidate() || hasPostDowngrade())) {
557 // We got a writable response, but we have deferred targets
558 // which are waiting to request a writable copy (not because
559 // of a pending invalidate). This can happen if the original
560 // request was for a read-only block, but we got a writable
561 // response anyway. Since we got the writable copy there's no
562 // need to defer the targets, so move them up to the regular
563 // target list.
564 assert(!targets.needsWritable);
565 targets.needsWritable = true;
596MSHR::promoteWritable()
597{
598 if (deferredTargets.needsWritable &&
599 !(hasPostInvalidate() || hasPostDowngrade())) {
600 // We got a writable response, but we have deferred targets
601 // which are waiting to request a writable copy (not because
602 // of a pending invalidate). This can happen if the original
603 // request was for a read-only block, but we got a writable
604 // response anyway. Since we got the writable copy there's no
605 // need to defer the targets, so move them up to the regular
606 // target list.
607 assert(!targets.needsWritable);
608 targets.needsWritable = true;
566 // if any of the deferred targets were upper-level cache
567 // requests marked downstreamPending, need to clear that
568 assert(!downstreamPending); // not pending here anymore
569
609
570 auto last_it = std::find_if(
571 deferredTargets.begin(), deferredTargets.end(),
572 [](MSHR::Target &t) {
573 assert(t.source == Target::FromCPU);
574 return t.pkt->req->isCacheInvalidate();
575 });
576 deferredTargets.clearDownstreamPending(deferredTargets.begin(),
577 last_it);
578 targets.splice(targets.end(), deferredTargets,
579 deferredTargets.begin(), last_it);
580 // We need to update the flags for the target lists after the
581 // modifications
582 deferredTargets.populateFlags();
610 auto pred = [](Target &t) {
611 assert(t.source == Target::FromCPU);
612 return !t.pkt->req->isCacheInvalidate();
613 };
614
615 promoteIf(pred);
583 }
584}
585
586
587bool
588MSHR::checkFunctional(PacketPtr pkt)
589{
590 // For printing, we treat the MSHR as a whole as single entity.

--- 50 unchanged lines hidden ---
616 }
617}
618
619
620bool
621MSHR::checkFunctional(PacketPtr pkt)
622{
623 // For printing, we treat the MSHR as a whole as single entity.

--- 50 unchanged lines hidden ---