snoop_filter.cc (11544:2383451ff6a5) | snoop_filter.cc (11603:900cca8c5b04) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2013-2015 ARM Limited | 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 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 49 unchanged lines hidden (view full) --- 60} 61 62std::pair<SnoopFilter::SnoopList, Cycles> 63SnoopFilter::lookupRequest(const Packet* cpkt, const SlavePort& slave_port) 64{ 65 DPRINTF(SnoopFilter, "%s: packet src %s addr 0x%x cmd %s\n", 66 __func__, slave_port.name(), cpkt->getAddr(), cpkt->cmdString()); 67 | 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 --- 49 unchanged lines hidden (view full) --- 60} 61 62std::pair<SnoopFilter::SnoopList, Cycles> 63SnoopFilter::lookupRequest(const Packet* cpkt, const SlavePort& slave_port) 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 // Ultimately we should check if the packet came from an 69 // allocating source, not just if the port is snooping 70 bool allocate = !cpkt->req->isUncacheable() && slave_port.isSnooping(); | 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 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. --- 151 unchanged lines hidden (view full) --- 230{ 231 DPRINTF(SnoopFilter, "%s: packet rsp %s req %s addr 0x%x cmd %s\n", 232 __func__, rsp_port.name(), req_port.name(), cpkt->getAddr(), 233 cpkt->cmdString()); 234 235 assert(cpkt->isResponse()); 236 assert(cpkt->cacheResponding()); 237 | 71 Addr line_addr = cpkt->getBlockAddr(linesize); 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. --- 151 unchanged lines hidden (view full) --- 230{ 231 DPRINTF(SnoopFilter, "%s: packet rsp %s req %s addr 0x%x cmd %s\n", 232 __func__, rsp_port.name(), req_port.name(), cpkt->getAddr(), 233 cpkt->cmdString()); 234 235 assert(cpkt->isResponse()); 236 assert(cpkt->cacheResponding()); 237 |
238 // Ultimately we should check if the packet came from an 239 // allocating source, not just if the port is snooping 240 bool allocate = !cpkt->req->isUncacheable() && req_port.isSnooping(); 241 if (!allocate) | 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; | 242 return; |
243 } |
|
243 244 Addr line_addr = cpkt->getBlockAddr(linesize); 245 SnoopMask rsp_mask = portToMask(rsp_port); 246 SnoopMask req_mask = portToMask(req_port); 247 SnoopItem& sf_item = cachedLocations[line_addr]; 248 249 DPRINTF(SnoopFilter, "%s: old SF value %x.%x\n", 250 __func__, sf_item.requested, sf_item.holder); --- 12 unchanged lines hidden (view full) --- 263 if (!cpkt->hasSharers()) { 264 DPRINTF(SnoopFilter, 265 "%s: dropping %x because non-shared snoop " 266 "response SF val: %x.%x\n", __func__, rsp_mask, 267 sf_item.requested, sf_item.holder); 268 sf_item.holder = 0; 269 } 270 assert(!cpkt->isWriteback()); | 244 245 Addr line_addr = cpkt->getBlockAddr(linesize); 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); --- 12 unchanged lines hidden (view full) --- 264 if (!cpkt->hasSharers()) { 265 DPRINTF(SnoopFilter, 266 "%s: dropping %x because non-shared snoop " 267 "response SF val: %x.%x\n", __func__, rsp_mask, 268 sf_item.requested, sf_item.holder); 269 sf_item.holder = 0; 270 } 271 assert(!cpkt->isWriteback()); |
272 // @todo Deal with invalidating responses |
|
271 sf_item.holder |= req_mask; 272 sf_item.requested &= ~req_mask; 273 assert(sf_item.requested | sf_item.holder); 274 DPRINTF(SnoopFilter, "%s: new SF value %x.%x\n", 275 __func__, sf_item.requested, sf_item.holder); 276} 277 278void --- 35 unchanged lines hidden (view full) --- 314void 315SnoopFilter::updateResponse(const Packet* cpkt, const SlavePort& slave_port) 316{ 317 DPRINTF(SnoopFilter, "%s: packet src %s addr 0x%x cmd %s\n", 318 __func__, slave_port.name(), cpkt->getAddr(), cpkt->cmdString()); 319 320 assert(cpkt->isResponse()); 321 | 273 sf_item.holder |= req_mask; 274 sf_item.requested &= ~req_mask; 275 assert(sf_item.requested | sf_item.holder); 276 DPRINTF(SnoopFilter, "%s: new SF value %x.%x\n", 277 __func__, sf_item.requested, sf_item.holder); 278} 279 280void --- 35 unchanged lines hidden (view full) --- 316void 317SnoopFilter::updateResponse(const Packet* cpkt, const SlavePort& slave_port) 318{ 319 DPRINTF(SnoopFilter, "%s: packet src %s addr 0x%x cmd %s\n", 320 __func__, slave_port.name(), cpkt->getAddr(), cpkt->cmdString()); 321 322 assert(cpkt->isResponse()); 323 |
322 // Ultimately we should check if the packet came from an 323 // allocating source, not just if the port is snooping 324 bool allocate = !cpkt->req->isUncacheable() && slave_port.isSnooping(); 325 if (!allocate) | 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()) |
326 return; 327 | 327 return; 328 |
329 // next check if we actually allocated an entry |
|
328 Addr line_addr = cpkt->getBlockAddr(linesize); | 330 Addr line_addr = cpkt->getBlockAddr(linesize); |
331 auto sf_it = cachedLocations.find(line_addr); 332 if (sf_it == cachedLocations.end()) 333 return; 334 |
|
329 SnoopMask slave_mask = portToMask(slave_port); | 335 SnoopMask slave_mask = portToMask(slave_port); |
330 SnoopItem& sf_item = cachedLocations[line_addr]; | 336 SnoopItem& sf_item = sf_it->second; |
331 332 DPRINTF(SnoopFilter, "%s: old SF value %x.%x\n", 333 __func__, sf_item.requested, sf_item.holder); 334 335 // Make sure we have seen the actual request, too 336 panic_if(!(sf_item.requested & slave_mask), "SF value %x.%x missing "\ 337 "request bit\n", sf_item.requested, sf_item.holder); 338 --- 51 unchanged lines hidden --- | 337 338 DPRINTF(SnoopFilter, "%s: old SF value %x.%x\n", 339 __func__, sf_item.requested, sf_item.holder); 340 341 // Make sure we have seen the actual request, too 342 panic_if(!(sf_item.requested & slave_mask), "SF value %x.%x missing "\ 343 "request bit\n", sf_item.requested, sf_item.holder); 344 --- 51 unchanged lines hidden --- |