mshr.cc (5730:dea5fcd1ead0) | mshr.cc (5875:d82be3235ab4) |
---|---|
1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 50 unchanged lines hidden (view full) --- 59 60MSHR::TargetList::TargetList() 61 : needsExclusive(false), hasUpgrade(false) 62{} 63 64 65inline void 66MSHR::TargetList::add(PacketPtr pkt, Tick readyTime, | 1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 50 unchanged lines hidden (view full) --- 59 60MSHR::TargetList::TargetList() 61 : needsExclusive(false), hasUpgrade(false) 62{} 63 64 65inline void 66MSHR::TargetList::add(PacketPtr pkt, Tick readyTime, |
67 Counter order, bool cpuSide, bool markPending) | 67 Counter order, Target::Source source, bool markPending) |
68{ | 68{ |
69 if (cpuSide) { | 69 if (source != Target::FromSnoop) { |
70 if (pkt->needsExclusive()) { 71 needsExclusive = true; 72 } 73 74 if (pkt->cmd == MemCmd::UpgradeReq) { 75 hasUpgrade = true; 76 } 77 } 78 79 if (markPending) { 80 MSHR *mshr = dynamic_cast<MSHR*>(pkt->senderState); 81 if (mshr != NULL) { 82 assert(!mshr->downstreamPending); 83 mshr->downstreamPending = true; 84 } 85 } 86 | 70 if (pkt->needsExclusive()) { 71 needsExclusive = true; 72 } 73 74 if (pkt->cmd == MemCmd::UpgradeReq) { 75 hasUpgrade = true; 76 } 77 } 78 79 if (markPending) { 80 MSHR *mshr = dynamic_cast<MSHR*>(pkt->senderState); 81 if (mshr != NULL) { 82 assert(!mshr->downstreamPending); 83 mshr->downstreamPending = true; 84 } 85 } 86 |
87 push_back(Target(pkt, readyTime, order, cpuSide, markPending)); | 87 push_back(Target(pkt, readyTime, order, source, markPending)); |
88} 89 90 91void 92MSHR::TargetList::replaceUpgrades() 93{ 94 if (!hasUpgrade) 95 return; --- 40 unchanged lines hidden (view full) --- 136 137 138void 139MSHR::TargetList:: 140print(std::ostream &os, int verbosity, const std::string &prefix) const 141{ 142 ConstIterator end_i = end(); 143 for (ConstIterator i = begin(); i != end_i; ++i) { | 88} 89 90 91void 92MSHR::TargetList::replaceUpgrades() 93{ 94 if (!hasUpgrade) 95 return; --- 40 unchanged lines hidden (view full) --- 136 137 138void 139MSHR::TargetList:: 140print(std::ostream &os, int verbosity, const std::string &prefix) const 141{ 142 ConstIterator end_i = end(); 143 for (ConstIterator i = begin(); i != end_i; ++i) { |
144 ccprintf(os, "%s%s: ", prefix, i->isCpuSide() ? "cpu" : "mem"); | 144 const char *s; 145 switch (i->source) { 146 case Target::FromCPU: s = "FromCPU"; 147 case Target::FromSnoop: s = "FromSnoop"; 148 case Target::FromPrefetcher: s = "FromPrefetcher"; 149 default: s = ""; 150 } 151 ccprintf(os, "%s%s: ", prefix, s); |
145 i->pkt->print(os, verbosity, ""); 146 } 147} 148 149 150void 151MSHR::allocate(Addr _addr, int _size, PacketPtr target, 152 Tick whenReady, Counter _order) --- 4 unchanged lines hidden (view full) --- 157 order = _order; 158 assert(target); 159 isForward = false; 160 _isUncacheable = target->req->isUncacheable(); 161 inService = false; 162 downstreamPending = false; 163 threadNum = 0; 164 ntargets = 1; | 152 i->pkt->print(os, verbosity, ""); 153 } 154} 155 156 157void 158MSHR::allocate(Addr _addr, int _size, PacketPtr target, 159 Tick whenReady, Counter _order) --- 4 unchanged lines hidden (view full) --- 164 order = _order; 165 assert(target); 166 isForward = false; 167 _isUncacheable = target->req->isUncacheable(); 168 inService = false; 169 downstreamPending = false; 170 threadNum = 0; 171 ntargets = 1; |
165 // Don't know of a case where we would allocate a new MSHR for a 166 // snoop (mem-side request), so set cpuSide to true here. | |
167 assert(targets->isReset()); | 172 assert(targets->isReset()); |
168 targets->add(target, whenReady, _order, true, true); | 173 // Don't know of a case where we would allocate a new MSHR for a 174 // snoop (mem-side request), so set source according to request here 175 Target::Source source = (target->cmd == MemCmd::HardPFReq) ? 176 Target::FromPrefetcher : Target::FromCPU; 177 targets->add(target, whenReady, _order, source, true); |
169 assert(deferredTargets->isReset()); 170 pendingInvalidate = false; 171 pendingShared = false; 172 data = NULL; 173} 174 175 176void --- 48 unchanged lines hidden (view full) --- 225 // if there's a request already in service for this MSHR, we will 226 // have to defer the new target until after the response if any of 227 // the following are true: 228 // - there are other targets already deferred 229 // - there's a pending invalidate to be applied after the response 230 // comes back (but before this target is processed) 231 // - the outstanding request is for a non-exclusive block and this 232 // target requires an exclusive block | 178 assert(deferredTargets->isReset()); 179 pendingInvalidate = false; 180 pendingShared = false; 181 data = NULL; 182} 183 184 185void --- 48 unchanged lines hidden (view full) --- 234 // if there's a request already in service for this MSHR, we will 235 // have to defer the new target until after the response if any of 236 // the following are true: 237 // - there are other targets already deferred 238 // - there's a pending invalidate to be applied after the response 239 // comes back (but before this target is processed) 240 // - the outstanding request is for a non-exclusive block and this 241 // target requires an exclusive block |
242 243 // assume we'd never issue a prefetch when we've got an 244 // outstanding miss 245 assert(pkt->cmd != MemCmd::HardPFReq); 246 |
|
233 if (inService && 234 (!deferredTargets->empty() || pendingInvalidate || 235 (!targets->needsExclusive && pkt->needsExclusive()))) { 236 // need to put on deferred list | 247 if (inService && 248 (!deferredTargets->empty() || pendingInvalidate || 249 (!targets->needsExclusive && pkt->needsExclusive()))) { 250 // need to put on deferred list |
237 deferredTargets->add(pkt, whenReady, _order, true, true); | 251 deferredTargets->add(pkt, whenReady, _order, Target::FromCPU, true); |
238 } else { 239 // No request outstanding, or still OK to append to 240 // outstanding request: append to regular target list. Only 241 // mark pending if current request hasn't been issued yet 242 // (isn't in service). | 252 } else { 253 // No request outstanding, or still OK to append to 254 // outstanding request: append to regular target list. Only 255 // mark pending if current request hasn't been issued yet 256 // (isn't in service). |
243 targets->add(pkt, whenReady, _order, true, !inService); | 257 targets->add(pkt, whenReady, _order, Target::FromCPU, !inService); |
244 } 245 246 ++ntargets; 247} 248 249bool 250MSHR::handleSnoop(PacketPtr pkt, Counter _order) 251{ --- 34 unchanged lines hidden (view full) --- 286 // further snooping. 287 return true; 288 } 289 290 if (targets->needsExclusive || pkt->needsExclusive()) { 291 // actual target device (typ. PhysicalMemory) will delete the 292 // packet on reception, so we need to save a copy here 293 PacketPtr cp_pkt = new Packet(pkt, true); | 258 } 259 260 ++ntargets; 261} 262 263bool 264MSHR::handleSnoop(PacketPtr pkt, Counter _order) 265{ --- 34 unchanged lines hidden (view full) --- 300 // further snooping. 301 return true; 302 } 303 304 if (targets->needsExclusive || pkt->needsExclusive()) { 305 // actual target device (typ. PhysicalMemory) will delete the 306 // packet on reception, so we need to save a copy here 307 PacketPtr cp_pkt = new Packet(pkt, true); |
294 targets->add(cp_pkt, curTick, _order, false, | 308 targets->add(cp_pkt, curTick, _order, Target::FromSnoop, |
295 downstreamPending && targets->needsExclusive); 296 ++ntargets; 297 298 if (targets->needsExclusive) { 299 // We're awaiting an exclusive copy, so ownership is pending. 300 // It's up to us to respond once the data arrives. 301 pkt->assertMemInhibit(); 302 pkt->setSupplyExclusive(); --- 123 unchanged lines hidden --- | 309 downstreamPending && targets->needsExclusive); 310 ++ntargets; 311 312 if (targets->needsExclusive) { 313 // We're awaiting an exclusive copy, so ownership is pending. 314 // It's up to us to respond once the data arrives. 315 pkt->assertMemInhibit(); 316 pkt->setSupplyExclusive(); --- 123 unchanged lines hidden --- |