snoop_filter.cc (14005:6cad91d6136c) | snoop_filter.cc (14122:11979370f6f8) |
---|---|
1/* 2 * Copyright (c) 2013-2017,2019 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 --- 62 unchanged lines hidden (view full) --- 71 // check if the packet came from a cache 72 bool allocate = !cpkt->req->isUncacheable() && slave_port.isSnooping() && 73 cpkt->fromCache(); 74 Addr line_addr = cpkt->getBlockAddr(linesize); 75 if (cpkt->isSecure()) { 76 line_addr |= LineSecure; 77 } 78 SnoopMask req_port = portToMask(slave_port); | 1/* 2 * Copyright (c) 2013-2017,2019 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 --- 62 unchanged lines hidden (view full) --- 71 // check if the packet came from a cache 72 bool allocate = !cpkt->req->isUncacheable() && slave_port.isSnooping() && 73 cpkt->fromCache(); 74 Addr line_addr = cpkt->getBlockAddr(linesize); 75 if (cpkt->isSecure()) { 76 line_addr |= LineSecure; 77 } 78 SnoopMask req_port = portToMask(slave_port); |
79 reqLookupResult = cachedLocations.find(line_addr); 80 bool is_hit = (reqLookupResult != cachedLocations.end()); | 79 reqLookupResult.it = cachedLocations.find(line_addr); 80 bool is_hit = (reqLookupResult.it != cachedLocations.end()); |
81 82 // If the snoop filter has no entry, and we should not allocate, 83 // do not create a new snoop filter entry, simply return a NULL 84 // portlist. 85 if (!is_hit && !allocate) 86 return snoopDown(lookupLatency); 87 88 // If no hit in snoop filter create a new element and update iterator | 81 82 // If the snoop filter has no entry, and we should not allocate, 83 // do not create a new snoop filter entry, simply return a NULL 84 // portlist. 85 if (!is_hit && !allocate) 86 return snoopDown(lookupLatency); 87 88 // If no hit in snoop filter create a new element and update iterator |
89 if (!is_hit) 90 reqLookupResult = cachedLocations.emplace(line_addr, SnoopItem()).first; 91 SnoopItem& sf_item = reqLookupResult->second; | 89 if (!is_hit) { 90 reqLookupResult.it = 91 cachedLocations.emplace(line_addr, SnoopItem()).first; 92 } 93 SnoopItem& sf_item = reqLookupResult.it->second; |
92 SnoopMask interested = sf_item.holder | sf_item.requested; 93 94 // Store unmodified value of snoop filter item in temp storage in 95 // case we need to revert because of a send retry in 96 // updateRequest. | 94 SnoopMask interested = sf_item.holder | sf_item.requested; 95 96 // Store unmodified value of snoop filter item in temp storage in 97 // case we need to revert because of a send retry in 98 // updateRequest. |
97 retryItem = sf_item; | 99 reqLookupResult.retryItem = sf_item; |
98 99 totRequests++; 100 if (is_hit) { 101 if (interested.count() == 1) 102 hitSingleRequests++; 103 else 104 hitMultiRequests++; 105 } --- 44 unchanged lines hidden (view full) --- 150 } 151 152 return snoopSelected(maskToPortList(interested & ~req_port), lookupLatency); 153} 154 155void 156SnoopFilter::finishRequest(bool will_retry, Addr addr, bool is_secure) 157{ | 100 101 totRequests++; 102 if (is_hit) { 103 if (interested.count() == 1) 104 hitSingleRequests++; 105 else 106 hitMultiRequests++; 107 } --- 44 unchanged lines hidden (view full) --- 152 } 153 154 return snoopSelected(maskToPortList(interested & ~req_port), lookupLatency); 155} 156 157void 158SnoopFilter::finishRequest(bool will_retry, Addr addr, bool is_secure) 159{ |
158 if (reqLookupResult != cachedLocations.end()) { | 160 if (reqLookupResult.it != cachedLocations.end()) { |
159 // since we rely on the caller, do a basic check to ensure 160 // that finishRequest is being called following lookupRequest 161 Addr line_addr = (addr & ~(Addr(linesize - 1))); 162 if (is_secure) { 163 line_addr |= LineSecure; 164 } | 161 // since we rely on the caller, do a basic check to ensure 162 // that finishRequest is being called following lookupRequest 163 Addr line_addr = (addr & ~(Addr(linesize - 1))); 164 if (is_secure) { 165 line_addr |= LineSecure; 166 } |
165 assert(reqLookupResult->first == line_addr); | 167 assert(reqLookupResult.it->first == line_addr); |
166 if (will_retry) { | 168 if (will_retry) { |
169 SnoopItem retry_item = reqLookupResult.retryItem; |
|
167 // Undo any changes made in lookupRequest to the snoop filter 168 // entry if the request will come again. retryItem holds 169 // the previous value of the snoopfilter entry. | 170 // Undo any changes made in lookupRequest to the snoop filter 171 // entry if the request will come again. retryItem holds 172 // the previous value of the snoopfilter entry. |
170 reqLookupResult->second = retryItem; | 173 reqLookupResult.it->second = retry_item; |
171 172 DPRINTF(SnoopFilter, "%s: restored SF value %x.%x\n", | 174 175 DPRINTF(SnoopFilter, "%s: restored SF value %x.%x\n", |
173 __func__, retryItem.requested, retryItem.holder); | 176 __func__, retry_item.requested, retry_item.holder); |
174 } 175 | 177 } 178 |
176 eraseIfNullEntry(reqLookupResult); | 179 eraseIfNullEntry(reqLookupResult.it); |
177 } 178} 179 180std::pair<SnoopFilter::SnoopList, Cycles> 181SnoopFilter::lookupSnoop(const Packet* cpkt) 182{ 183 DPRINTF(SnoopFilter, "%s: packet %s\n", __func__, cpkt->print()); 184 --- 244 unchanged lines hidden --- | 180 } 181} 182 183std::pair<SnoopFilter::SnoopList, Cycles> 184SnoopFilter::lookupSnoop(const Packet* cpkt) 185{ 186 DPRINTF(SnoopFilter, "%s: packet %s\n", __func__, cpkt->print()); 187 --- 244 unchanged lines hidden --- |