coherent_xbar.hh (13808:0a44fbc3a853) coherent_xbar.hh (13847:c9b92a513019)
1/*
2 * Copyright (c) 2011-2015, 2017 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) 2002-2005 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: Ron Dreslinski
41 * Ali Saidi
42 * Andreas Hansson
43 * William Wang
44 */
45
46/**
47 * @file
48 * Declaration of a coherent crossbar.
49 */
50
51#ifndef __MEM_COHERENT_XBAR_HH__
52#define __MEM_COHERENT_XBAR_HH__
53
54#include <unordered_map>
55#include <unordered_set>
56
57#include "mem/snoop_filter.hh"
58#include "mem/xbar.hh"
59#include "params/CoherentXBar.hh"
60
61/**
62 * A coherent crossbar connects a number of (potentially) snooping
63 * masters and slaves, and routes the request and response packets
64 * based on the address, and also forwards all requests to the
65 * snoopers and deals with the snoop responses.
66 *
67 * The coherent crossbar can be used as a template for modelling QPI,
68 * HyperTransport, ACE and coherent OCP buses, and is typically used
69 * for the L1-to-L2 buses and as the main system interconnect. @sa
70 * \ref gem5MemorySystem "gem5 Memory System"
71 */
72class CoherentXBar : public BaseXBar
73{
74
75 protected:
76
77 /**
78 * Declare the layers of this crossbar, one vector for requests,
79 * one for responses, and one for snoop responses
80 */
81 std::vector<ReqLayer*> reqLayers;
82 std::vector<RespLayer*> respLayers;
83 std::vector<SnoopRespLayer*> snoopLayers;
84
85 /**
86 * Declaration of the coherent crossbar slave port type, one will
87 * be instantiated for each of the master ports connecting to the
88 * crossbar.
89 */
90 class CoherentXBarSlavePort : public QueuedSlavePort
91 {
92
93 private:
94
95 /** A reference to the crossbar to which this port belongs. */
96 CoherentXBar &xbar;
97
98 /** A normal packet queue used to store responses. */
99 RespPacketQueue queue;
100
101 public:
102
103 CoherentXBarSlavePort(const std::string &_name,
104 CoherentXBar &_xbar, PortID _id)
105 : QueuedSlavePort(_name, &_xbar, queue, _id), xbar(_xbar),
106 queue(_xbar, *this)
107 { }
108
109 protected:
110
111 bool
112 recvTimingReq(PacketPtr pkt) override
113 {
114 return xbar.recvTimingReq(pkt, id);
115 }
116
117 bool
118 recvTimingSnoopResp(PacketPtr pkt) override
119 {
120 return xbar.recvTimingSnoopResp(pkt, id);
121 }
122
123 Tick
124 recvAtomic(PacketPtr pkt) override
125 {
1/*
2 * Copyright (c) 2011-2015, 2017 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) 2002-2005 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: Ron Dreslinski
41 * Ali Saidi
42 * Andreas Hansson
43 * William Wang
44 */
45
46/**
47 * @file
48 * Declaration of a coherent crossbar.
49 */
50
51#ifndef __MEM_COHERENT_XBAR_HH__
52#define __MEM_COHERENT_XBAR_HH__
53
54#include <unordered_map>
55#include <unordered_set>
56
57#include "mem/snoop_filter.hh"
58#include "mem/xbar.hh"
59#include "params/CoherentXBar.hh"
60
61/**
62 * A coherent crossbar connects a number of (potentially) snooping
63 * masters and slaves, and routes the request and response packets
64 * based on the address, and also forwards all requests to the
65 * snoopers and deals with the snoop responses.
66 *
67 * The coherent crossbar can be used as a template for modelling QPI,
68 * HyperTransport, ACE and coherent OCP buses, and is typically used
69 * for the L1-to-L2 buses and as the main system interconnect. @sa
70 * \ref gem5MemorySystem "gem5 Memory System"
71 */
72class CoherentXBar : public BaseXBar
73{
74
75 protected:
76
77 /**
78 * Declare the layers of this crossbar, one vector for requests,
79 * one for responses, and one for snoop responses
80 */
81 std::vector<ReqLayer*> reqLayers;
82 std::vector<RespLayer*> respLayers;
83 std::vector<SnoopRespLayer*> snoopLayers;
84
85 /**
86 * Declaration of the coherent crossbar slave port type, one will
87 * be instantiated for each of the master ports connecting to the
88 * crossbar.
89 */
90 class CoherentXBarSlavePort : public QueuedSlavePort
91 {
92
93 private:
94
95 /** A reference to the crossbar to which this port belongs. */
96 CoherentXBar &xbar;
97
98 /** A normal packet queue used to store responses. */
99 RespPacketQueue queue;
100
101 public:
102
103 CoherentXBarSlavePort(const std::string &_name,
104 CoherentXBar &_xbar, PortID _id)
105 : QueuedSlavePort(_name, &_xbar, queue, _id), xbar(_xbar),
106 queue(_xbar, *this)
107 { }
108
109 protected:
110
111 bool
112 recvTimingReq(PacketPtr pkt) override
113 {
114 return xbar.recvTimingReq(pkt, id);
115 }
116
117 bool
118 recvTimingSnoopResp(PacketPtr pkt) override
119 {
120 return xbar.recvTimingSnoopResp(pkt, id);
121 }
122
123 Tick
124 recvAtomic(PacketPtr pkt) override
125 {
126 return xbar.recvAtomic(pkt, id);
126 return xbar.recvAtomicBackdoor(pkt, id);
127 }
128
127 }
128
129 Tick
130 recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
131 {
132 return xbar.recvAtomicBackdoor(pkt, id, &backdoor);
133 }
134
129 void
130 recvFunctional(PacketPtr pkt) override
131 {
132 xbar.recvFunctional(pkt, id);
133 }
134
135 AddrRangeList
136 getAddrRanges() const override
137 {
138 return xbar.getAddrRanges();
139 }
140
141 };
142
143 /**
144 * Declaration of the coherent crossbar master port type, one will be
145 * instantiated for each of the slave interfaces connecting to the
146 * crossbar.
147 */
148 class CoherentXBarMasterPort : public MasterPort
149 {
150 private:
151 /** A reference to the crossbar to which this port belongs. */
152 CoherentXBar &xbar;
153
154 public:
155
156 CoherentXBarMasterPort(const std::string &_name,
157 CoherentXBar &_xbar, PortID _id)
158 : MasterPort(_name, &_xbar, _id), xbar(_xbar)
159 { }
160
161 protected:
162
163 /**
164 * Determine if this port should be considered a snooper. For
165 * a coherent crossbar master port this is always true.
166 *
167 * @return a boolean that is true if this port is snooping
168 */
169 bool isSnooping() const override { return true; }
170
171 bool
172 recvTimingResp(PacketPtr pkt) override
173 {
174 return xbar.recvTimingResp(pkt, id);
175 }
176
177 void
178 recvTimingSnoopReq(PacketPtr pkt) override
179 {
180 return xbar.recvTimingSnoopReq(pkt, id);
181 }
182
183 Tick
184 recvAtomicSnoop(PacketPtr pkt) override
185 {
186 return xbar.recvAtomicSnoop(pkt, id);
187 }
188
189 void
190 recvFunctionalSnoop(PacketPtr pkt) override
191 {
192 xbar.recvFunctionalSnoop(pkt, id);
193 }
194
195 void recvRangeChange() override { xbar.recvRangeChange(id); }
196 void recvReqRetry() override { xbar.recvReqRetry(id); }
197
198 };
199
200 /**
201 * Internal class to bridge between an incoming snoop response
202 * from a slave port and forwarding it through an outgoing slave
203 * port. It is effectively a dangling master port.
204 */
205 class SnoopRespPort : public MasterPort
206 {
207
208 private:
209
210 /** The port which we mirror internally. */
211 QueuedSlavePort& slavePort;
212
213 public:
214
215 /**
216 * Create a snoop response port that mirrors a given slave port.
217 */
218 SnoopRespPort(QueuedSlavePort& slave_port, CoherentXBar& _xbar) :
219 MasterPort(slave_port.name() + ".snoopRespPort", &_xbar),
220 slavePort(slave_port) { }
221
222 /**
223 * Override the sending of retries and pass them on through
224 * the mirrored slave port.
225 */
226 void
227 sendRetryResp() override
228 {
229 // forward it as a snoop response retry
230 slavePort.sendRetrySnoopResp();
231 }
232
233 void
234 recvReqRetry() override
235 {
236 panic("SnoopRespPort should never see retry");
237 }
238
239 bool
240 recvTimingResp(PacketPtr pkt) override
241 {
242 panic("SnoopRespPort should never see timing response");
243 }
244
245 };
246
247 std::vector<SnoopRespPort*> snoopRespPorts;
248
249 std::vector<QueuedSlavePort*> snoopPorts;
250
251 /**
252 * Store the outstanding requests that we are expecting snoop
253 * responses from so we can determine which snoop responses we
254 * generated and which ones were merely forwarded.
255 */
256 std::unordered_set<RequestPtr> outstandingSnoop;
257
258 /**
259 * Store the outstanding cache maintenance that we are expecting
260 * snoop responses from so we can determine when we received all
261 * snoop responses and if any of the agents satisfied the request.
262 */
263 std::unordered_map<PacketId, PacketPtr> outstandingCMO;
264
265 /**
266 * Keep a pointer to the system to be allow to querying memory system
267 * properties.
268 */
269 System *system;
270
271 /** A snoop filter that tracks cache line residency and can restrict the
272 * broadcast needed for probes. NULL denotes an absent filter. */
273 SnoopFilter *snoopFilter;
274
275 const Cycles snoopResponseLatency;
276 const bool pointOfCoherency;
277 const bool pointOfUnification;
278
279 /**
280 * Upstream caches need this packet until true is returned, so
281 * hold it for deletion until a subsequent call
282 */
283 std::unique_ptr<Packet> pendingDelete;
284
285 bool recvTimingReq(PacketPtr pkt, PortID slave_port_id);
286 bool recvTimingResp(PacketPtr pkt, PortID master_port_id);
287 void recvTimingSnoopReq(PacketPtr pkt, PortID master_port_id);
288 bool recvTimingSnoopResp(PacketPtr pkt, PortID slave_port_id);
289 void recvReqRetry(PortID master_port_id);
290
291 /**
292 * Forward a timing packet to our snoopers, potentially excluding
293 * one of the connected coherent masters to avoid sending a packet
294 * back to where it came from.
295 *
296 * @param pkt Packet to forward
297 * @param exclude_slave_port_id Id of slave port to exclude
298 */
299 void
300 forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id)
301 {
302 forwardTiming(pkt, exclude_slave_port_id, snoopPorts);
303 }
304
305 /**
306 * Forward a timing packet to a selected list of snoopers, potentially
307 * excluding one of the connected coherent masters to avoid sending a packet
308 * back to where it came from.
309 *
310 * @param pkt Packet to forward
311 * @param exclude_slave_port_id Id of slave port to exclude
312 * @param dests Vector of destination ports for the forwarded pkt
313 */
314 void forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id,
315 const std::vector<QueuedSlavePort*>& dests);
316
135 void
136 recvFunctional(PacketPtr pkt) override
137 {
138 xbar.recvFunctional(pkt, id);
139 }
140
141 AddrRangeList
142 getAddrRanges() const override
143 {
144 return xbar.getAddrRanges();
145 }
146
147 };
148
149 /**
150 * Declaration of the coherent crossbar master port type, one will be
151 * instantiated for each of the slave interfaces connecting to the
152 * crossbar.
153 */
154 class CoherentXBarMasterPort : public MasterPort
155 {
156 private:
157 /** A reference to the crossbar to which this port belongs. */
158 CoherentXBar &xbar;
159
160 public:
161
162 CoherentXBarMasterPort(const std::string &_name,
163 CoherentXBar &_xbar, PortID _id)
164 : MasterPort(_name, &_xbar, _id), xbar(_xbar)
165 { }
166
167 protected:
168
169 /**
170 * Determine if this port should be considered a snooper. For
171 * a coherent crossbar master port this is always true.
172 *
173 * @return a boolean that is true if this port is snooping
174 */
175 bool isSnooping() const override { return true; }
176
177 bool
178 recvTimingResp(PacketPtr pkt) override
179 {
180 return xbar.recvTimingResp(pkt, id);
181 }
182
183 void
184 recvTimingSnoopReq(PacketPtr pkt) override
185 {
186 return xbar.recvTimingSnoopReq(pkt, id);
187 }
188
189 Tick
190 recvAtomicSnoop(PacketPtr pkt) override
191 {
192 return xbar.recvAtomicSnoop(pkt, id);
193 }
194
195 void
196 recvFunctionalSnoop(PacketPtr pkt) override
197 {
198 xbar.recvFunctionalSnoop(pkt, id);
199 }
200
201 void recvRangeChange() override { xbar.recvRangeChange(id); }
202 void recvReqRetry() override { xbar.recvReqRetry(id); }
203
204 };
205
206 /**
207 * Internal class to bridge between an incoming snoop response
208 * from a slave port and forwarding it through an outgoing slave
209 * port. It is effectively a dangling master port.
210 */
211 class SnoopRespPort : public MasterPort
212 {
213
214 private:
215
216 /** The port which we mirror internally. */
217 QueuedSlavePort& slavePort;
218
219 public:
220
221 /**
222 * Create a snoop response port that mirrors a given slave port.
223 */
224 SnoopRespPort(QueuedSlavePort& slave_port, CoherentXBar& _xbar) :
225 MasterPort(slave_port.name() + ".snoopRespPort", &_xbar),
226 slavePort(slave_port) { }
227
228 /**
229 * Override the sending of retries and pass them on through
230 * the mirrored slave port.
231 */
232 void
233 sendRetryResp() override
234 {
235 // forward it as a snoop response retry
236 slavePort.sendRetrySnoopResp();
237 }
238
239 void
240 recvReqRetry() override
241 {
242 panic("SnoopRespPort should never see retry");
243 }
244
245 bool
246 recvTimingResp(PacketPtr pkt) override
247 {
248 panic("SnoopRespPort should never see timing response");
249 }
250
251 };
252
253 std::vector<SnoopRespPort*> snoopRespPorts;
254
255 std::vector<QueuedSlavePort*> snoopPorts;
256
257 /**
258 * Store the outstanding requests that we are expecting snoop
259 * responses from so we can determine which snoop responses we
260 * generated and which ones were merely forwarded.
261 */
262 std::unordered_set<RequestPtr> outstandingSnoop;
263
264 /**
265 * Store the outstanding cache maintenance that we are expecting
266 * snoop responses from so we can determine when we received all
267 * snoop responses and if any of the agents satisfied the request.
268 */
269 std::unordered_map<PacketId, PacketPtr> outstandingCMO;
270
271 /**
272 * Keep a pointer to the system to be allow to querying memory system
273 * properties.
274 */
275 System *system;
276
277 /** A snoop filter that tracks cache line residency and can restrict the
278 * broadcast needed for probes. NULL denotes an absent filter. */
279 SnoopFilter *snoopFilter;
280
281 const Cycles snoopResponseLatency;
282 const bool pointOfCoherency;
283 const bool pointOfUnification;
284
285 /**
286 * Upstream caches need this packet until true is returned, so
287 * hold it for deletion until a subsequent call
288 */
289 std::unique_ptr<Packet> pendingDelete;
290
291 bool recvTimingReq(PacketPtr pkt, PortID slave_port_id);
292 bool recvTimingResp(PacketPtr pkt, PortID master_port_id);
293 void recvTimingSnoopReq(PacketPtr pkt, PortID master_port_id);
294 bool recvTimingSnoopResp(PacketPtr pkt, PortID slave_port_id);
295 void recvReqRetry(PortID master_port_id);
296
297 /**
298 * Forward a timing packet to our snoopers, potentially excluding
299 * one of the connected coherent masters to avoid sending a packet
300 * back to where it came from.
301 *
302 * @param pkt Packet to forward
303 * @param exclude_slave_port_id Id of slave port to exclude
304 */
305 void
306 forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id)
307 {
308 forwardTiming(pkt, exclude_slave_port_id, snoopPorts);
309 }
310
311 /**
312 * Forward a timing packet to a selected list of snoopers, potentially
313 * excluding one of the connected coherent masters to avoid sending a packet
314 * back to where it came from.
315 *
316 * @param pkt Packet to forward
317 * @param exclude_slave_port_id Id of slave port to exclude
318 * @param dests Vector of destination ports for the forwarded pkt
319 */
320 void forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id,
321 const std::vector<QueuedSlavePort*>& dests);
322
317 Tick recvAtomic(PacketPtr pkt, PortID slave_port_id);
323 Tick recvAtomicBackdoor(PacketPtr pkt, PortID slave_port_id,
324 MemBackdoorPtr *backdoor=nullptr);
318 Tick recvAtomicSnoop(PacketPtr pkt, PortID master_port_id);
319
320 /**
321 * Forward an atomic packet to our snoopers, potentially excluding
322 * one of the connected coherent masters to avoid sending a packet
323 * back to where it came from.
324 *
325 * @param pkt Packet to forward
326 * @param exclude_slave_port_id Id of slave port to exclude
327 *
328 * @return a pair containing the snoop response and snoop latency
329 */
330 std::pair<MemCmd, Tick>
331 forwardAtomic(PacketPtr pkt, PortID exclude_slave_port_id)
332 {
333 return forwardAtomic(pkt, exclude_slave_port_id, InvalidPortID,
334 snoopPorts);
335 }
336
337 /**
338 * Forward an atomic packet to a selected list of snoopers, potentially
339 * excluding one of the connected coherent masters to avoid sending a packet
340 * back to where it came from.
341 *
342 * @param pkt Packet to forward
343 * @param exclude_slave_port_id Id of slave port to exclude
344 * @param source_master_port_id Id of the master port for snoops from below
345 * @param dests Vector of destination ports for the forwarded pkt
346 *
347 * @return a pair containing the snoop response and snoop latency
348 */
349 std::pair<MemCmd, Tick> forwardAtomic(PacketPtr pkt,
350 PortID exclude_slave_port_id,
351 PortID source_master_port_id,
352 const std::vector<QueuedSlavePort*>&
353 dests);
354
355 /** Function called by the port when the crossbar is recieving a Functional
356 transaction.*/
357 void recvFunctional(PacketPtr pkt, PortID slave_port_id);
358
359 /** Function called by the port when the crossbar is recieving a functional
360 snoop transaction.*/
361 void recvFunctionalSnoop(PacketPtr pkt, PortID master_port_id);
362
363 /**
364 * Forward a functional packet to our snoopers, potentially
365 * excluding one of the connected coherent masters to avoid
366 * sending a packet back to where it came from.
367 *
368 * @param pkt Packet to forward
369 * @param exclude_slave_port_id Id of slave port to exclude
370 */
371 void forwardFunctional(PacketPtr pkt, PortID exclude_slave_port_id);
372
373 /**
374 * Determine if the crossbar should sink the packet, as opposed to
375 * forwarding it, or responding.
376 */
377 bool sinkPacket(const PacketPtr pkt) const;
378
379 /**
380 * Determine if the crossbar should forward the packet, as opposed to
381 * responding to it.
382 */
383 bool forwardPacket(const PacketPtr pkt);
384
385 /**
386 * Determine if the packet's destination is the memory below
387 *
388 * The memory below is the destination for a cache mainteance
389 * operation to the Point of Coherence/Unification if this is the
390 * Point of Coherence/Unification.
391 *
392 * @param pkt The processed packet
393 *
394 * @return Whether the memory below is the destination for the packet
395 */
396 bool
397 isDestination(const PacketPtr pkt) const
398 {
399 return (pkt->req->isToPOC() && pointOfCoherency) ||
400 (pkt->req->isToPOU() && pointOfUnification);
401 }
402
403 Stats::Scalar snoops;
404 Stats::Scalar snoopTraffic;
405 Stats::Distribution snoopFanout;
406
407 public:
408
409 virtual void init();
410
411 CoherentXBar(const CoherentXBarParams *p);
412
413 virtual ~CoherentXBar();
414
415 virtual void regStats();
416};
417
418#endif //__MEM_COHERENT_XBAR_HH__
325 Tick recvAtomicSnoop(PacketPtr pkt, PortID master_port_id);
326
327 /**
328 * Forward an atomic packet to our snoopers, potentially excluding
329 * one of the connected coherent masters to avoid sending a packet
330 * back to where it came from.
331 *
332 * @param pkt Packet to forward
333 * @param exclude_slave_port_id Id of slave port to exclude
334 *
335 * @return a pair containing the snoop response and snoop latency
336 */
337 std::pair<MemCmd, Tick>
338 forwardAtomic(PacketPtr pkt, PortID exclude_slave_port_id)
339 {
340 return forwardAtomic(pkt, exclude_slave_port_id, InvalidPortID,
341 snoopPorts);
342 }
343
344 /**
345 * Forward an atomic packet to a selected list of snoopers, potentially
346 * excluding one of the connected coherent masters to avoid sending a packet
347 * back to where it came from.
348 *
349 * @param pkt Packet to forward
350 * @param exclude_slave_port_id Id of slave port to exclude
351 * @param source_master_port_id Id of the master port for snoops from below
352 * @param dests Vector of destination ports for the forwarded pkt
353 *
354 * @return a pair containing the snoop response and snoop latency
355 */
356 std::pair<MemCmd, Tick> forwardAtomic(PacketPtr pkt,
357 PortID exclude_slave_port_id,
358 PortID source_master_port_id,
359 const std::vector<QueuedSlavePort*>&
360 dests);
361
362 /** Function called by the port when the crossbar is recieving a Functional
363 transaction.*/
364 void recvFunctional(PacketPtr pkt, PortID slave_port_id);
365
366 /** Function called by the port when the crossbar is recieving a functional
367 snoop transaction.*/
368 void recvFunctionalSnoop(PacketPtr pkt, PortID master_port_id);
369
370 /**
371 * Forward a functional packet to our snoopers, potentially
372 * excluding one of the connected coherent masters to avoid
373 * sending a packet back to where it came from.
374 *
375 * @param pkt Packet to forward
376 * @param exclude_slave_port_id Id of slave port to exclude
377 */
378 void forwardFunctional(PacketPtr pkt, PortID exclude_slave_port_id);
379
380 /**
381 * Determine if the crossbar should sink the packet, as opposed to
382 * forwarding it, or responding.
383 */
384 bool sinkPacket(const PacketPtr pkt) const;
385
386 /**
387 * Determine if the crossbar should forward the packet, as opposed to
388 * responding to it.
389 */
390 bool forwardPacket(const PacketPtr pkt);
391
392 /**
393 * Determine if the packet's destination is the memory below
394 *
395 * The memory below is the destination for a cache mainteance
396 * operation to the Point of Coherence/Unification if this is the
397 * Point of Coherence/Unification.
398 *
399 * @param pkt The processed packet
400 *
401 * @return Whether the memory below is the destination for the packet
402 */
403 bool
404 isDestination(const PacketPtr pkt) const
405 {
406 return (pkt->req->isToPOC() && pointOfCoherency) ||
407 (pkt->req->isToPOU() && pointOfUnification);
408 }
409
410 Stats::Scalar snoops;
411 Stats::Scalar snoopTraffic;
412 Stats::Distribution snoopFanout;
413
414 public:
415
416 virtual void init();
417
418 CoherentXBar(const CoherentXBarParams *p);
419
420 virtual ~CoherentXBar();
421
422 virtual void regStats();
423};
424
425#endif //__MEM_COHERENT_XBAR_HH__