Deleted Added
sdiff udiff text old ( 11129:48c02e8b0bbb ) new ( 11131:22e739752f47 )
full compact
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

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

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();
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.
79 if (!is_hit && !allocate)
80 return snoopDown(lookupLatency);
81
82 // If no hit in snoop filter create a new element and update iterator
83 if (!is_hit)
84 reqLookupResult = cachedLocations.emplace(line_addr, SnoopItem()).first;
85 SnoopItem& sf_item = reqLookupResult->second;
86 SnoopMask interested = sf_item.holder | sf_item.requested;
87
88 // Store unmodified value of snoop filter item in temp storage in
89 // case we need to revert because of a send retry in
90 // updateRequest.
91 retryItem = sf_item;
92
93 totRequests++;

--- 47 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
149SnoopFilter::finishRequest(bool will_retry, const Packet* cpkt)
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
154 assert(reqLookupResult->first == cpkt->getBlockAddr(linesize));
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);
163 }
164
165 eraseIfNullEntry(reqLookupResult);
166 }
167}
168
169std::pair<SnoopFilter::SnoopList, Cycles>
170SnoopFilter::lookupSnoop(const Packet* cpkt)
171{
172 DPRINTF(SnoopFilter, "%s: packet addr 0x%x cmd %s\n",
173 __func__, cpkt->getAddr(), cpkt->cmdString());
174

--- 219 unchanged lines hidden ---