summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
authorNikos Nikoleris <nikos.nikoleris@arm.com>2019-01-22 17:40:17 +0000
committerNikos Nikoleris <nikos.nikoleris@arm.com>2019-02-26 11:17:58 +0000
commit8e723650586e9d902d4b462ddf5bb067e5eb0757 (patch)
tree0b8d6d3ff2cd160cc16ba470599eb7211d36daf5 /src/mem
parent32bbddf2362421021b016d995f5e27b2bceea3a2 (diff)
downloadgem5-8e723650586e9d902d4b462ddf5bb067e5eb0757.tar.xz
mem-cache: Copy over flags to forwarded response
A cache that forwards a request to the memory below does not fill and forwards the response with the data to cache above. This change ensures that the flags of the original response are also preserved. Change-Id: I244b20b073c31b976358816c5b14bba413b8271f Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/16182 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/cache/cache.cc25
-rw-r--r--src/mem/packet.cc12
-rw-r--r--src/mem/packet.hh14
3 files changed, 36 insertions, 15 deletions
diff --git a/src/mem/cache/cache.cc b/src/mem/cache/cache.cc
index e23c4ef30..89e40f328 100644
--- a/src/mem/cache/cache.cc
+++ b/src/mem/cache/cache.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2018 ARM Limited
+ * Copyright (c) 2010-2019 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
@@ -786,6 +786,11 @@ Cache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt, CacheBlk *blk)
tgt_pkt->setData(pkt->getConstPtr<uint8_t>());
}
+
+ // this response did not allocate here and therefore
+ // it was not consumed, make sure that any flags are
+ // carried over to cache above
+ tgt_pkt->copyResponderFlags(pkt);
}
tgt_pkt->makeTimingResponse();
// if this packet is an error copy that to the new packet
@@ -965,7 +970,6 @@ Cache::handleSnoop(PacketPtr pkt, CacheBlk *blk, bool is_timing,
// first propagate snoop upward to see if anyone above us wants to
// handle it. save & restore packet src since it will get
// rewritten to be relative to cpu-side bus (if any)
- bool alreadyResponded = pkt->cacheResponding();
if (is_timing) {
// copy the packet so that we can clear any flags before
// forwarding it upwards, we also allocate data (passing
@@ -983,16 +987,6 @@ Cache::handleSnoop(PacketPtr pkt, CacheBlk *blk, bool is_timing,
// cache
snoop_delay += snoopPkt.headerDelay;
- if (snoopPkt.cacheResponding()) {
- // cache-to-cache response from some upper cache
- assert(!alreadyResponded);
- pkt->setCacheResponding();
- }
- // upstream cache has the block, or has an outstanding
- // MSHR, pass the flag on
- if (snoopPkt.hasSharers()) {
- pkt->setHasSharers();
- }
// If this request is a prefetch or clean evict and an upper level
// signals block present, make sure to propagate the block
// presence to the requester.
@@ -1004,9 +998,14 @@ Cache::handleSnoop(PacketPtr pkt, CacheBlk *blk, bool is_timing,
if (snoopPkt.satisfied()) {
pkt->setSatisfied();
}
+
+ // Copy over flags from the snoop response to make sure we
+ // inform the final destination
+ pkt->copyResponderFlags(&snoopPkt);
} else {
+ bool already_responded = pkt->cacheResponding();
cpuSidePort.sendAtomicSnoop(pkt);
- if (!alreadyResponded && pkt->cacheResponding()) {
+ if (!already_responded && pkt->cacheResponding()) {
// cache-to-cache response from some upper cache:
// forward response to original requester
assert(pkt->isResponse());
diff --git a/src/mem/packet.cc b/src/mem/packet.cc
index 4369e168f..e1c760cd0 100644
--- a/src/mem/packet.cc
+++ b/src/mem/packet.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2018 ARM Limited
+ * Copyright (c) 2011-2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -303,6 +303,16 @@ Packet::trySatisfyFunctional(Printable *obj, Addr addr, bool is_secure, int size
}
void
+Packet::copyResponderFlags(const PacketPtr pkt)
+{
+ assert(isRequest());
+ // If we have already found a responder, no other cache should
+ // commit to responding
+ assert(!pkt->cacheResponding() || !cacheResponding());
+ flags.set(pkt->flags & RESPONDER_FLAGS);
+}
+
+void
Packet::pushSenderState(Packet::SenderState *sender_state)
{
assert(sender_state != NULL);
diff --git a/src/mem/packet.hh b/src/mem/packet.hh
index c59db362e..2bcbf4dab 100644
--- a/src/mem/packet.hh
+++ b/src/mem/packet.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2018 ARM Limited
+ * Copyright (c) 2012-2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -265,6 +265,9 @@ class Packet : public Printable
// Flags to transfer across when copying a packet
COPY_FLAGS = 0x0000003F,
+ // Flags that are used to create reponse packets
+ RESPONDER_FLAGS = 0x00000009,
+
// Does this packet have sharers (which means it should not be
// considered writable) or not. See setHasSharers below.
HAS_SHARERS = 0x00000001,
@@ -650,6 +653,15 @@ class Packet : public Printable
{ return flags.isSet(RESPONDER_HAD_WRITABLE); }
/**
+ * Copy the reponse flags from an input packet to this packet. The
+ * reponse flags determine whether a responder has been found and
+ * the state at which the block will be at the destination.
+ *
+ * @pkt The packet that we will copy flags from
+ */
+ void copyResponderFlags(const PacketPtr pkt);
+
+ /**
* A writeback/writeclean cmd gets propagated further downstream
* by the receiver when the flag is set.
*/