snoop_filter.hh (11129:48c02e8b0bbb) snoop_filter.hh (11131:22e739752f47)
1/*
2 * Copyright (c) 2013-2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

83 * upper cache dropped a line, making the snoop filter pessimistic for now
84 * (4) ordering: there is no single point of order in the system. Instead,
85 * requesting MSHRs track order between local requests and remote snoops
86 */
87class SnoopFilter : public SimObject {
88 public:
89 typedef std::vector<QueuedSlavePort*> SnoopList;
90
1/*
2 * Copyright (c) 2013-2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

83 * upper cache dropped a line, making the snoop filter pessimistic for now
84 * (4) ordering: there is no single point of order in the system. Instead,
85 * requesting MSHRs track order between local requests and remote snoops
86 */
87class SnoopFilter : public SimObject {
88 public:
89 typedef std::vector<QueuedSlavePort*> SnoopList;
90
91 SnoopFilter (const SnoopFilterParams *p) : SimObject(p),
91 SnoopFilter (const SnoopFilterParams *p) :
92 SimObject(p), reqLookupResult(cachedLocations.end()), retryItem{0, 0},
92 linesize(p->system->cacheLineSize()), lookupLatency(p->lookup_latency)
93 {
94 }
95
96 /**
97 * Init a new snoop filter and tell it about all the slave ports of the
98 * enclosing bus.
99 *
100 * @param bus_slave_ports Vector of slave ports that the bus is attached to.
101 */
102 void setSlavePorts(const SnoopList& bus_slave_ports) {
103 slavePorts = bus_slave_ports;
104 }
105
106 /**
93 linesize(p->system->cacheLineSize()), lookupLatency(p->lookup_latency)
94 {
95 }
96
97 /**
98 * Init a new snoop filter and tell it about all the slave ports of the
99 * enclosing bus.
100 *
101 * @param bus_slave_ports Vector of slave ports that the bus is attached to.
102 */
103 void setSlavePorts(const SnoopList& bus_slave_ports) {
104 slavePorts = bus_slave_ports;
105 }
106
107 /**
107 * Lookup a request (from a slave port) in the snoop filter and return a
108 * list of other slave ports that need forwarding of the resulting snoops.
109 * Additionally, update the tracking structures with new request
110 * information.
108 * Lookup a request (from a slave port) in the snoop filter and
109 * return a list of other slave ports that need forwarding of the
110 * resulting snoops. Additionally, update the tracking structures
111 * with new request information. Note that the caller must also
112 * call finishRequest once it is known if the request needs to
113 * retry or not.
111 *
112 * @param cpkt Pointer to the request packet. Not changed.
113 * @param slave_port Slave port where the request came from.
114 * @return Pair of a vector of snoop target ports and lookup latency.
115 */
116 std::pair<SnoopList, Cycles> lookupRequest(const Packet* cpkt,
117 const SlavePort& slave_port);
118
119 /**
114 *
115 * @param cpkt Pointer to the request packet. Not changed.
116 * @param slave_port Slave port where the request came from.
117 * @return Pair of a vector of snoop target ports and lookup latency.
118 */
119 std::pair<SnoopList, Cycles> lookupRequest(const Packet* cpkt,
120 const SlavePort& slave_port);
121
122 /**
120 * For a successful request, update all data structures in the snoop filter
121 * reflecting the changes caused by that request
123 * For an un-successful request, revert the change to the snoop
124 * filter. Also take care of erasing any null entries. This method
125 * relies on the result from lookupRequest being stored in
126 * reqLookupResult.
122 *
127 *
123 * @param cpkt Pointer to the request packet. Not changed.
124 * @param slave_port Slave port where the request came from.
125 * @param will_retry This request will retry on this bus / snoop filter
128 * @param will_retry This request will retry on this bus / snoop filter
129 * @param cpkt Request packet, merely for sanity checking
126 */
130 */
127 void updateRequest(const Packet* cpkt, const SlavePort& slave_port,
128 bool will_retry);
131 void finishRequest(bool will_retry, const Packet* cpkt);
129
130 /**
131 * Handle an incoming snoop from below (the master port). These can upgrade the
132 * tracking logic and may also benefit from additional steering thanks to the
133 * snoop filter.
134 * @param cpkt Pointer to const Packet containing the snoop.
135 * @return Pair with a vector of SlavePorts that need snooping and a lookup
136 * latency.

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

230
231 /**
232 * Removes snoop filter items which have no requesters and no holders.
233 */
234 void eraseIfNullEntry(SnoopFilterCache::iterator& sf_it);
235 /** Simple hash set of cached addresses. */
236 SnoopFilterCache cachedLocations;
237 /**
132
133 /**
134 * Handle an incoming snoop from below (the master port). These can upgrade the
135 * tracking logic and may also benefit from additional steering thanks to the
136 * snoop filter.
137 * @param cpkt Pointer to const Packet containing the snoop.
138 * @return Pair with a vector of SlavePorts that need snooping and a lookup
139 * latency.

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

233
234 /**
235 * Removes snoop filter items which have no requesters and no holders.
236 */
237 void eraseIfNullEntry(SnoopFilterCache::iterator& sf_it);
238 /** Simple hash set of cached addresses. */
239 SnoopFilterCache cachedLocations;
240 /**
241 * Iterator used to store the result from lookupRequest until we
242 * call finishRequest.
243 */
244 SnoopFilterCache::iterator reqLookupResult;
245 /**
238 * Variable to temporarily store value of snoopfilter entry
246 * Variable to temporarily store value of snoopfilter entry
239 * incase updateRequest needs to undo changes made in lookupRequest
247 * incase finishRequest needs to undo changes made in lookupRequest
240 * (because of crossbar retry)
241 */
242 SnoopItem retryItem;
243 /** List of all attached slave ports. */
244 SnoopList slavePorts;
245 /** Cache line size. */
246 const unsigned linesize;
247 /** Latency for doing a lookup in the filter */

--- 41 unchanged lines hidden ---
248 * (because of crossbar retry)
249 */
250 SnoopItem retryItem;
251 /** List of all attached slave ports. */
252 SnoopList slavePorts;
253 /** Cache line size. */
254 const unsigned linesize;
255 /** Latency for doing a lookup in the filter */

--- 41 unchanged lines hidden ---