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 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 // 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 |
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); 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 |
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 |
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); |
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", 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 --- |