mem: Add support for repopulating the flags of an MSHR TargetList
This patch adds support for repopulating the flags of an MSHR TargetList. The added functionality makes it possible to remove targets from a TargetList without leaving it in an inconsistent state. Change-Id: I3f7a8e97bfd3e2e49bebad056d11bbfb087aad91 Reviewed-by: Andreas Hansson <andreas.hansson@arm.com> Reviewed-by: Stephan Diestelhorst <stephan.diestelhorst@arm.com>
This commit is contained in:
parent
3d0a537862
commit
f7a5de3bec
2 changed files with 36 additions and 3 deletions
20
src/mem/cache/mshr.cc
vendored
20
src/mem/cache/mshr.cc
vendored
|
@ -74,9 +74,8 @@ MSHR::TargetList::TargetList()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
inline void
|
void
|
||||||
MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
|
MSHR::TargetList::updateFlags(PacketPtr pkt, Target::Source source)
|
||||||
Counter order, Target::Source source, bool markPending)
|
|
||||||
{
|
{
|
||||||
if (source != Target::FromSnoop) {
|
if (source != Target::FromSnoop) {
|
||||||
if (pkt->needsWritable()) {
|
if (pkt->needsWritable()) {
|
||||||
|
@ -90,7 +89,22 @@ MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
|
||||||
hasUpgrade = true;
|
hasUpgrade = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MSHR::TargetList::populateFlags()
|
||||||
|
{
|
||||||
|
resetFlags();
|
||||||
|
for (auto& t: *this) {
|
||||||
|
updateFlags(t.pkt, t.source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void
|
||||||
|
MSHR::TargetList::add(PacketPtr pkt, Tick readyTime,
|
||||||
|
Counter order, Target::Source source, bool markPending)
|
||||||
|
{
|
||||||
|
updateFlags(pkt, source);
|
||||||
if (markPending) {
|
if (markPending) {
|
||||||
// Iterate over the SenderState stack and see if we find
|
// Iterate over the SenderState stack and see if we find
|
||||||
// an MSHR entry. If we do, set the downstreamPending
|
// an MSHR entry. If we do, set the downstreamPending
|
||||||
|
|
19
src/mem/cache/mshr.hh
vendored
19
src/mem/cache/mshr.hh
vendored
|
@ -143,7 +143,26 @@ class MSHR : public QueueEntry, public Printable
|
||||||
bool hasUpgrade;
|
bool hasUpgrade;
|
||||||
|
|
||||||
TargetList();
|
TargetList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use the provided packet and the source to update the
|
||||||
|
* flags of this TargetList.
|
||||||
|
*
|
||||||
|
* @param pkt Packet considered for the flag update
|
||||||
|
* @param source Indicates the source of the packet
|
||||||
|
*/
|
||||||
|
void updateFlags(PacketPtr pkt, Target::Source source);
|
||||||
|
|
||||||
void resetFlags() { needsWritable = hasUpgrade = false; }
|
void resetFlags() { needsWritable = hasUpgrade = false; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Goes through the list of targets and uses them to populate
|
||||||
|
* the flags of this TargetList. When the function returns the
|
||||||
|
* flags are consistent with the properties of packets in the
|
||||||
|
* list.
|
||||||
|
*/
|
||||||
|
void populateFlags();
|
||||||
|
|
||||||
bool isReset() const { return !needsWritable && !hasUpgrade; }
|
bool isReset() const { return !needsWritable && !hasUpgrade; }
|
||||||
void add(PacketPtr pkt, Tick readyTime, Counter order,
|
void add(PacketPtr pkt, Tick readyTime, Counter order,
|
||||||
Target::Source source, bool markPending);
|
Target::Source source, bool markPending);
|
||||||
|
|
Loading…
Reference in a new issue