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 auto sf_it = cachedLocations.find(line_addr);
74 bool is_hit = (sf_it != 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 // Create a new element through operator[] and modify in-place
83 SnoopItem& sf_item = is_hit ? sf_it->second : cachedLocations[line_addr];
84 SnoopMask interested = sf_item.holder | sf_item.requested;
85
86 // Store unmodified value of snoop filter item in temp storage in
87 // case we need to revert because of a send retry in
88 // updateRequest.
89 retryItem = sf_item;
90
91 totRequests++;

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

139 __func__, sf_item.requested, sf_item.holder);
140 }
141 }
142
143 return snoopSelected(maskToPortList(interested & ~req_port), lookupLatency);
144}
145
146void
147SnoopFilter::updateRequest(const Packet* cpkt, const SlavePort& slave_port,
148 bool will_retry)
149{
150 DPRINTF(SnoopFilter, "%s: packet src %s addr 0x%x cmd %s\n",
151 __func__, slave_port.name(), cpkt->getAddr(), cpkt->cmdString());
152
153 // Ultimately we should check if the packet came from an
154 // allocating source, not just if the port is snooping
155 bool allocate = !cpkt->req->isUncacheable() && slave_port.isSnooping();
156 if (!allocate)
157 return;
158
159 Addr line_addr = cpkt->getBlockAddr(linesize);
160 auto sf_it = cachedLocations.find(line_addr);
161 assert(sf_it != cachedLocations.end());
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 sf_it->second = retryItem;
167
168 DPRINTF(SnoopFilter, "%s: restored SF value %x.%x\n",
169 __func__, retryItem.requested, retryItem.holder);
170 }
171
172 eraseIfNullEntry(sf_it);
173}
174
175std::pair<SnoopFilter::SnoopList, Cycles>
176SnoopFilter::lookupSnoop(const Packet* cpkt)
177{
178 DPRINTF(SnoopFilter, "%s: packet addr 0x%x cmd %s\n",
179 __func__, cpkt->getAddr(), cpkt->cmdString());
180

--- 219 unchanged lines hidden ---