mshr.cc (10764:b32578b2af99) mshr.cc (10766:b2071d0eb5f1)
1/*
2 * Copyright (c) 2012-2013, 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

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

99 // flag. Otherwise, do nothing.
100 MSHR *mshr = pkt->findNextSenderState<MSHR>();
101 if (mshr != NULL) {
102 assert(!mshr->downstreamPending);
103 mshr->downstreamPending = true;
104 }
105 }
106
1/*
2 * Copyright (c) 2012-2013, 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

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

99 // flag. Otherwise, do nothing.
100 MSHR *mshr = pkt->findNextSenderState<MSHR>();
101 if (mshr != NULL) {
102 assert(!mshr->downstreamPending);
103 mshr->downstreamPending = true;
104 }
105 }
106
107 push_back(Target(pkt, readyTime, order, source, markPending));
107 emplace_back(Target(pkt, readyTime, order, source, markPending));
108}
109
110
111static void
112replaceUpgrade(PacketPtr pkt)
113{
114 if (pkt->cmd == MemCmd::UpgradeReq) {
115 pkt->cmd = MemCmd::ReadExReq;

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

125
126
127void
128MSHR::TargetList::replaceUpgrades()
129{
130 if (!hasUpgrade)
131 return;
132
108}
109
110
111static void
112replaceUpgrade(PacketPtr pkt)
113{
114 if (pkt->cmd == MemCmd::UpgradeReq) {
115 pkt->cmd = MemCmd::ReadExReq;

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

125
126
127void
128MSHR::TargetList::replaceUpgrades()
129{
130 if (!hasUpgrade)
131 return;
132
133 Iterator end_i = end();
134 for (Iterator i = begin(); i != end_i; ++i) {
135 replaceUpgrade(i->pkt);
133 for (auto& t : *this) {
134 replaceUpgrade(t.pkt);
136 }
137
138 hasUpgrade = false;
139}
140
141
142void
143MSHR::TargetList::clearDownstreamPending()
144{
135 }
136
137 hasUpgrade = false;
138}
139
140
141void
142MSHR::TargetList::clearDownstreamPending()
143{
145 Iterator end_i = end();
146 for (Iterator i = begin(); i != end_i; ++i) {
147 if (i->markedPending) {
144 for (auto& t : *this) {
145 if (t.markedPending) {
148 // Iterate over the SenderState stack and see if we find
149 // an MSHR entry. If we find one, clear the
150 // downstreamPending flag by calling
151 // clearDownstreamPending(). This recursively clears the
152 // downstreamPending flag in all caches this packet has
153 // passed through.
146 // Iterate over the SenderState stack and see if we find
147 // an MSHR entry. If we find one, clear the
148 // downstreamPending flag by calling
149 // clearDownstreamPending(). This recursively clears the
150 // downstreamPending flag in all caches this packet has
151 // passed through.
154 MSHR *mshr = i->pkt->findNextSenderState<MSHR>();
152 MSHR *mshr = t.pkt->findNextSenderState<MSHR>();
155 if (mshr != NULL) {
156 mshr->clearDownstreamPending();
157 }
158 }
159 }
160}
161
162
163bool
164MSHR::TargetList::checkFunctional(PacketPtr pkt)
165{
153 if (mshr != NULL) {
154 mshr->clearDownstreamPending();
155 }
156 }
157 }
158}
159
160
161bool
162MSHR::TargetList::checkFunctional(PacketPtr pkt)
163{
166 Iterator end_i = end();
167 for (Iterator i = begin(); i != end_i; ++i) {
168 if (pkt->checkFunctional(i->pkt)) {
164 for (auto& t : *this) {
165 if (pkt->checkFunctional(t.pkt)) {
169 return true;
170 }
171 }
172
173 return false;
174}
175
176
177void
166 return true;
167 }
168 }
169
170 return false;
171}
172
173
174void
178MSHR::TargetList::
179print(std::ostream &os, int verbosity, const std::string &prefix) const
175MSHR::TargetList::print(std::ostream &os, int verbosity,
176 const std::string &prefix) const
180{
177{
181 ConstIterator end_i = end();
182 for (ConstIterator i = begin(); i != end_i; ++i) {
178 for (auto& t : *this) {
183 const char *s;
179 const char *s;
184 switch (i->source) {
180 switch (t.source) {
185 case Target::FromCPU:
186 s = "FromCPU";
187 break;
188 case Target::FromSnoop:
189 s = "FromSnoop";
190 break;
191 case Target::FromPrefetcher:
192 s = "FromPrefetcher";
193 break;
194 default:
195 s = "";
196 break;
197 }
198 ccprintf(os, "%s%s: ", prefix, s);
181 case Target::FromCPU:
182 s = "FromCPU";
183 break;
184 case Target::FromSnoop:
185 s = "FromSnoop";
186 break;
187 case Target::FromPrefetcher:
188 s = "FromPrefetcher";
189 break;
190 default:
191 s = "";
192 break;
193 }
194 ccprintf(os, "%s%s: ", prefix, s);
199 i->pkt->print(os, verbosity, "");
195 t.pkt->print(os, verbosity, "");
200 }
201}
202
203
204void
205MSHR::allocate(Addr blk_addr, unsigned blk_size, PacketPtr target,
206 Tick when_ready, Counter _order)
207{

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

408 order = targets.front().order;
409 readyTime = std::max(curTick(), targets.front().readyTime);
410
411 return true;
412}
413
414
415void
196 }
197}
198
199
200void
201MSHR::allocate(Addr blk_addr, unsigned blk_size, PacketPtr target,
202 Tick when_ready, Counter _order)
203{

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

404 order = targets.front().order;
405 readyTime = std::max(curTick(), targets.front().readyTime);
406
407 return true;
408}
409
410
411void
416MSHR::handleFill(Packet *pkt, CacheBlk *blk)
412MSHR::handleFill(PacketPtr pkt, CacheBlk *blk)
417{
418 if (!pkt->sharedAsserted()
419 && !(hasPostInvalidate() || hasPostDowngrade())
420 && deferredTargets.needsExclusive) {
421 // We got an exclusive response, but we have deferred targets
422 // which are waiting to request an exclusive copy (not because
423 // of a pending invalidate). This can happen if the original
424 // request was for a read-only (non-exclusive) block, but we

--- 63 unchanged lines hidden ---
413{
414 if (!pkt->sharedAsserted()
415 && !(hasPostInvalidate() || hasPostDowngrade())
416 && deferredTargets.needsExclusive) {
417 // We got an exclusive response, but we have deferred targets
418 // which are waiting to request an exclusive copy (not because
419 // of a pending invalidate). This can happen if the original
420 // request was for a read-only (non-exclusive) block, but we

--- 63 unchanged lines hidden ---