47#include "debug/SnoopFilter.hh"
74 bool allocate = !cpkt->
req->isUncacheable() && cpu_side_port.
isSnooping()
87 if (!is_hit && !allocate)
105 if (interested.count() == 1)
123 "double request :( SF value %x.%x\n",
136 "Need to hold the value!");
138 "%s: not marking request. SF value %x.%x\n",
144 panic_if((sf_item.
holder & req_port).none(),
"requestor %x is not a " \
145 "holder :( SF value %x.%x\n", req_port,
150 sf_item.
holder &= ~req_port;
198 "snoop filter exceeded capacity of %d cache blocks\n",
213 if (interested.count() == 1)
227 cpkt->
req->isCacheMaintenance());
274 "SF value %x.%x does not have the line\n",
286 "%s: dropping %x because non-shared snoop "
287 "response SF val: %x.%x\n", __func__, rsp_mask,
293 sf_item.
holder |= req_mask;
342 __func__, cpu_side_port.
name(), cpkt->
print());
348 if (cpkt->
req->isUncacheable() || !cpu_side_port.
isSnooping())
368 "SF value %x.%x missing request bit\n",
374 if (cpkt->
req->isCacheMaintenance()) {
378 sf_item.
holder &= ~response_mask;
384 sf_item.
holder |= response_mask;
392 : statistics::
Group(parent),
393 ADD_STAT(totRequests, statistics::units::Count::get(),
394 "Total number of requests made to the snoop filter."),
395 ADD_STAT(hitSingleRequests, statistics::units::Count::get(),
396 "Number of requests hitting in the snoop filter with a single "
397 "holder of the requested data."),
398 ADD_STAT(hitMultiRequests, statistics::units::Count::get(),
399 "Number of requests hitting in the snoop filter with multiple "
400 "(>1) holders of the requested data."),
401 ADD_STAT(totSnoops, statistics::units::Count::get(),
402 "Total number of snoops made to the snoop filter."),
403 ADD_STAT(hitSingleSnoops, statistics::units::Count::get(),
404 "Number of snoops hitting in the snoop filter with a single "
405 "holder of the requested data."),
406 ADD_STAT(hitMultiSnoops, statistics::units::Count::get(),
407 "Number of snoops hitting in the snoop filter with multiple "
408 "(>1) holders of the requested data.")
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
bool needsWritable() const
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
bool needsResponse() const
Addr getBlockAddr(unsigned int blk_size) const
RequestPtr req
A pointer to the original request.
bool cacheResponding() const
bool isInvalidate() const
bool isBlockCached() const
const std::string name() const
Return port name (for DPRINTF).
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
A ResponsePort is a specialization of a port.
bool isSnooping() const
Find out if the peer request port is snooping or not.
This snoop filter keeps track of which connected port has a particular line of data.
void finishRequest(bool will_retry, Addr addr, bool is_secure)
For an un-successful request, revert the change to the snoop filter.
void eraseIfNullEntry(SnoopFilterCache::iterator &sf_it)
Removes snoop filter items which have no requestors and no holders.
const Cycles lookupLatency
Latency for doing a lookup in the filter.
SnoopMask portToMask(const ResponsePort &port) const
Convert a single port to a corresponding, one-hot bitmask.
void updateSnoopForward(const Packet *cpkt, const ResponsePort &rsp_port, const RequestPort &req_port)
Pass snoop responses that travel downward through the snoop filter and let them update the snoop filt...
void updateResponse(const Packet *cpkt, const ResponsePort &cpu_side_port)
Update the snoop filter with a response from below (outer / other cache, or memory) and update the tr...
const Addr linesize
Cache line size.
std::pair< SnoopList, Cycles > snoopDown(Cycles latency) const
std::bitset< SNOOP_MASK_SIZE > SnoopMask
The underlying type for the bitmask we use for tracking.
std::pair< SnoopList, Cycles > lookupSnoop(const Packet *cpkt)
Handle an incoming snoop from below (the memory-side port).
SnoopList maskToPortList(SnoopMask ports) const
Converts a bitmask of ports into the corresponing list of ports.
struct gem5::SnoopFilter::ReqLookupResult reqLookupResult
std::pair< SnoopList, Cycles > snoopSelected(const SnoopList &_cpu_side_ports, Cycles latency) const
const unsigned maxEntryCount
Max capacity in terms of cache blocks tracked, for sanity checking.
SnoopFilterCache cachedLocations
Simple hash set of cached addresses.
void updateSnoopResponse(const Packet *cpkt, const ResponsePort &rsp_port, const ResponsePort &req_port)
Let the snoop filter see any snoop responses that turn into request responses and indicate cache to c...
@ LineSecure
block holds data from the secure memory space
gem5::SnoopFilter::SnoopFilterStats stats
static const int SNOOP_MASK_SIZE
std::pair< SnoopList, Cycles > lookupRequest(const Packet *cpkt, const ResponsePort &cpu_side_port)
Lookup a request (from a CPU-side port) in the snoop filter and return a list of other CPU-side ports...
virtual void regStats()
Callback to set stat parameters.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
virtual void regStats()
Callback to set stat parameters.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition of a snoop filter.
SnoopItem retryItem
Variable to temporarily store value of snoopfilter entry in case finishRequest needs to undo changes ...
SnoopFilterCache::iterator it
Iterator used to store the result from lookupRequest.
statistics::Scalar totSnoops
statistics::Scalar hitMultiRequests
statistics::Scalar hitSingleSnoops
statistics::Scalar hitMultiSnoops
statistics::Scalar hitSingleRequests
statistics::Scalar totRequests
SnoopFilterStats(statistics::Group *parent)
Per cache line item tracking a bitmask of ResponsePorts who have an outstanding request to this line ...