59 #include "debug/Cache.hh" 65 pendingModified(false),
66 postInvalidate(false), postDowngrade(false),
67 wasWholeLineWrite(false), isForward(false)
109 for (
auto&
t: *
this) {
139 const auto &req_flags = pkt->
req->getFlags();
140 bool compat_write = !req_flags.isSet(no_merge_flags);
147 bool first_write = empty();
148 if (first_write || compat_write) {
171 if (mshr !=
nullptr) {
180 emplace_back(pkt, readyTime, order, source, markPending, alloc_on_fill);
192 DPRINTF(
Cache,
"Replacing UpgradeReq with ReadExReq\n");
195 DPRINTF(
Cache,
"Replacing SCUpgradeReq with SCUpgradeFailReq\n");
198 DPRINTF(
Cache,
"Replacing StoreCondReq with StoreCondFailReq\n");
222 for (
auto&
t : *
this) {
232 MSHR::TargetList::iterator end)
234 for (
auto t = begin;
t != end;
t++) {
235 if (
t->markedPending) {
242 MSHR *mshr =
t->pkt->findNextSenderState<
MSHR>();
243 if (mshr !=
nullptr) {
246 t->markedPending =
false;
261 for (
auto&
t : *
this) {
273 const std::string &prefix)
const 275 for (
auto&
t : *
this) {
285 s =
"FromPrefetcher";
292 t.pkt->print(os, verbosity,
"");
300 Tick when_ready,
Counter _order,
bool alloc_on_fill)
321 targets.
add(target, when_ready, _order, source,
true, alloc_on_fill);
394 if (pkt->
req->isCacheMaintenance() ||
395 tgt_pkt->
req->isCacheMaintenance() ||
425 !pkt->
req->isCacheMaintenance(),
426 "%s got snoop %s where needsWritable, " 427 "does not match isInvalidate",
name(), pkt->
print());
492 new Packet(std::make_shared<Request>(*pkt->
req), pkt->
cmd,
554 ready_targets.push_back(*it);
561 ready_targets.push_back(*it);
567 std::swap(ready_targets,
targets);
571 return ready_targets;
588 return t.pkt->req->isCacheMaintenance();
650 return !
t.pkt->req->isCacheInvalidate() &&
651 !
t.pkt->needsWritable();
663 !def_tgt_pkt->
req->isCacheInvalidate()) {
676 return !
t.pkt->req->isCacheInvalidate();
706 MSHR::print(std::ostream &
os,
int verbosity,
const std::string &prefix)
const 708 ccprintf(os,
"%s[%#llx:%#llx](%s) %s %s %s state: %s %s %s %s %s %s\n",
722 ccprintf(os,
"%s Targets:\n", prefix);
726 ccprintf(os,
"%s Deferred Targets:\n", prefix);
734 std::ostringstream str;
Miss Status and Handling Register (MSHR) declaration.
void ccprintf(cp::Print &print)
Declares a basic cache interface BaseCache.
The request is to an uncacheable address.
bool isSecure
True if the entry targets the secure memory space.
void setResponderHadWritable()
On responding to a snoop request (which only happens for Modified or Owned lines), make sure that we can transform an Owned response to a Modified one.
bool needsWritable() const
The pending* and post* flags are only valid if inService is true.
bool hasPostInvalidate() const
bool isExpressSnoop() const
void setHasSharers()
On fills, the hasSharers flag is used by the caches in combination with the cacheResponding flag...
bool inService
True if the entry has been sent downstream.
std::string print() const
A no-args wrapper of print(std::ostream...) meant to be invoked from DPRINTFs avoiding string overhea...
T * findNextSenderState() const
Go through the sender state stack and return the first instance that is of type T (as determined by a...
const std::string & name()
bool trySatisfyFunctional(PacketPtr pkt)
The request is a Load locked/store conditional.
This request is for a memory swap.
This request is made in privileged mode.
bool trySatisfyFunctional(PacketPtr pkt)
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
bool hasPostDowngrade() const
bool matchBlockAddr(const Addr addr, const bool is_secure, const int blk_size) const
Check if packet corresponds to a given block-aligned address and address space.
bool allocOnFill
Set when the response should allocate on fill.
The request is required to be strictly ordered by CPU models and is non-speculative.
bool isPendingModified() const
The request targets the secure memory space.
Addr blkSize
Size of the cache block.
void promoteWritable()
Promotes deferred targets that do not require writable.
Tick readyTime
Tick when ready to issue.
Counter order
Order number assigned to disambiguate writes and misses.
TargetList deferredTargets
bool isInvalidate() const
void setSatisfied()
Set when a request hits in a cache and the cache is not going to respond.
void print(std::ostream &os, int verbosity, const std::string &prefix) const
bool needsWritable() const
RequestPtr req
A pointer to the original request.
void updateWriteFlags(PacketPtr pkt)
Add the specified packet in the TargetList.
A coherent cache that can be arranged in flexible topologies.
bool postInvalidate
Did we snoop an invalidate while waiting for data?
Tick curTick()
The current simulated tick.
bool canMergeWrites
Indicates whether we can merge incoming write requests.
bool isReset() const
Tests if the flags of this TargetList have their default values.
bool needsResponse() const
void allocateTarget(PacketPtr target, Tick when, Counter order, bool alloc_on_fill)
Add a request to the list of targets.
void markInService(bool pending_modified_resp)
void init(Addr blk_addr, Addr blk_size)
Reset state.
Addr getOffset(unsigned int blk_size) const
uint64_t Tick
Tick count type.
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
Miss Status and handling Register.
bool isWholeLineWrite() const
Check if this list contains writes that cover an entire cache line.
This request is to a memory mapped register.
std::vector< char > writesBitmap
Track which bytes are written by requests in this target list.
void clearDownstreamPending()
TargetList targets
List of all requests that match the address.
static void replaceUpgrade(PacketPtr pkt)
bool conflictAddr(const QueueEntry *entry) const override
Check if given entry's packets conflict with this' entries packets.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void promoteIf(const std::function< bool(Target &)> &pred)
Promotes deferred targets that satisfy a predicate.
int64_t Counter
Statistics counter type.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
A queue entry base class, to be used by both the MSHRs and write-queue entries.
void updateFlags(PacketPtr pkt, Target::Source source, bool alloc_on_fill)
Use the provided packet and the source to update the flags of this TargetList.
void populateFlags()
Goes through the list of targets and uses them to populate the flags of this TargetList.
virtual bool matchBlockAddr(const Addr addr, const bool is_secure) const =0
Check if entry corresponds to the one being looked for.
bool wasWholeLineWrite
Track if we sent this as a whole line write or not.
void clearDownstreamPending()
Addr blkAddr
Address of the cache block for this list of targets.
bool matchBlockAddr(const Addr addr, const bool is_secure) const override
Check if entry corresponds to the one being looked for.
bool handleSnoop(PacketPtr target, Counter order)
void replaceUpgrades()
Convert upgrades to the equivalent request if the cache line they refer to would have been invalid (U...
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
MemCmd cmd
The command field of the packet.
TargetList extractServiceableTargets(PacketPtr pkt)
Extracts the subset of the targets that can be serviced given a received response.
bool isForward
True if the entry is just a simple forward from an upper level.
void promoteReadable()
Promotes deferred targets that do not require writable.
MSHR()
A simple constructor.
bool promoteDeferredTargets()
bool pendingModified
Here we use one flag to track both if:
bool hasFromCache
Determine whether there was at least one non-snooping target coming from another cache.
virtual bool sendMSHRQueuePacket(MSHR *mshr)
Take an MSHR, turn it into a suitable downstream packet, and send it out.
bool hasTargets() const
Returns true if there are targets left.
bool sendPacket(BaseCache &cache) override
Send this queue entry as a downstream packet, with the exact behaviour depending on the specific entr...
void deallocate()
Mark this MSHR as free.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void add(PacketPtr pkt, Tick readyTime, Counter order, Target::Source source, bool markPending, bool alloc_on_fill)
Add the specified packet in the TargetList.
void allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt, Tick when_ready, Counter _order, bool alloc_on_fill)
Allocate a miss to this MSHR.
void allocate()
Allocate memory for the packet.
bool downstreamPending
Flag set by downstream caches.
ProbePointArg< PacketInfo > Packet
Packet probe point.
bool hasFromCache() const
Determine if there are non-deferred requests from other caches.
void setCacheResponding()
Snoop flags.
bool postDowngrade
Did we snoop a read while waiting for data?
bool _isUncacheable
True if the entry is uncacheable.