43#ifndef __MEM_SNOOP_FILTER_HH__
44#define __MEM_SNOOP_FILTER_HH__
47#include <unordered_map>
53#include "params/SnoopFilter.hh"
116 for (
const auto&
p : _cpu_side_ports) {
118 if (
p->isSnooping()) {
126 "Snoop filter only supports %d snooping ports, got %d\n",
236 _cpu_side_ports,
Cycles latency)
const
238 return std::make_pair(_cpu_side_ports, latency);
243 return std::make_pair(empty , latency);
278 SnoopFilterCache::iterator
it;
Cycles is a wrapper class for representing cycle counts, i.e.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
PortID getId() const
Get the port id.
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.
Abstract superclass for simulation objects.
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.
std::vector< PortID > localResponsePortIds
Track the mapping from port ids to the local mask ids.
void setCPUSidePorts(const SnoopList &_cpu_side_ports)
Init a new snoop filter and tell it about all the cpu_sideports of the enclosing bus.
SnoopFilter(const SnoopFilterParams &p)
void eraseIfNullEntry(SnoopFilterCache::iterator &sf_it)
Removes snoop filter items which have no requestors and no holders.
std::vector< QueuedResponsePort * > SnoopList
SnoopList cpuSidePorts
List of all attached snooping CPU-side ports.
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...
std::unordered_map< Addr, SnoopItem > SnoopFilterCache
HashMap of SnoopItems indexed by line address.
const Addr linesize
Cache line size.
std::pair< SnoopList, Cycles > snoopDown(Cycles latency) const
std::pair< SnoopList, Cycles > snoopAll(Cycles latency) const
Simple factory methods for standard return values.
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...
LineStatus
Use the lower bits of the address to keep track of the line status.
@ 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.
This is a simple scalar statistic, like a counter.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
const PortID InvalidPortID
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Declaration of the Packet class.
Declaration of the queued port.
A request lookup must be followed by a call to finishRequest to inform the operation's success.
SnoopItem retryItem
Variable to temporarily store value of snoopfilter entry in case finishRequest needs to undo changes ...
ReqLookupResult(SnoopFilterCache::iterator end_it)
The constructor must be informed of the internal cache's end iterator, so do not allow the compiler t...
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 ...