cache.cc (11288:57c340f947c7) | cache.cc (11332:40bcb0e97de9) |
---|---|
1/* 2 * Copyright (c) 2010-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 --- 2138 unchanged lines hidden (view full) --- 2147 // propagate the BLOCK_CACHED flag in Writeback packets and prevent 2148 // any CleanEvicts from travelling down the memory hierarchy. 2149 pkt->setBlockCached(); 2150 DPRINTF(Cache, "Squashing %s from lower cache on writequeue hit" 2151 " %#x\n", pkt->cmdString(), pkt->getAddr()); 2152 return; 2153 } 2154 | 1/* 2 * Copyright (c) 2010-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 --- 2138 unchanged lines hidden (view full) --- 2147 // propagate the BLOCK_CACHED flag in Writeback packets and prevent 2148 // any CleanEvicts from travelling down the memory hierarchy. 2149 pkt->setBlockCached(); 2150 DPRINTF(Cache, "Squashing %s from lower cache on writequeue hit" 2151 " %#x\n", pkt->cmdString(), pkt->getAddr()); 2152 return; 2153 } 2154 |
2155 if (wb_pkt->cmd == MemCmd::WritebackDirty) { 2156 // we have dirty data, and so will proceed to respond | 2155 // conceptually writebacks are no different to other blocks in 2156 // this cache, so the behaviour is modelled after handleSnoop, 2157 // the difference being that instead of querying the block 2158 // state to determine if it is dirty and writable, we use the 2159 // command and fields of the writeback packet 2160 bool respond = wb_pkt->cmd == MemCmd::WritebackDirty && 2161 pkt->needsResponse() && pkt->cmd != MemCmd::InvalidateReq; 2162 bool have_writable = !wb_pkt->hasSharers(); 2163 bool invalidate = pkt->isInvalidate(); 2164 2165 if (!pkt->req->isUncacheable() && pkt->isRead() && !invalidate) { 2166 assert(!pkt->needsWritable()); 2167 pkt->setHasSharers(); 2168 wb_pkt->setHasSharers(); 2169 } 2170 2171 if (respond) { |
2157 pkt->setCacheResponding(); | 2172 pkt->setCacheResponding(); |
2158 if (!pkt->needsWritable()) { 2159 // the packet should end up in the Shared state (non 2160 // writable) on the completion of the fill 2161 pkt->setHasSharers(); 2162 // similarly, the writeback is no longer passing 2163 // writeable (the receiving cache should consider the 2164 // block Owned rather than Modified) 2165 wb_pkt->setHasSharers(); 2166 } else { 2167 // we need to invalidate our copy. we do that 2168 // below. 2169 assert(pkt->isInvalidate()); | 2173 2174 if (have_writable) { 2175 pkt->setResponderHadWritable(); |
2170 } | 2176 } |
2177 |
|
2171 doTimingSupplyResponse(pkt, wb_pkt->getConstPtr<uint8_t>(), 2172 false, false); | 2178 doTimingSupplyResponse(pkt, wb_pkt->getConstPtr<uint8_t>(), 2179 false, false); |
2173 } else { 2174 // on hitting a clean writeback we play it safe and do not 2175 // provide a response, the block may be dirty somewhere 2176 // else 2177 assert(wb_pkt->isCleanEviction()); 2178 // The cache technically holds the block until the 2179 // corresponding message reaches the crossbar 2180 // below. Therefore when a snoop encounters a CleanEvict 2181 // or WritebackClean message we must call 2182 // setHasSharers (just like when it encounters a 2183 // Writeback) to avoid the snoop filter prematurely 2184 // clearing the holder bit in the crossbar below 2185 if (!pkt->needsWritable()) { 2186 pkt->setHasSharers(); 2187 // the writeback is no longer passing writeable (the 2188 // receiving cache should consider the block Owned 2189 // rather than Modified) 2190 wb_pkt->setHasSharers(); 2191 } else { 2192 assert(pkt->isInvalidate()); 2193 } | |
2194 } 2195 | 2180 } 2181 |
2196 if (pkt->isInvalidate()) { | 2182 if (invalidate) { |
2197 // Invalidation trumps our writeback... discard here 2198 // Note: markInService will remove entry from writeback buffer. 2199 markInService(wb_entry, false); 2200 delete wb_pkt; 2201 } 2202 } 2203 2204 // If this was a shared writeback, there may still be --- 493 unchanged lines hidden --- | 2183 // Invalidation trumps our writeback... discard here 2184 // Note: markInService will remove entry from writeback buffer. 2185 markInService(wb_entry, false); 2186 delete wb_pkt; 2187 } 2188 } 2189 2190 // If this was a shared writeback, there may still be --- 493 unchanged lines hidden --- |