snoop_filter.cc (11603:900cca8c5b04) snoop_filter.cc (11605:65ae342b627b)
1/*
2 * Copyright (c) 2013-2016 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

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

64{
65 DPRINTF(SnoopFilter, "%s: packet src %s addr 0x%x cmd %s\n",
66 __func__, slave_port.name(), cpkt->getAddr(), cpkt->cmdString());
67
68 // check if the packet came from a cache
69 bool allocate = !cpkt->req->isUncacheable() && slave_port.isSnooping() &&
70 cpkt->fromCache();
71 Addr line_addr = cpkt->getBlockAddr(linesize);
1/*
2 * Copyright (c) 2013-2016 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

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

64{
65 DPRINTF(SnoopFilter, "%s: packet src %s addr 0x%x cmd %s\n",
66 __func__, slave_port.name(), cpkt->getAddr(), cpkt->cmdString());
67
68 // check if the packet came from a cache
69 bool allocate = !cpkt->req->isUncacheable() && slave_port.isSnooping() &&
70 cpkt->fromCache();
71 Addr line_addr = cpkt->getBlockAddr(linesize);
72 if (cpkt->isSecure()) {
73 line_addr |= LineSecure;
74 }
72 SnoopMask req_port = portToMask(slave_port);
73 reqLookupResult = cachedLocations.find(line_addr);
74 bool is_hit = (reqLookupResult != cachedLocations.end());
75
76 // If the snoop filter has no entry, and we should not allocate,
77 // do not create a new snoop filter entry, simply return a NULL
78 // portlist.
79 if (!is_hit && !allocate)

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

141 __func__, sf_item.requested, sf_item.holder);
142 }
143 }
144
145 return snoopSelected(maskToPortList(interested & ~req_port), lookupLatency);
146}
147
148void
75 SnoopMask req_port = portToMask(slave_port);
76 reqLookupResult = cachedLocations.find(line_addr);
77 bool is_hit = (reqLookupResult != cachedLocations.end());
78
79 // If the snoop filter has no entry, and we should not allocate,
80 // do not create a new snoop filter entry, simply return a NULL
81 // portlist.
82 if (!is_hit && !allocate)

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

144 __func__, sf_item.requested, sf_item.holder);
145 }
146 }
147
148 return snoopSelected(maskToPortList(interested & ~req_port), lookupLatency);
149}
150
151void
149SnoopFilter::finishRequest(bool will_retry, const Addr addr)
152SnoopFilter::finishRequest(bool will_retry, Addr addr, bool is_secure)
150{
151 if (reqLookupResult != cachedLocations.end()) {
152 // since we rely on the caller, do a basic check to ensure
153 // that finishRequest is being called following lookupRequest
153{
154 if (reqLookupResult != cachedLocations.end()) {
155 // since we rely on the caller, do a basic check to ensure
156 // that finishRequest is being called following lookupRequest
154 assert(reqLookupResult->first == (addr & ~(Addr(linesize - 1))));
157 Addr line_addr = (addr & ~(Addr(linesize - 1)));
158 if (is_secure) {
159 line_addr |= LineSecure;
160 }
161 assert(reqLookupResult->first == line_addr);
155 if (will_retry) {
156 // Undo any changes made in lookupRequest to the snoop filter
157 // entry if the request will come again. retryItem holds
158 // the previous value of the snoopfilter entry.
159 reqLookupResult->second = retryItem;
160
161 DPRINTF(SnoopFilter, "%s: restored SF value %x.%x\n",
162 __func__, retryItem.requested, retryItem.holder);

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

170SnoopFilter::lookupSnoop(const Packet* cpkt)
171{
172 DPRINTF(SnoopFilter, "%s: packet addr 0x%x cmd %s\n",
173 __func__, cpkt->getAddr(), cpkt->cmdString());
174
175 assert(cpkt->isRequest());
176
177 Addr line_addr = cpkt->getBlockAddr(linesize);
162 if (will_retry) {
163 // Undo any changes made in lookupRequest to the snoop filter
164 // entry if the request will come again. retryItem holds
165 // the previous value of the snoopfilter entry.
166 reqLookupResult->second = retryItem;
167
168 DPRINTF(SnoopFilter, "%s: restored SF value %x.%x\n",
169 __func__, retryItem.requested, retryItem.holder);

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

177SnoopFilter::lookupSnoop(const Packet* cpkt)
178{
179 DPRINTF(SnoopFilter, "%s: packet addr 0x%x cmd %s\n",
180 __func__, cpkt->getAddr(), cpkt->cmdString());
181
182 assert(cpkt->isRequest());
183
184 Addr line_addr = cpkt->getBlockAddr(linesize);
185 if (cpkt->isSecure()) {
186 line_addr |= LineSecure;
187 }
178 auto sf_it = cachedLocations.find(line_addr);
179 bool is_hit = (sf_it != cachedLocations.end());
180
181 panic_if(!is_hit && (cachedLocations.size() >= maxEntryCount),
182 "snoop filter exceeded capacity of %d cache blocks\n",
183 maxEntryCount);
184
185 // If the snoop filter has no entry, simply return a NULL

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

238 // if this snoop response is due to an uncacheable request, or is
239 // being turned into a normal response, there is nothing more to
240 // do
241 if (cpkt->req->isUncacheable() || !req_port.isSnooping()) {
242 return;
243 }
244
245 Addr line_addr = cpkt->getBlockAddr(linesize);
188 auto sf_it = cachedLocations.find(line_addr);
189 bool is_hit = (sf_it != cachedLocations.end());
190
191 panic_if(!is_hit && (cachedLocations.size() >= maxEntryCount),
192 "snoop filter exceeded capacity of %d cache blocks\n",
193 maxEntryCount);
194
195 // If the snoop filter has no entry, simply return a NULL

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

248 // if this snoop response is due to an uncacheable request, or is
249 // being turned into a normal response, there is nothing more to
250 // do
251 if (cpkt->req->isUncacheable() || !req_port.isSnooping()) {
252 return;
253 }
254
255 Addr line_addr = cpkt->getBlockAddr(linesize);
256 if (cpkt->isSecure()) {
257 line_addr |= LineSecure;
258 }
246 SnoopMask rsp_mask = portToMask(rsp_port);
247 SnoopMask req_mask = portToMask(req_port);
248 SnoopItem& sf_item = cachedLocations[line_addr];
249
250 DPRINTF(SnoopFilter, "%s: old SF value %x.%x\n",
251 __func__, sf_item.requested, sf_item.holder);
252
253 // The source should have the line

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

284 DPRINTF(SnoopFilter, "%s: packet rsp %s req %s addr 0x%x cmd %s\n",
285 __func__, rsp_port.name(), req_port.name(), cpkt->getAddr(),
286 cpkt->cmdString());
287
288 assert(cpkt->isResponse());
289 assert(cpkt->cacheResponding());
290
291 Addr line_addr = cpkt->getBlockAddr(linesize);
259 SnoopMask rsp_mask = portToMask(rsp_port);
260 SnoopMask req_mask = portToMask(req_port);
261 SnoopItem& sf_item = cachedLocations[line_addr];
262
263 DPRINTF(SnoopFilter, "%s: old SF value %x.%x\n",
264 __func__, sf_item.requested, sf_item.holder);
265
266 // The source should have the line

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

297 DPRINTF(SnoopFilter, "%s: packet rsp %s req %s addr 0x%x cmd %s\n",
298 __func__, rsp_port.name(), req_port.name(), cpkt->getAddr(),
299 cpkt->cmdString());
300
301 assert(cpkt->isResponse());
302 assert(cpkt->cacheResponding());
303
304 Addr line_addr = cpkt->getBlockAddr(linesize);
305 if (cpkt->isSecure()) {
306 line_addr |= LineSecure;
307 }
292 auto sf_it = cachedLocations.find(line_addr);
293 bool is_hit = sf_it != cachedLocations.end();
294
295 // Nothing to do if it is not a hit
296 if (!is_hit)
297 return;
298
299 SnoopItem& sf_item = sf_it->second;

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

323
324 // we only allocate if the packet actually came from a cache, but
325 // start by checking if the port is snooping
326 if (cpkt->req->isUncacheable() || !slave_port.isSnooping())
327 return;
328
329 // next check if we actually allocated an entry
330 Addr line_addr = cpkt->getBlockAddr(linesize);
308 auto sf_it = cachedLocations.find(line_addr);
309 bool is_hit = sf_it != cachedLocations.end();
310
311 // Nothing to do if it is not a hit
312 if (!is_hit)
313 return;
314
315 SnoopItem& sf_item = sf_it->second;

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

339
340 // we only allocate if the packet actually came from a cache, but
341 // start by checking if the port is snooping
342 if (cpkt->req->isUncacheable() || !slave_port.isSnooping())
343 return;
344
345 // next check if we actually allocated an entry
346 Addr line_addr = cpkt->getBlockAddr(linesize);
347 if (cpkt->isSecure()) {
348 line_addr |= LineSecure;
349 }
331 auto sf_it = cachedLocations.find(line_addr);
332 if (sf_it == cachedLocations.end())
333 return;
334
335 SnoopMask slave_mask = portToMask(slave_port);
336 SnoopItem& sf_item = sf_it->second;
337
338 DPRINTF(SnoopFilter, "%s: old SF value %x.%x\n",

--- 57 unchanged lines hidden ---
350 auto sf_it = cachedLocations.find(line_addr);
351 if (sf_it == cachedLocations.end())
352 return;
353
354 SnoopMask slave_mask = portToMask(slave_port);
355 SnoopItem& sf_item = sf_it->second;
356
357 DPRINTF(SnoopFilter, "%s: old SF value %x.%x\n",

--- 57 unchanged lines hidden ---