coherent_xbar.cc (11334:9bd2e84abdca) coherent_xbar.cc (11544:2383451ff6a5)
1/*
2 * Copyright (c) 2011-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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2006 The Regents of The University of Michigan
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Authors: Ali Saidi
41 * Andreas Hansson
42 * William Wang
43 */
44
45/**
46 * @file
47 * Definition of a crossbar object.
48 */
49
50#include "base/misc.hh"
51#include "base/trace.hh"
52#include "debug/AddrRanges.hh"
53#include "debug/CoherentXBar.hh"
54#include "mem/coherent_xbar.hh"
55#include "sim/system.hh"
56
57CoherentXBar::CoherentXBar(const CoherentXBarParams *p)
58 : BaseXBar(p), system(p->system), snoopFilter(p->snoop_filter),
59 snoopResponseLatency(p->snoop_response_latency),
60 pointOfCoherency(p->point_of_coherency)
61{
62 // create the ports based on the size of the master and slave
63 // vector ports, and the presence of the default port, the ports
64 // are enumerated starting from zero
65 for (int i = 0; i < p->port_master_connection_count; ++i) {
66 std::string portName = csprintf("%s.master[%d]", name(), i);
67 MasterPort* bp = new CoherentXBarMasterPort(portName, *this, i);
68 masterPorts.push_back(bp);
69 reqLayers.push_back(new ReqLayer(*bp, *this,
70 csprintf(".reqLayer%d", i)));
71 snoopLayers.push_back(new SnoopRespLayer(*bp, *this,
72 csprintf(".snoopLayer%d", i)));
73 }
74
75 // see if we have a default slave device connected and if so add
76 // our corresponding master port
77 if (p->port_default_connection_count) {
78 defaultPortID = masterPorts.size();
79 std::string portName = name() + ".default";
80 MasterPort* bp = new CoherentXBarMasterPort(portName, *this,
81 defaultPortID);
82 masterPorts.push_back(bp);
83 reqLayers.push_back(new ReqLayer(*bp, *this, csprintf(".reqLayer%d",
84 defaultPortID)));
85 snoopLayers.push_back(new SnoopRespLayer(*bp, *this,
86 csprintf(".snoopLayer%d",
87 defaultPortID)));
88 }
89
90 // create the slave ports, once again starting at zero
91 for (int i = 0; i < p->port_slave_connection_count; ++i) {
92 std::string portName = csprintf("%s.slave[%d]", name(), i);
93 QueuedSlavePort* bp = new CoherentXBarSlavePort(portName, *this, i);
94 slavePorts.push_back(bp);
95 respLayers.push_back(new RespLayer(*bp, *this,
96 csprintf(".respLayer%d", i)));
97 snoopRespPorts.push_back(new SnoopRespPort(*bp, *this));
98 }
99
100 clearPortCache();
101}
102
103CoherentXBar::~CoherentXBar()
104{
105 for (auto l: reqLayers)
106 delete l;
107 for (auto l: respLayers)
108 delete l;
109 for (auto l: snoopLayers)
110 delete l;
111 for (auto p: snoopRespPorts)
112 delete p;
113}
114
115void
116CoherentXBar::init()
117{
1/*
2 * Copyright (c) 2011-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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2006 The Regents of The University of Michigan
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Authors: Ali Saidi
41 * Andreas Hansson
42 * William Wang
43 */
44
45/**
46 * @file
47 * Definition of a crossbar object.
48 */
49
50#include "base/misc.hh"
51#include "base/trace.hh"
52#include "debug/AddrRanges.hh"
53#include "debug/CoherentXBar.hh"
54#include "mem/coherent_xbar.hh"
55#include "sim/system.hh"
56
57CoherentXBar::CoherentXBar(const CoherentXBarParams *p)
58 : BaseXBar(p), system(p->system), snoopFilter(p->snoop_filter),
59 snoopResponseLatency(p->snoop_response_latency),
60 pointOfCoherency(p->point_of_coherency)
61{
62 // create the ports based on the size of the master and slave
63 // vector ports, and the presence of the default port, the ports
64 // are enumerated starting from zero
65 for (int i = 0; i < p->port_master_connection_count; ++i) {
66 std::string portName = csprintf("%s.master[%d]", name(), i);
67 MasterPort* bp = new CoherentXBarMasterPort(portName, *this, i);
68 masterPorts.push_back(bp);
69 reqLayers.push_back(new ReqLayer(*bp, *this,
70 csprintf(".reqLayer%d", i)));
71 snoopLayers.push_back(new SnoopRespLayer(*bp, *this,
72 csprintf(".snoopLayer%d", i)));
73 }
74
75 // see if we have a default slave device connected and if so add
76 // our corresponding master port
77 if (p->port_default_connection_count) {
78 defaultPortID = masterPorts.size();
79 std::string portName = name() + ".default";
80 MasterPort* bp = new CoherentXBarMasterPort(portName, *this,
81 defaultPortID);
82 masterPorts.push_back(bp);
83 reqLayers.push_back(new ReqLayer(*bp, *this, csprintf(".reqLayer%d",
84 defaultPortID)));
85 snoopLayers.push_back(new SnoopRespLayer(*bp, *this,
86 csprintf(".snoopLayer%d",
87 defaultPortID)));
88 }
89
90 // create the slave ports, once again starting at zero
91 for (int i = 0; i < p->port_slave_connection_count; ++i) {
92 std::string portName = csprintf("%s.slave[%d]", name(), i);
93 QueuedSlavePort* bp = new CoherentXBarSlavePort(portName, *this, i);
94 slavePorts.push_back(bp);
95 respLayers.push_back(new RespLayer(*bp, *this,
96 csprintf(".respLayer%d", i)));
97 snoopRespPorts.push_back(new SnoopRespPort(*bp, *this));
98 }
99
100 clearPortCache();
101}
102
103CoherentXBar::~CoherentXBar()
104{
105 for (auto l: reqLayers)
106 delete l;
107 for (auto l: respLayers)
108 delete l;
109 for (auto l: snoopLayers)
110 delete l;
111 for (auto p: snoopRespPorts)
112 delete p;
113}
114
115void
116CoherentXBar::init()
117{
118 // the base class is responsible for determining the block size
119 BaseXBar::init();
120
121 // iterate over our slave ports and determine which of our
122 // neighbouring master ports are snooping and add them as snoopers
123 for (const auto& p: slavePorts) {
124 // check if the connected master port is snooping
125 if (p->isSnooping()) {
126 DPRINTF(AddrRanges, "Adding snooping master %s\n",
127 p->getMasterPort().name());
128 snoopPorts.push_back(p);
129 }
130 }
131
132 if (snoopPorts.empty())
133 warn("CoherentXBar %s has no snooping ports attached!\n", name());
134
135 // inform the snoop filter about the slave ports so it can create
136 // its own internal representation
137 if (snoopFilter)
138 snoopFilter->setSlavePorts(slavePorts);
139}
140
141bool
142CoherentXBar::recvTimingReq(PacketPtr pkt, PortID slave_port_id)
143{
144 // determine the source port based on the id
145 SlavePort *src_port = slavePorts[slave_port_id];
146
147 // remember if the packet is an express snoop
148 bool is_express_snoop = pkt->isExpressSnoop();
149 bool cache_responding = pkt->cacheResponding();
150 // for normal requests, going downstream, the express snoop flag
151 // and the cache responding flag should always be the same
152 assert(is_express_snoop == cache_responding);
153
154 // determine the destination based on the address
155 PortID master_port_id = findPort(pkt->getAddr());
156
157 // test if the crossbar should be considered occupied for the current
158 // port, and exclude express snoops from the check
159 if (!is_express_snoop && !reqLayers[master_port_id]->tryTiming(src_port)) {
160 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x BUSY\n",
161 src_port->name(), pkt->cmdString(), pkt->getAddr());
162 return false;
163 }
164
165 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s expr %d 0x%x\n",
166 src_port->name(), pkt->cmdString(), is_express_snoop,
167 pkt->getAddr());
168
169 // store size and command as they might be modified when
170 // forwarding the packet
171 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
172 unsigned int pkt_cmd = pkt->cmdToIndex();
173
174 // store the old header delay so we can restore it if needed
175 Tick old_header_delay = pkt->headerDelay;
176
177 // a request sees the frontend and forward latency
178 Tick xbar_delay = (frontendLatency + forwardLatency) * clockPeriod();
179
180 // set the packet header and payload delay
181 calcPacketTiming(pkt, xbar_delay);
182
183 // determine how long to be crossbar layer is busy
184 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
185
186 if (!system->bypassCaches()) {
187 assert(pkt->snoopDelay == 0);
188
189 // the packet is a memory-mapped request and should be
190 // broadcasted to our snoopers but the source
191 if (snoopFilter) {
192 // check with the snoop filter where to forward this packet
193 auto sf_res = snoopFilter->lookupRequest(pkt, *src_port);
194 // the time required by a packet to be delivered through
195 // the xbar has to be charged also with to lookup latency
196 // of the snoop filter
197 pkt->headerDelay += sf_res.second * clockPeriod();
198 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x"\
199 " SF size: %i lat: %i\n", src_port->name(),
200 pkt->cmdString(), pkt->getAddr(), sf_res.first.size(),
201 sf_res.second);
202
203 if (pkt->isEviction()) {
204 // for block-evicting packets, i.e. writebacks and
205 // clean evictions, there is no need to snoop up, as
206 // all we do is determine if the block is cached or
207 // not, instead just set it here based on the snoop
208 // filter result
209 if (!sf_res.first.empty())
210 pkt->setBlockCached();
211 } else {
212 forwardTiming(pkt, slave_port_id, sf_res.first);
213 }
214 } else {
215 forwardTiming(pkt, slave_port_id);
216 }
217
218 // add the snoop delay to our header delay, and then reset it
219 pkt->headerDelay += pkt->snoopDelay;
220 pkt->snoopDelay = 0;
221 }
222
223 // set up a sensible starting point
224 bool success = true;
225
226 // remember if the packet will generate a snoop response by
227 // checking if a cache set the cacheResponding flag during the
228 // snooping above
229 const bool expect_snoop_resp = !cache_responding && pkt->cacheResponding();
230 bool expect_response = pkt->needsResponse() && !pkt->cacheResponding();
231
232 const bool sink_packet = sinkPacket(pkt);
233
234 // in certain cases the crossbar is responsible for responding
235 bool respond_directly = false;
118 BaseXBar::init();
119
120 // iterate over our slave ports and determine which of our
121 // neighbouring master ports are snooping and add them as snoopers
122 for (const auto& p: slavePorts) {
123 // check if the connected master port is snooping
124 if (p->isSnooping()) {
125 DPRINTF(AddrRanges, "Adding snooping master %s\n",
126 p->getMasterPort().name());
127 snoopPorts.push_back(p);
128 }
129 }
130
131 if (snoopPorts.empty())
132 warn("CoherentXBar %s has no snooping ports attached!\n", name());
133
134 // inform the snoop filter about the slave ports so it can create
135 // its own internal representation
136 if (snoopFilter)
137 snoopFilter->setSlavePorts(slavePorts);
138}
139
140bool
141CoherentXBar::recvTimingReq(PacketPtr pkt, PortID slave_port_id)
142{
143 // determine the source port based on the id
144 SlavePort *src_port = slavePorts[slave_port_id];
145
146 // remember if the packet is an express snoop
147 bool is_express_snoop = pkt->isExpressSnoop();
148 bool cache_responding = pkt->cacheResponding();
149 // for normal requests, going downstream, the express snoop flag
150 // and the cache responding flag should always be the same
151 assert(is_express_snoop == cache_responding);
152
153 // determine the destination based on the address
154 PortID master_port_id = findPort(pkt->getAddr());
155
156 // test if the crossbar should be considered occupied for the current
157 // port, and exclude express snoops from the check
158 if (!is_express_snoop && !reqLayers[master_port_id]->tryTiming(src_port)) {
159 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x BUSY\n",
160 src_port->name(), pkt->cmdString(), pkt->getAddr());
161 return false;
162 }
163
164 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s expr %d 0x%x\n",
165 src_port->name(), pkt->cmdString(), is_express_snoop,
166 pkt->getAddr());
167
168 // store size and command as they might be modified when
169 // forwarding the packet
170 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
171 unsigned int pkt_cmd = pkt->cmdToIndex();
172
173 // store the old header delay so we can restore it if needed
174 Tick old_header_delay = pkt->headerDelay;
175
176 // a request sees the frontend and forward latency
177 Tick xbar_delay = (frontendLatency + forwardLatency) * clockPeriod();
178
179 // set the packet header and payload delay
180 calcPacketTiming(pkt, xbar_delay);
181
182 // determine how long to be crossbar layer is busy
183 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
184
185 if (!system->bypassCaches()) {
186 assert(pkt->snoopDelay == 0);
187
188 // the packet is a memory-mapped request and should be
189 // broadcasted to our snoopers but the source
190 if (snoopFilter) {
191 // check with the snoop filter where to forward this packet
192 auto sf_res = snoopFilter->lookupRequest(pkt, *src_port);
193 // the time required by a packet to be delivered through
194 // the xbar has to be charged also with to lookup latency
195 // of the snoop filter
196 pkt->headerDelay += sf_res.second * clockPeriod();
197 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x"\
198 " SF size: %i lat: %i\n", src_port->name(),
199 pkt->cmdString(), pkt->getAddr(), sf_res.first.size(),
200 sf_res.second);
201
202 if (pkt->isEviction()) {
203 // for block-evicting packets, i.e. writebacks and
204 // clean evictions, there is no need to snoop up, as
205 // all we do is determine if the block is cached or
206 // not, instead just set it here based on the snoop
207 // filter result
208 if (!sf_res.first.empty())
209 pkt->setBlockCached();
210 } else {
211 forwardTiming(pkt, slave_port_id, sf_res.first);
212 }
213 } else {
214 forwardTiming(pkt, slave_port_id);
215 }
216
217 // add the snoop delay to our header delay, and then reset it
218 pkt->headerDelay += pkt->snoopDelay;
219 pkt->snoopDelay = 0;
220 }
221
222 // set up a sensible starting point
223 bool success = true;
224
225 // remember if the packet will generate a snoop response by
226 // checking if a cache set the cacheResponding flag during the
227 // snooping above
228 const bool expect_snoop_resp = !cache_responding && pkt->cacheResponding();
229 bool expect_response = pkt->needsResponse() && !pkt->cacheResponding();
230
231 const bool sink_packet = sinkPacket(pkt);
232
233 // in certain cases the crossbar is responsible for responding
234 bool respond_directly = false;
236
235 // store the original address as an address mapper could possibly
236 // modify the address upon a sendTimingRequest
237 const Addr addr(pkt->getAddr());
237 if (sink_packet) {
238 DPRINTF(CoherentXBar, "Not forwarding %s to %#llx\n",
239 pkt->cmdString(), pkt->getAddr());
240 } else {
241 // determine if we are forwarding the packet, or responding to
242 // it
243 if (!pointOfCoherency || pkt->isRead() || pkt->isWrite()) {
244 // if we are passing on, rather than sinking, a packet to
245 // which an upstream cache has committed to responding,
246 // the line was needs writable, and the responding only
247 // had an Owned copy, so we need to immidiately let the
248 // downstream caches know, bypass any flow control
249 if (pkt->cacheResponding()) {
250 pkt->setExpressSnoop();
251 }
252
253 // since it is a normal request, attempt to send the packet
254 success = masterPorts[master_port_id]->sendTimingReq(pkt);
255 } else {
256 // no need to forward, turn this packet around and respond
257 // directly
258 assert(pkt->needsResponse());
259
260 respond_directly = true;
261 assert(!expect_snoop_resp);
262 expect_response = false;
263 }
264 }
265
266 if (snoopFilter && !system->bypassCaches()) {
267 // Let the snoop filter know about the success of the send operation
238 if (sink_packet) {
239 DPRINTF(CoherentXBar, "Not forwarding %s to %#llx\n",
240 pkt->cmdString(), pkt->getAddr());
241 } else {
242 // determine if we are forwarding the packet, or responding to
243 // it
244 if (!pointOfCoherency || pkt->isRead() || pkt->isWrite()) {
245 // if we are passing on, rather than sinking, a packet to
246 // which an upstream cache has committed to responding,
247 // the line was needs writable, and the responding only
248 // had an Owned copy, so we need to immidiately let the
249 // downstream caches know, bypass any flow control
250 if (pkt->cacheResponding()) {
251 pkt->setExpressSnoop();
252 }
253
254 // since it is a normal request, attempt to send the packet
255 success = masterPorts[master_port_id]->sendTimingReq(pkt);
256 } else {
257 // no need to forward, turn this packet around and respond
258 // directly
259 assert(pkt->needsResponse());
260
261 respond_directly = true;
262 assert(!expect_snoop_resp);
263 expect_response = false;
264 }
265 }
266
267 if (snoopFilter && !system->bypassCaches()) {
268 // Let the snoop filter know about the success of the send operation
268 snoopFilter->finishRequest(!success, pkt);
269 snoopFilter->finishRequest(!success, addr);
269 }
270
271 // check if we were successful in sending the packet onwards
272 if (!success) {
273 // express snoops should never be forced to retry
274 assert(!is_express_snoop);
275
276 // restore the header delay
277 pkt->headerDelay = old_header_delay;
278
279 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x RETRY\n",
280 src_port->name(), pkt->cmdString(), pkt->getAddr());
281
282 // update the layer state and schedule an idle event
283 reqLayers[master_port_id]->failedTiming(src_port,
284 clockEdge(Cycles(1)));
285 } else {
286 // express snoops currently bypass the crossbar state entirely
287 if (!is_express_snoop) {
288 // if this particular request will generate a snoop
289 // response
290 if (expect_snoop_resp) {
291 // we should never have an exsiting request outstanding
292 assert(outstandingSnoop.find(pkt->req) ==
293 outstandingSnoop.end());
294 outstandingSnoop.insert(pkt->req);
295
296 // basic sanity check on the outstanding snoops
297 panic_if(outstandingSnoop.size() > 512,
298 "Outstanding snoop requests exceeded 512\n");
299 }
300
301 // remember where to route the normal response to
302 if (expect_response || expect_snoop_resp) {
303 assert(routeTo.find(pkt->req) == routeTo.end());
304 routeTo[pkt->req] = slave_port_id;
305
306 panic_if(routeTo.size() > 512,
307 "Routing table exceeds 512 packets\n");
308 }
309
310 // update the layer state and schedule an idle event
311 reqLayers[master_port_id]->succeededTiming(packetFinishTime);
312 }
313
314 // stats updates only consider packets that were successfully sent
315 pktCount[slave_port_id][master_port_id]++;
316 pktSize[slave_port_id][master_port_id] += pkt_size;
317 transDist[pkt_cmd]++;
318
319 if (is_express_snoop)
320 snoops++;
321 }
322
323 if (sink_packet)
324 // queue the packet for deletion
325 pendingDelete.reset(pkt);
326
327 if (respond_directly) {
328 assert(pkt->needsResponse());
329 assert(success);
330
331 pkt->makeResponse();
332
333 if (snoopFilter && !system->bypassCaches()) {
334 // let the snoop filter inspect the response and update its state
335 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]);
336 }
337
338 Tick response_time = clockEdge() + pkt->headerDelay;
339 pkt->headerDelay = 0;
340
341 slavePorts[slave_port_id]->schedTimingResp(pkt, response_time);
342 }
343
344 return success;
345}
346
347bool
348CoherentXBar::recvTimingResp(PacketPtr pkt, PortID master_port_id)
349{
350 // determine the source port based on the id
351 MasterPort *src_port = masterPorts[master_port_id];
352
353 // determine the destination
354 const auto route_lookup = routeTo.find(pkt->req);
355 assert(route_lookup != routeTo.end());
356 const PortID slave_port_id = route_lookup->second;
357 assert(slave_port_id != InvalidPortID);
358 assert(slave_port_id < respLayers.size());
359
360 // test if the crossbar should be considered occupied for the
361 // current port
362 if (!respLayers[slave_port_id]->tryTiming(src_port)) {
363 DPRINTF(CoherentXBar, "recvTimingResp: src %s %s 0x%x BUSY\n",
364 src_port->name(), pkt->cmdString(), pkt->getAddr());
365 return false;
366 }
367
368 DPRINTF(CoherentXBar, "recvTimingResp: src %s %s 0x%x\n",
369 src_port->name(), pkt->cmdString(), pkt->getAddr());
370
371 // store size and command as they might be modified when
372 // forwarding the packet
373 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
374 unsigned int pkt_cmd = pkt->cmdToIndex();
375
376 // a response sees the response latency
377 Tick xbar_delay = responseLatency * clockPeriod();
378
379 // set the packet header and payload delay
380 calcPacketTiming(pkt, xbar_delay);
381
382 // determine how long to be crossbar layer is busy
383 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
384
385 if (snoopFilter && !system->bypassCaches()) {
386 // let the snoop filter inspect the response and update its state
387 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]);
388 }
389
390 // send the packet through the destination slave port and pay for
391 // any outstanding header delay
392 Tick latency = pkt->headerDelay;
393 pkt->headerDelay = 0;
394 slavePorts[slave_port_id]->schedTimingResp(pkt, curTick() + latency);
395
396 // remove the request from the routing table
397 routeTo.erase(route_lookup);
398
399 respLayers[slave_port_id]->succeededTiming(packetFinishTime);
400
401 // stats updates
402 pktCount[slave_port_id][master_port_id]++;
403 pktSize[slave_port_id][master_port_id] += pkt_size;
404 transDist[pkt_cmd]++;
405
406 return true;
407}
408
409void
410CoherentXBar::recvTimingSnoopReq(PacketPtr pkt, PortID master_port_id)
411{
412 DPRINTF(CoherentXBar, "recvTimingSnoopReq: src %s %s 0x%x\n",
413 masterPorts[master_port_id]->name(), pkt->cmdString(),
414 pkt->getAddr());
415
416 // update stats here as we know the forwarding will succeed
417 transDist[pkt->cmdToIndex()]++;
418 snoops++;
419
420 // we should only see express snoops from caches
421 assert(pkt->isExpressSnoop());
422
423 // set the packet header and payload delay, for now use forward latency
424 // @todo Assess the choice of latency further
425 calcPacketTiming(pkt, forwardLatency * clockPeriod());
426
427 // remember if a cache has already committed to responding so we
428 // can see if it changes during the snooping
429 const bool cache_responding = pkt->cacheResponding();
430
431 assert(pkt->snoopDelay == 0);
432
433 if (snoopFilter) {
434 // let the Snoop Filter work its magic and guide probing
435 auto sf_res = snoopFilter->lookupSnoop(pkt);
436 // the time required by a packet to be delivered through
437 // the xbar has to be charged also with to lookup latency
438 // of the snoop filter
439 pkt->headerDelay += sf_res.second * clockPeriod();
440 DPRINTF(CoherentXBar, "recvTimingSnoopReq: src %s %s 0x%x"\
441 " SF size: %i lat: %i\n", masterPorts[master_port_id]->name(),
442 pkt->cmdString(), pkt->getAddr(), sf_res.first.size(),
443 sf_res.second);
444
445 // forward to all snoopers
446 forwardTiming(pkt, InvalidPortID, sf_res.first);
447 } else {
448 forwardTiming(pkt, InvalidPortID);
449 }
450
451 // add the snoop delay to our header delay, and then reset it
452 pkt->headerDelay += pkt->snoopDelay;
453 pkt->snoopDelay = 0;
454
455 // if we can expect a response, remember how to route it
456 if (!cache_responding && pkt->cacheResponding()) {
457 assert(routeTo.find(pkt->req) == routeTo.end());
458 routeTo[pkt->req] = master_port_id;
459 }
460
461 // a snoop request came from a connected slave device (one of
462 // our master ports), and if it is not coming from the slave
463 // device responsible for the address range something is
464 // wrong, hence there is nothing further to do as the packet
465 // would be going back to where it came from
466 assert(master_port_id == findPort(pkt->getAddr()));
467}
468
469bool
470CoherentXBar::recvTimingSnoopResp(PacketPtr pkt, PortID slave_port_id)
471{
472 // determine the source port based on the id
473 SlavePort* src_port = slavePorts[slave_port_id];
474
475 // get the destination
476 const auto route_lookup = routeTo.find(pkt->req);
477 assert(route_lookup != routeTo.end());
478 const PortID dest_port_id = route_lookup->second;
479 assert(dest_port_id != InvalidPortID);
480
481 // determine if the response is from a snoop request we
482 // created as the result of a normal request (in which case it
483 // should be in the outstandingSnoop), or if we merely forwarded
484 // someone else's snoop request
485 const bool forwardAsSnoop = outstandingSnoop.find(pkt->req) ==
486 outstandingSnoop.end();
487
488 // test if the crossbar should be considered occupied for the
489 // current port, note that the check is bypassed if the response
490 // is being passed on as a normal response since this is occupying
491 // the response layer rather than the snoop response layer
492 if (forwardAsSnoop) {
493 assert(dest_port_id < snoopLayers.size());
494 if (!snoopLayers[dest_port_id]->tryTiming(src_port)) {
495 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x BUSY\n",
496 src_port->name(), pkt->cmdString(), pkt->getAddr());
497 return false;
498 }
499 } else {
500 // get the master port that mirrors this slave port internally
501 MasterPort* snoop_port = snoopRespPorts[slave_port_id];
502 assert(dest_port_id < respLayers.size());
503 if (!respLayers[dest_port_id]->tryTiming(snoop_port)) {
504 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x BUSY\n",
505 snoop_port->name(), pkt->cmdString(), pkt->getAddr());
506 return false;
507 }
508 }
509
510 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x\n",
511 src_port->name(), pkt->cmdString(), pkt->getAddr());
512
513 // store size and command as they might be modified when
514 // forwarding the packet
515 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
516 unsigned int pkt_cmd = pkt->cmdToIndex();
517
518 // responses are never express snoops
519 assert(!pkt->isExpressSnoop());
520
521 // a snoop response sees the snoop response latency, and if it is
522 // forwarded as a normal response, the response latency
523 Tick xbar_delay =
524 (forwardAsSnoop ? snoopResponseLatency : responseLatency) *
525 clockPeriod();
526
527 // set the packet header and payload delay
528 calcPacketTiming(pkt, xbar_delay);
529
530 // determine how long to be crossbar layer is busy
531 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
532
533 // forward it either as a snoop response or a normal response
534 if (forwardAsSnoop) {
535 // this is a snoop response to a snoop request we forwarded,
536 // e.g. coming from the L1 and going to the L2, and it should
537 // be forwarded as a snoop response
538
539 if (snoopFilter) {
540 // update the probe filter so that it can properly track the line
541 snoopFilter->updateSnoopForward(pkt, *slavePorts[slave_port_id],
542 *masterPorts[dest_port_id]);
543 }
544
545 bool success M5_VAR_USED =
546 masterPorts[dest_port_id]->sendTimingSnoopResp(pkt);
547 pktCount[slave_port_id][dest_port_id]++;
548 pktSize[slave_port_id][dest_port_id] += pkt_size;
549 assert(success);
550
551 snoopLayers[dest_port_id]->succeededTiming(packetFinishTime);
552 } else {
553 // we got a snoop response on one of our slave ports,
554 // i.e. from a coherent master connected to the crossbar, and
555 // since we created the snoop request as part of recvTiming,
556 // this should now be a normal response again
557 outstandingSnoop.erase(pkt->req);
558
559 // this is a snoop response from a coherent master, hence it
560 // should never go back to where the snoop response came from,
561 // but instead to where the original request came from
562 assert(slave_port_id != dest_port_id);
563
564 if (snoopFilter) {
565 // update the probe filter so that it can properly track the line
566 snoopFilter->updateSnoopResponse(pkt, *slavePorts[slave_port_id],
567 *slavePorts[dest_port_id]);
568 }
569
570 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x"\
571 " FWD RESP\n", src_port->name(), pkt->cmdString(),
572 pkt->getAddr());
573
574 // as a normal response, it should go back to a master through
575 // one of our slave ports, we also pay for any outstanding
576 // header latency
577 Tick latency = pkt->headerDelay;
578 pkt->headerDelay = 0;
579 slavePorts[dest_port_id]->schedTimingResp(pkt, curTick() + latency);
580
581 respLayers[dest_port_id]->succeededTiming(packetFinishTime);
582 }
583
584 // remove the request from the routing table
585 routeTo.erase(route_lookup);
586
587 // stats updates
588 transDist[pkt_cmd]++;
589 snoops++;
590
591 return true;
592}
593
594
595void
596CoherentXBar::forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id,
597 const std::vector<QueuedSlavePort*>& dests)
598{
599 DPRINTF(CoherentXBar, "%s for %s address %x size %d\n", __func__,
600 pkt->cmdString(), pkt->getAddr(), pkt->getSize());
601
602 // snoops should only happen if the system isn't bypassing caches
603 assert(!system->bypassCaches());
604
605 unsigned fanout = 0;
606
607 for (const auto& p: dests) {
608 // we could have gotten this request from a snooping master
609 // (corresponding to our own slave port that is also in
610 // snoopPorts) and should not send it back to where it came
611 // from
612 if (exclude_slave_port_id == InvalidPortID ||
613 p->getId() != exclude_slave_port_id) {
614 // cache is not allowed to refuse snoop
615 p->sendTimingSnoopReq(pkt);
616 fanout++;
617 }
618 }
619
620 // Stats for fanout of this forward operation
621 snoopFanout.sample(fanout);
622}
623
624void
625CoherentXBar::recvReqRetry(PortID master_port_id)
626{
627 // responses and snoop responses never block on forwarding them,
628 // so the retry will always be coming from a port to which we
629 // tried to forward a request
630 reqLayers[master_port_id]->recvRetry();
631}
632
633Tick
634CoherentXBar::recvAtomic(PacketPtr pkt, PortID slave_port_id)
635{
636 DPRINTF(CoherentXBar, "recvAtomic: packet src %s addr 0x%x cmd %s\n",
637 slavePorts[slave_port_id]->name(), pkt->getAddr(),
638 pkt->cmdString());
639
640 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
641 unsigned int pkt_cmd = pkt->cmdToIndex();
642
643 MemCmd snoop_response_cmd = MemCmd::InvalidCmd;
644 Tick snoop_response_latency = 0;
645
646 if (!system->bypassCaches()) {
647 // forward to all snoopers but the source
648 std::pair<MemCmd, Tick> snoop_result;
649 if (snoopFilter) {
650 // check with the snoop filter where to forward this packet
651 auto sf_res =
652 snoopFilter->lookupRequest(pkt, *slavePorts[slave_port_id]);
653 snoop_response_latency += sf_res.second * clockPeriod();
654 DPRINTF(CoherentXBar, "%s: src %s %s 0x%x"\
655 " SF size: %i lat: %i\n", __func__,
656 slavePorts[slave_port_id]->name(), pkt->cmdString(),
657 pkt->getAddr(), sf_res.first.size(), sf_res.second);
658
659 // let the snoop filter know about the success of the send
660 // operation, and do it even before sending it onwards to
661 // avoid situations where atomic upward snoops sneak in
662 // between and change the filter state
270 }
271
272 // check if we were successful in sending the packet onwards
273 if (!success) {
274 // express snoops should never be forced to retry
275 assert(!is_express_snoop);
276
277 // restore the header delay
278 pkt->headerDelay = old_header_delay;
279
280 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x RETRY\n",
281 src_port->name(), pkt->cmdString(), pkt->getAddr());
282
283 // update the layer state and schedule an idle event
284 reqLayers[master_port_id]->failedTiming(src_port,
285 clockEdge(Cycles(1)));
286 } else {
287 // express snoops currently bypass the crossbar state entirely
288 if (!is_express_snoop) {
289 // if this particular request will generate a snoop
290 // response
291 if (expect_snoop_resp) {
292 // we should never have an exsiting request outstanding
293 assert(outstandingSnoop.find(pkt->req) ==
294 outstandingSnoop.end());
295 outstandingSnoop.insert(pkt->req);
296
297 // basic sanity check on the outstanding snoops
298 panic_if(outstandingSnoop.size() > 512,
299 "Outstanding snoop requests exceeded 512\n");
300 }
301
302 // remember where to route the normal response to
303 if (expect_response || expect_snoop_resp) {
304 assert(routeTo.find(pkt->req) == routeTo.end());
305 routeTo[pkt->req] = slave_port_id;
306
307 panic_if(routeTo.size() > 512,
308 "Routing table exceeds 512 packets\n");
309 }
310
311 // update the layer state and schedule an idle event
312 reqLayers[master_port_id]->succeededTiming(packetFinishTime);
313 }
314
315 // stats updates only consider packets that were successfully sent
316 pktCount[slave_port_id][master_port_id]++;
317 pktSize[slave_port_id][master_port_id] += pkt_size;
318 transDist[pkt_cmd]++;
319
320 if (is_express_snoop)
321 snoops++;
322 }
323
324 if (sink_packet)
325 // queue the packet for deletion
326 pendingDelete.reset(pkt);
327
328 if (respond_directly) {
329 assert(pkt->needsResponse());
330 assert(success);
331
332 pkt->makeResponse();
333
334 if (snoopFilter && !system->bypassCaches()) {
335 // let the snoop filter inspect the response and update its state
336 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]);
337 }
338
339 Tick response_time = clockEdge() + pkt->headerDelay;
340 pkt->headerDelay = 0;
341
342 slavePorts[slave_port_id]->schedTimingResp(pkt, response_time);
343 }
344
345 return success;
346}
347
348bool
349CoherentXBar::recvTimingResp(PacketPtr pkt, PortID master_port_id)
350{
351 // determine the source port based on the id
352 MasterPort *src_port = masterPorts[master_port_id];
353
354 // determine the destination
355 const auto route_lookup = routeTo.find(pkt->req);
356 assert(route_lookup != routeTo.end());
357 const PortID slave_port_id = route_lookup->second;
358 assert(slave_port_id != InvalidPortID);
359 assert(slave_port_id < respLayers.size());
360
361 // test if the crossbar should be considered occupied for the
362 // current port
363 if (!respLayers[slave_port_id]->tryTiming(src_port)) {
364 DPRINTF(CoherentXBar, "recvTimingResp: src %s %s 0x%x BUSY\n",
365 src_port->name(), pkt->cmdString(), pkt->getAddr());
366 return false;
367 }
368
369 DPRINTF(CoherentXBar, "recvTimingResp: src %s %s 0x%x\n",
370 src_port->name(), pkt->cmdString(), pkt->getAddr());
371
372 // store size and command as they might be modified when
373 // forwarding the packet
374 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
375 unsigned int pkt_cmd = pkt->cmdToIndex();
376
377 // a response sees the response latency
378 Tick xbar_delay = responseLatency * clockPeriod();
379
380 // set the packet header and payload delay
381 calcPacketTiming(pkt, xbar_delay);
382
383 // determine how long to be crossbar layer is busy
384 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
385
386 if (snoopFilter && !system->bypassCaches()) {
387 // let the snoop filter inspect the response and update its state
388 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]);
389 }
390
391 // send the packet through the destination slave port and pay for
392 // any outstanding header delay
393 Tick latency = pkt->headerDelay;
394 pkt->headerDelay = 0;
395 slavePorts[slave_port_id]->schedTimingResp(pkt, curTick() + latency);
396
397 // remove the request from the routing table
398 routeTo.erase(route_lookup);
399
400 respLayers[slave_port_id]->succeededTiming(packetFinishTime);
401
402 // stats updates
403 pktCount[slave_port_id][master_port_id]++;
404 pktSize[slave_port_id][master_port_id] += pkt_size;
405 transDist[pkt_cmd]++;
406
407 return true;
408}
409
410void
411CoherentXBar::recvTimingSnoopReq(PacketPtr pkt, PortID master_port_id)
412{
413 DPRINTF(CoherentXBar, "recvTimingSnoopReq: src %s %s 0x%x\n",
414 masterPorts[master_port_id]->name(), pkt->cmdString(),
415 pkt->getAddr());
416
417 // update stats here as we know the forwarding will succeed
418 transDist[pkt->cmdToIndex()]++;
419 snoops++;
420
421 // we should only see express snoops from caches
422 assert(pkt->isExpressSnoop());
423
424 // set the packet header and payload delay, for now use forward latency
425 // @todo Assess the choice of latency further
426 calcPacketTiming(pkt, forwardLatency * clockPeriod());
427
428 // remember if a cache has already committed to responding so we
429 // can see if it changes during the snooping
430 const bool cache_responding = pkt->cacheResponding();
431
432 assert(pkt->snoopDelay == 0);
433
434 if (snoopFilter) {
435 // let the Snoop Filter work its magic and guide probing
436 auto sf_res = snoopFilter->lookupSnoop(pkt);
437 // the time required by a packet to be delivered through
438 // the xbar has to be charged also with to lookup latency
439 // of the snoop filter
440 pkt->headerDelay += sf_res.second * clockPeriod();
441 DPRINTF(CoherentXBar, "recvTimingSnoopReq: src %s %s 0x%x"\
442 " SF size: %i lat: %i\n", masterPorts[master_port_id]->name(),
443 pkt->cmdString(), pkt->getAddr(), sf_res.first.size(),
444 sf_res.second);
445
446 // forward to all snoopers
447 forwardTiming(pkt, InvalidPortID, sf_res.first);
448 } else {
449 forwardTiming(pkt, InvalidPortID);
450 }
451
452 // add the snoop delay to our header delay, and then reset it
453 pkt->headerDelay += pkt->snoopDelay;
454 pkt->snoopDelay = 0;
455
456 // if we can expect a response, remember how to route it
457 if (!cache_responding && pkt->cacheResponding()) {
458 assert(routeTo.find(pkt->req) == routeTo.end());
459 routeTo[pkt->req] = master_port_id;
460 }
461
462 // a snoop request came from a connected slave device (one of
463 // our master ports), and if it is not coming from the slave
464 // device responsible for the address range something is
465 // wrong, hence there is nothing further to do as the packet
466 // would be going back to where it came from
467 assert(master_port_id == findPort(pkt->getAddr()));
468}
469
470bool
471CoherentXBar::recvTimingSnoopResp(PacketPtr pkt, PortID slave_port_id)
472{
473 // determine the source port based on the id
474 SlavePort* src_port = slavePorts[slave_port_id];
475
476 // get the destination
477 const auto route_lookup = routeTo.find(pkt->req);
478 assert(route_lookup != routeTo.end());
479 const PortID dest_port_id = route_lookup->second;
480 assert(dest_port_id != InvalidPortID);
481
482 // determine if the response is from a snoop request we
483 // created as the result of a normal request (in which case it
484 // should be in the outstandingSnoop), or if we merely forwarded
485 // someone else's snoop request
486 const bool forwardAsSnoop = outstandingSnoop.find(pkt->req) ==
487 outstandingSnoop.end();
488
489 // test if the crossbar should be considered occupied for the
490 // current port, note that the check is bypassed if the response
491 // is being passed on as a normal response since this is occupying
492 // the response layer rather than the snoop response layer
493 if (forwardAsSnoop) {
494 assert(dest_port_id < snoopLayers.size());
495 if (!snoopLayers[dest_port_id]->tryTiming(src_port)) {
496 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x BUSY\n",
497 src_port->name(), pkt->cmdString(), pkt->getAddr());
498 return false;
499 }
500 } else {
501 // get the master port that mirrors this slave port internally
502 MasterPort* snoop_port = snoopRespPorts[slave_port_id];
503 assert(dest_port_id < respLayers.size());
504 if (!respLayers[dest_port_id]->tryTiming(snoop_port)) {
505 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x BUSY\n",
506 snoop_port->name(), pkt->cmdString(), pkt->getAddr());
507 return false;
508 }
509 }
510
511 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x\n",
512 src_port->name(), pkt->cmdString(), pkt->getAddr());
513
514 // store size and command as they might be modified when
515 // forwarding the packet
516 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
517 unsigned int pkt_cmd = pkt->cmdToIndex();
518
519 // responses are never express snoops
520 assert(!pkt->isExpressSnoop());
521
522 // a snoop response sees the snoop response latency, and if it is
523 // forwarded as a normal response, the response latency
524 Tick xbar_delay =
525 (forwardAsSnoop ? snoopResponseLatency : responseLatency) *
526 clockPeriod();
527
528 // set the packet header and payload delay
529 calcPacketTiming(pkt, xbar_delay);
530
531 // determine how long to be crossbar layer is busy
532 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
533
534 // forward it either as a snoop response or a normal response
535 if (forwardAsSnoop) {
536 // this is a snoop response to a snoop request we forwarded,
537 // e.g. coming from the L1 and going to the L2, and it should
538 // be forwarded as a snoop response
539
540 if (snoopFilter) {
541 // update the probe filter so that it can properly track the line
542 snoopFilter->updateSnoopForward(pkt, *slavePorts[slave_port_id],
543 *masterPorts[dest_port_id]);
544 }
545
546 bool success M5_VAR_USED =
547 masterPorts[dest_port_id]->sendTimingSnoopResp(pkt);
548 pktCount[slave_port_id][dest_port_id]++;
549 pktSize[slave_port_id][dest_port_id] += pkt_size;
550 assert(success);
551
552 snoopLayers[dest_port_id]->succeededTiming(packetFinishTime);
553 } else {
554 // we got a snoop response on one of our slave ports,
555 // i.e. from a coherent master connected to the crossbar, and
556 // since we created the snoop request as part of recvTiming,
557 // this should now be a normal response again
558 outstandingSnoop.erase(pkt->req);
559
560 // this is a snoop response from a coherent master, hence it
561 // should never go back to where the snoop response came from,
562 // but instead to where the original request came from
563 assert(slave_port_id != dest_port_id);
564
565 if (snoopFilter) {
566 // update the probe filter so that it can properly track the line
567 snoopFilter->updateSnoopResponse(pkt, *slavePorts[slave_port_id],
568 *slavePorts[dest_port_id]);
569 }
570
571 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x"\
572 " FWD RESP\n", src_port->name(), pkt->cmdString(),
573 pkt->getAddr());
574
575 // as a normal response, it should go back to a master through
576 // one of our slave ports, we also pay for any outstanding
577 // header latency
578 Tick latency = pkt->headerDelay;
579 pkt->headerDelay = 0;
580 slavePorts[dest_port_id]->schedTimingResp(pkt, curTick() + latency);
581
582 respLayers[dest_port_id]->succeededTiming(packetFinishTime);
583 }
584
585 // remove the request from the routing table
586 routeTo.erase(route_lookup);
587
588 // stats updates
589 transDist[pkt_cmd]++;
590 snoops++;
591
592 return true;
593}
594
595
596void
597CoherentXBar::forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id,
598 const std::vector<QueuedSlavePort*>& dests)
599{
600 DPRINTF(CoherentXBar, "%s for %s address %x size %d\n", __func__,
601 pkt->cmdString(), pkt->getAddr(), pkt->getSize());
602
603 // snoops should only happen if the system isn't bypassing caches
604 assert(!system->bypassCaches());
605
606 unsigned fanout = 0;
607
608 for (const auto& p: dests) {
609 // we could have gotten this request from a snooping master
610 // (corresponding to our own slave port that is also in
611 // snoopPorts) and should not send it back to where it came
612 // from
613 if (exclude_slave_port_id == InvalidPortID ||
614 p->getId() != exclude_slave_port_id) {
615 // cache is not allowed to refuse snoop
616 p->sendTimingSnoopReq(pkt);
617 fanout++;
618 }
619 }
620
621 // Stats for fanout of this forward operation
622 snoopFanout.sample(fanout);
623}
624
625void
626CoherentXBar::recvReqRetry(PortID master_port_id)
627{
628 // responses and snoop responses never block on forwarding them,
629 // so the retry will always be coming from a port to which we
630 // tried to forward a request
631 reqLayers[master_port_id]->recvRetry();
632}
633
634Tick
635CoherentXBar::recvAtomic(PacketPtr pkt, PortID slave_port_id)
636{
637 DPRINTF(CoherentXBar, "recvAtomic: packet src %s addr 0x%x cmd %s\n",
638 slavePorts[slave_port_id]->name(), pkt->getAddr(),
639 pkt->cmdString());
640
641 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
642 unsigned int pkt_cmd = pkt->cmdToIndex();
643
644 MemCmd snoop_response_cmd = MemCmd::InvalidCmd;
645 Tick snoop_response_latency = 0;
646
647 if (!system->bypassCaches()) {
648 // forward to all snoopers but the source
649 std::pair<MemCmd, Tick> snoop_result;
650 if (snoopFilter) {
651 // check with the snoop filter where to forward this packet
652 auto sf_res =
653 snoopFilter->lookupRequest(pkt, *slavePorts[slave_port_id]);
654 snoop_response_latency += sf_res.second * clockPeriod();
655 DPRINTF(CoherentXBar, "%s: src %s %s 0x%x"\
656 " SF size: %i lat: %i\n", __func__,
657 slavePorts[slave_port_id]->name(), pkt->cmdString(),
658 pkt->getAddr(), sf_res.first.size(), sf_res.second);
659
660 // let the snoop filter know about the success of the send
661 // operation, and do it even before sending it onwards to
662 // avoid situations where atomic upward snoops sneak in
663 // between and change the filter state
663 snoopFilter->finishRequest(false, pkt);
664 snoopFilter->finishRequest(false, pkt->getAddr());
664
665 snoop_result = forwardAtomic(pkt, slave_port_id, InvalidPortID,
666 sf_res.first);
667 } else {
668 snoop_result = forwardAtomic(pkt, slave_port_id);
669 }
670 snoop_response_cmd = snoop_result.first;
671 snoop_response_latency += snoop_result.second;
672 }
673
674 // set up a sensible default value
675 Tick response_latency = 0;
676
677 const bool sink_packet = sinkPacket(pkt);
678
679 // even if we had a snoop response, we must continue and also
680 // perform the actual request at the destination
681 PortID master_port_id = findPort(pkt->getAddr());
682
683 if (sink_packet) {
684 DPRINTF(CoherentXBar, "Not forwarding %s to %#llx\n",
685 pkt->cmdString(), pkt->getAddr());
686 } else {
687 if (!pointOfCoherency || pkt->isRead() || pkt->isWrite()) {
688 // forward the request to the appropriate destination
689 response_latency = masterPorts[master_port_id]->sendAtomic(pkt);
690 } else {
691 // if it does not need a response we sink the packet above
692 assert(pkt->needsResponse());
693
694 pkt->makeResponse();
695 }
696 }
697
698 // stats updates for the request
699 pktCount[slave_port_id][master_port_id]++;
700 pktSize[slave_port_id][master_port_id] += pkt_size;
701 transDist[pkt_cmd]++;
702
703
704 // if lower levels have replied, tell the snoop filter
705 if (!system->bypassCaches() && snoopFilter && pkt->isResponse()) {
706 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]);
707 }
708
709 // if we got a response from a snooper, restore it here
710 if (snoop_response_cmd != MemCmd::InvalidCmd) {
711 // no one else should have responded
712 assert(!pkt->isResponse());
713 pkt->cmd = snoop_response_cmd;
714 response_latency = snoop_response_latency;
715 }
716
717 // add the response data
718 if (pkt->isResponse()) {
719 pkt_size = pkt->hasData() ? pkt->getSize() : 0;
720 pkt_cmd = pkt->cmdToIndex();
721
722 // stats updates
723 pktCount[slave_port_id][master_port_id]++;
724 pktSize[slave_port_id][master_port_id] += pkt_size;
725 transDist[pkt_cmd]++;
726 }
727
728 // @todo: Not setting header time
729 pkt->payloadDelay = response_latency;
730 return response_latency;
731}
732
733Tick
734CoherentXBar::recvAtomicSnoop(PacketPtr pkt, PortID master_port_id)
735{
736 DPRINTF(CoherentXBar, "recvAtomicSnoop: packet src %s addr 0x%x cmd %s\n",
737 masterPorts[master_port_id]->name(), pkt->getAddr(),
738 pkt->cmdString());
739
740 // add the request snoop data
741 snoops++;
742
743 // forward to all snoopers
744 std::pair<MemCmd, Tick> snoop_result;
745 Tick snoop_response_latency = 0;
746 if (snoopFilter) {
747 auto sf_res = snoopFilter->lookupSnoop(pkt);
748 snoop_response_latency += sf_res.second * clockPeriod();
749 DPRINTF(CoherentXBar, "%s: src %s %s 0x%x SF size: %i lat: %i\n",
750 __func__, masterPorts[master_port_id]->name(), pkt->cmdString(),
751 pkt->getAddr(), sf_res.first.size(), sf_res.second);
752 snoop_result = forwardAtomic(pkt, InvalidPortID, master_port_id,
753 sf_res.first);
754 } else {
755 snoop_result = forwardAtomic(pkt, InvalidPortID);
756 }
757 MemCmd snoop_response_cmd = snoop_result.first;
758 snoop_response_latency += snoop_result.second;
759
760 if (snoop_response_cmd != MemCmd::InvalidCmd)
761 pkt->cmd = snoop_response_cmd;
762
763 // add the response snoop data
764 if (pkt->isResponse()) {
765 snoops++;
766 }
767
768 // @todo: Not setting header time
769 pkt->payloadDelay = snoop_response_latency;
770 return snoop_response_latency;
771}
772
773std::pair<MemCmd, Tick>
774CoherentXBar::forwardAtomic(PacketPtr pkt, PortID exclude_slave_port_id,
775 PortID source_master_port_id,
776 const std::vector<QueuedSlavePort*>& dests)
777{
778 // the packet may be changed on snoops, record the original
779 // command to enable us to restore it between snoops so that
780 // additional snoops can take place properly
781 MemCmd orig_cmd = pkt->cmd;
782 MemCmd snoop_response_cmd = MemCmd::InvalidCmd;
783 Tick snoop_response_latency = 0;
784
785 // snoops should only happen if the system isn't bypassing caches
786 assert(!system->bypassCaches());
787
788 unsigned fanout = 0;
789
790 for (const auto& p: dests) {
791 // we could have gotten this request from a snooping master
792 // (corresponding to our own slave port that is also in
793 // snoopPorts) and should not send it back to where it came
794 // from
795 if (exclude_slave_port_id != InvalidPortID &&
796 p->getId() == exclude_slave_port_id)
797 continue;
798
799 Tick latency = p->sendAtomicSnoop(pkt);
800 fanout++;
801
802 // in contrast to a functional access, we have to keep on
803 // going as all snoopers must be updated even if we get a
804 // response
805 if (!pkt->isResponse())
806 continue;
807
808 // response from snoop agent
809 assert(pkt->cmd != orig_cmd);
810 assert(pkt->cacheResponding());
811 // should only happen once
812 assert(snoop_response_cmd == MemCmd::InvalidCmd);
813 // save response state
814 snoop_response_cmd = pkt->cmd;
815 snoop_response_latency = latency;
816
817 if (snoopFilter) {
818 // Handle responses by the snoopers and differentiate between
819 // responses to requests from above and snoops from below
820 if (source_master_port_id != InvalidPortID) {
821 // Getting a response for a snoop from below
822 assert(exclude_slave_port_id == InvalidPortID);
823 snoopFilter->updateSnoopForward(pkt, *p,
824 *masterPorts[source_master_port_id]);
825 } else {
826 // Getting a response for a request from above
827 assert(source_master_port_id == InvalidPortID);
828 snoopFilter->updateSnoopResponse(pkt, *p,
829 *slavePorts[exclude_slave_port_id]);
830 }
831 }
832 // restore original packet state for remaining snoopers
833 pkt->cmd = orig_cmd;
834 }
835
836 // Stats for fanout
837 snoopFanout.sample(fanout);
838
839 // the packet is restored as part of the loop and any potential
840 // snoop response is part of the returned pair
841 return std::make_pair(snoop_response_cmd, snoop_response_latency);
842}
843
844void
845CoherentXBar::recvFunctional(PacketPtr pkt, PortID slave_port_id)
846{
847 if (!pkt->isPrint()) {
848 // don't do DPRINTFs on PrintReq as it clutters up the output
849 DPRINTF(CoherentXBar,
850 "recvFunctional: packet src %s addr 0x%x cmd %s\n",
851 slavePorts[slave_port_id]->name(), pkt->getAddr(),
852 pkt->cmdString());
853 }
854
855 if (!system->bypassCaches()) {
856 // forward to all snoopers but the source
857 forwardFunctional(pkt, slave_port_id);
858 }
859
860 // there is no need to continue if the snooping has found what we
861 // were looking for and the packet is already a response
862 if (!pkt->isResponse()) {
863 // since our slave ports are queued ports we need to check them as well
864 for (const auto& p : slavePorts) {
865 // if we find a response that has the data, then the
866 // downstream caches/memories may be out of date, so simply stop
867 // here
868 if (p->checkFunctional(pkt)) {
869 if (pkt->needsResponse())
870 pkt->makeResponse();
871 return;
872 }
873 }
874
875 PortID dest_id = findPort(pkt->getAddr());
876
877 masterPorts[dest_id]->sendFunctional(pkt);
878 }
879}
880
881void
882CoherentXBar::recvFunctionalSnoop(PacketPtr pkt, PortID master_port_id)
883{
884 if (!pkt->isPrint()) {
885 // don't do DPRINTFs on PrintReq as it clutters up the output
886 DPRINTF(CoherentXBar,
887 "recvFunctionalSnoop: packet src %s addr 0x%x cmd %s\n",
888 masterPorts[master_port_id]->name(), pkt->getAddr(),
889 pkt->cmdString());
890 }
891
892 for (const auto& p : slavePorts) {
893 if (p->checkFunctional(pkt)) {
894 if (pkt->needsResponse())
895 pkt->makeResponse();
896 return;
897 }
898 }
899
900 // forward to all snoopers
901 forwardFunctional(pkt, InvalidPortID);
902}
903
904void
905CoherentXBar::forwardFunctional(PacketPtr pkt, PortID exclude_slave_port_id)
906{
907 // snoops should only happen if the system isn't bypassing caches
908 assert(!system->bypassCaches());
909
910 for (const auto& p: snoopPorts) {
911 // we could have gotten this request from a snooping master
912 // (corresponding to our own slave port that is also in
913 // snoopPorts) and should not send it back to where it came
914 // from
915 if (exclude_slave_port_id == InvalidPortID ||
916 p->getId() != exclude_slave_port_id)
917 p->sendFunctionalSnoop(pkt);
918
919 // if we get a response we are done
920 if (pkt->isResponse()) {
921 break;
922 }
923 }
924}
925
926bool
927CoherentXBar::sinkPacket(const PacketPtr pkt) const
928{
929 // we can sink the packet if:
930 // 1) the crossbar is the point of coherency, and a cache is
931 // responding after being snooped
932 // 2) the crossbar is the point of coherency, and the packet is a
933 // coherency packet (not a read or a write) that does not
934 // require a response
935 // 3) this is a clean evict or clean writeback, but the packet is
936 // found in a cache above this crossbar
937 // 4) a cache is responding after being snooped, and the packet
938 // either does not need the block to be writable, or the cache
939 // that has promised to respond (setting the cache responding
940 // flag) is providing writable and thus had a Modified block,
941 // and no further action is needed
942 return (pointOfCoherency && pkt->cacheResponding()) ||
943 (pointOfCoherency && !(pkt->isRead() || pkt->isWrite()) &&
944 !pkt->needsResponse()) ||
945 (pkt->isCleanEviction() && pkt->isBlockCached()) ||
946 (pkt->cacheResponding() &&
947 (!pkt->needsWritable() || pkt->responderHadWritable()));
948}
949
950void
951CoherentXBar::regStats()
952{
953 // register the stats of the base class and our layers
954 BaseXBar::regStats();
955 for (auto l: reqLayers)
956 l->regStats();
957 for (auto l: respLayers)
958 l->regStats();
959 for (auto l: snoopLayers)
960 l->regStats();
961
962 snoops
963 .name(name() + ".snoops")
964 .desc("Total snoops (count)")
965 ;
966
967 snoopFanout
968 .init(0, snoopPorts.size(), 1)
969 .name(name() + ".snoop_fanout")
970 .desc("Request fanout histogram")
971 ;
972}
973
974CoherentXBar *
975CoherentXBarParams::create()
976{
977 return new CoherentXBar(this);
978}
665
666 snoop_result = forwardAtomic(pkt, slave_port_id, InvalidPortID,
667 sf_res.first);
668 } else {
669 snoop_result = forwardAtomic(pkt, slave_port_id);
670 }
671 snoop_response_cmd = snoop_result.first;
672 snoop_response_latency += snoop_result.second;
673 }
674
675 // set up a sensible default value
676 Tick response_latency = 0;
677
678 const bool sink_packet = sinkPacket(pkt);
679
680 // even if we had a snoop response, we must continue and also
681 // perform the actual request at the destination
682 PortID master_port_id = findPort(pkt->getAddr());
683
684 if (sink_packet) {
685 DPRINTF(CoherentXBar, "Not forwarding %s to %#llx\n",
686 pkt->cmdString(), pkt->getAddr());
687 } else {
688 if (!pointOfCoherency || pkt->isRead() || pkt->isWrite()) {
689 // forward the request to the appropriate destination
690 response_latency = masterPorts[master_port_id]->sendAtomic(pkt);
691 } else {
692 // if it does not need a response we sink the packet above
693 assert(pkt->needsResponse());
694
695 pkt->makeResponse();
696 }
697 }
698
699 // stats updates for the request
700 pktCount[slave_port_id][master_port_id]++;
701 pktSize[slave_port_id][master_port_id] += pkt_size;
702 transDist[pkt_cmd]++;
703
704
705 // if lower levels have replied, tell the snoop filter
706 if (!system->bypassCaches() && snoopFilter && pkt->isResponse()) {
707 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]);
708 }
709
710 // if we got a response from a snooper, restore it here
711 if (snoop_response_cmd != MemCmd::InvalidCmd) {
712 // no one else should have responded
713 assert(!pkt->isResponse());
714 pkt->cmd = snoop_response_cmd;
715 response_latency = snoop_response_latency;
716 }
717
718 // add the response data
719 if (pkt->isResponse()) {
720 pkt_size = pkt->hasData() ? pkt->getSize() : 0;
721 pkt_cmd = pkt->cmdToIndex();
722
723 // stats updates
724 pktCount[slave_port_id][master_port_id]++;
725 pktSize[slave_port_id][master_port_id] += pkt_size;
726 transDist[pkt_cmd]++;
727 }
728
729 // @todo: Not setting header time
730 pkt->payloadDelay = response_latency;
731 return response_latency;
732}
733
734Tick
735CoherentXBar::recvAtomicSnoop(PacketPtr pkt, PortID master_port_id)
736{
737 DPRINTF(CoherentXBar, "recvAtomicSnoop: packet src %s addr 0x%x cmd %s\n",
738 masterPorts[master_port_id]->name(), pkt->getAddr(),
739 pkt->cmdString());
740
741 // add the request snoop data
742 snoops++;
743
744 // forward to all snoopers
745 std::pair<MemCmd, Tick> snoop_result;
746 Tick snoop_response_latency = 0;
747 if (snoopFilter) {
748 auto sf_res = snoopFilter->lookupSnoop(pkt);
749 snoop_response_latency += sf_res.second * clockPeriod();
750 DPRINTF(CoherentXBar, "%s: src %s %s 0x%x SF size: %i lat: %i\n",
751 __func__, masterPorts[master_port_id]->name(), pkt->cmdString(),
752 pkt->getAddr(), sf_res.first.size(), sf_res.second);
753 snoop_result = forwardAtomic(pkt, InvalidPortID, master_port_id,
754 sf_res.first);
755 } else {
756 snoop_result = forwardAtomic(pkt, InvalidPortID);
757 }
758 MemCmd snoop_response_cmd = snoop_result.first;
759 snoop_response_latency += snoop_result.second;
760
761 if (snoop_response_cmd != MemCmd::InvalidCmd)
762 pkt->cmd = snoop_response_cmd;
763
764 // add the response snoop data
765 if (pkt->isResponse()) {
766 snoops++;
767 }
768
769 // @todo: Not setting header time
770 pkt->payloadDelay = snoop_response_latency;
771 return snoop_response_latency;
772}
773
774std::pair<MemCmd, Tick>
775CoherentXBar::forwardAtomic(PacketPtr pkt, PortID exclude_slave_port_id,
776 PortID source_master_port_id,
777 const std::vector<QueuedSlavePort*>& dests)
778{
779 // the packet may be changed on snoops, record the original
780 // command to enable us to restore it between snoops so that
781 // additional snoops can take place properly
782 MemCmd orig_cmd = pkt->cmd;
783 MemCmd snoop_response_cmd = MemCmd::InvalidCmd;
784 Tick snoop_response_latency = 0;
785
786 // snoops should only happen if the system isn't bypassing caches
787 assert(!system->bypassCaches());
788
789 unsigned fanout = 0;
790
791 for (const auto& p: dests) {
792 // we could have gotten this request from a snooping master
793 // (corresponding to our own slave port that is also in
794 // snoopPorts) and should not send it back to where it came
795 // from
796 if (exclude_slave_port_id != InvalidPortID &&
797 p->getId() == exclude_slave_port_id)
798 continue;
799
800 Tick latency = p->sendAtomicSnoop(pkt);
801 fanout++;
802
803 // in contrast to a functional access, we have to keep on
804 // going as all snoopers must be updated even if we get a
805 // response
806 if (!pkt->isResponse())
807 continue;
808
809 // response from snoop agent
810 assert(pkt->cmd != orig_cmd);
811 assert(pkt->cacheResponding());
812 // should only happen once
813 assert(snoop_response_cmd == MemCmd::InvalidCmd);
814 // save response state
815 snoop_response_cmd = pkt->cmd;
816 snoop_response_latency = latency;
817
818 if (snoopFilter) {
819 // Handle responses by the snoopers and differentiate between
820 // responses to requests from above and snoops from below
821 if (source_master_port_id != InvalidPortID) {
822 // Getting a response for a snoop from below
823 assert(exclude_slave_port_id == InvalidPortID);
824 snoopFilter->updateSnoopForward(pkt, *p,
825 *masterPorts[source_master_port_id]);
826 } else {
827 // Getting a response for a request from above
828 assert(source_master_port_id == InvalidPortID);
829 snoopFilter->updateSnoopResponse(pkt, *p,
830 *slavePorts[exclude_slave_port_id]);
831 }
832 }
833 // restore original packet state for remaining snoopers
834 pkt->cmd = orig_cmd;
835 }
836
837 // Stats for fanout
838 snoopFanout.sample(fanout);
839
840 // the packet is restored as part of the loop and any potential
841 // snoop response is part of the returned pair
842 return std::make_pair(snoop_response_cmd, snoop_response_latency);
843}
844
845void
846CoherentXBar::recvFunctional(PacketPtr pkt, PortID slave_port_id)
847{
848 if (!pkt->isPrint()) {
849 // don't do DPRINTFs on PrintReq as it clutters up the output
850 DPRINTF(CoherentXBar,
851 "recvFunctional: packet src %s addr 0x%x cmd %s\n",
852 slavePorts[slave_port_id]->name(), pkt->getAddr(),
853 pkt->cmdString());
854 }
855
856 if (!system->bypassCaches()) {
857 // forward to all snoopers but the source
858 forwardFunctional(pkt, slave_port_id);
859 }
860
861 // there is no need to continue if the snooping has found what we
862 // were looking for and the packet is already a response
863 if (!pkt->isResponse()) {
864 // since our slave ports are queued ports we need to check them as well
865 for (const auto& p : slavePorts) {
866 // if we find a response that has the data, then the
867 // downstream caches/memories may be out of date, so simply stop
868 // here
869 if (p->checkFunctional(pkt)) {
870 if (pkt->needsResponse())
871 pkt->makeResponse();
872 return;
873 }
874 }
875
876 PortID dest_id = findPort(pkt->getAddr());
877
878 masterPorts[dest_id]->sendFunctional(pkt);
879 }
880}
881
882void
883CoherentXBar::recvFunctionalSnoop(PacketPtr pkt, PortID master_port_id)
884{
885 if (!pkt->isPrint()) {
886 // don't do DPRINTFs on PrintReq as it clutters up the output
887 DPRINTF(CoherentXBar,
888 "recvFunctionalSnoop: packet src %s addr 0x%x cmd %s\n",
889 masterPorts[master_port_id]->name(), pkt->getAddr(),
890 pkt->cmdString());
891 }
892
893 for (const auto& p : slavePorts) {
894 if (p->checkFunctional(pkt)) {
895 if (pkt->needsResponse())
896 pkt->makeResponse();
897 return;
898 }
899 }
900
901 // forward to all snoopers
902 forwardFunctional(pkt, InvalidPortID);
903}
904
905void
906CoherentXBar::forwardFunctional(PacketPtr pkt, PortID exclude_slave_port_id)
907{
908 // snoops should only happen if the system isn't bypassing caches
909 assert(!system->bypassCaches());
910
911 for (const auto& p: snoopPorts) {
912 // we could have gotten this request from a snooping master
913 // (corresponding to our own slave port that is also in
914 // snoopPorts) and should not send it back to where it came
915 // from
916 if (exclude_slave_port_id == InvalidPortID ||
917 p->getId() != exclude_slave_port_id)
918 p->sendFunctionalSnoop(pkt);
919
920 // if we get a response we are done
921 if (pkt->isResponse()) {
922 break;
923 }
924 }
925}
926
927bool
928CoherentXBar::sinkPacket(const PacketPtr pkt) const
929{
930 // we can sink the packet if:
931 // 1) the crossbar is the point of coherency, and a cache is
932 // responding after being snooped
933 // 2) the crossbar is the point of coherency, and the packet is a
934 // coherency packet (not a read or a write) that does not
935 // require a response
936 // 3) this is a clean evict or clean writeback, but the packet is
937 // found in a cache above this crossbar
938 // 4) a cache is responding after being snooped, and the packet
939 // either does not need the block to be writable, or the cache
940 // that has promised to respond (setting the cache responding
941 // flag) is providing writable and thus had a Modified block,
942 // and no further action is needed
943 return (pointOfCoherency && pkt->cacheResponding()) ||
944 (pointOfCoherency && !(pkt->isRead() || pkt->isWrite()) &&
945 !pkt->needsResponse()) ||
946 (pkt->isCleanEviction() && pkt->isBlockCached()) ||
947 (pkt->cacheResponding() &&
948 (!pkt->needsWritable() || pkt->responderHadWritable()));
949}
950
951void
952CoherentXBar::regStats()
953{
954 // register the stats of the base class and our layers
955 BaseXBar::regStats();
956 for (auto l: reqLayers)
957 l->regStats();
958 for (auto l: respLayers)
959 l->regStats();
960 for (auto l: snoopLayers)
961 l->regStats();
962
963 snoops
964 .name(name() + ".snoops")
965 .desc("Total snoops (count)")
966 ;
967
968 snoopFanout
969 .init(0, snoopPorts.size(), 1)
970 .name(name() + ".snoop_fanout")
971 .desc("Request fanout histogram")
972 ;
973}
974
975CoherentXBar *
976CoherentXBarParams::create()
977{
978 return new CoherentXBar(this);
979}