summaryrefslogtreecommitdiff
path: root/src/mem/packet.hh
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2015-12-31 09:34:18 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2015-12-31 09:34:18 -0500
commitc153b669fd5b19b45fe5a37484a64b88ee4905db (patch)
treed89fc2bf339392aac4780be7e99152a010a53c3d /src/mem/packet.hh
parent7fca994d04230f1e41b9443b33f891460fc5368d (diff)
downloadgem5-c153b669fd5b19b45fe5a37484a64b88ee4905db.tar.xz
mem: Do not rely on the NeedsWritable flag for responses
This patch removes the NeedsWritable flag for all responses, as it is really only the request that needs a writable response. The response, on the other hand, should in these cases always provide the line in a writable state, as indicated by the hasSharers flag not being set. When we send requests that has NeedsWritable set, the response will always have the hasSharers flag not set. Additionally, there are cases where the request did not have NeedsWritable set, and we still get a writable response with the hasSharers flag not set. This never happens on snoops, but is used by downstream caches to pass ownership upstream. As part of this patch, the affected response types are updated, and the snoop filter is similarly modified to check only the hasSharers flag (as it should). A sanity check is also added to the packet class, asserting that we never look at the NeedsWritable flag for responses. No regressions are affected.
Diffstat (limited to 'src/mem/packet.hh')
-rw-r--r--src/mem/packet.hh10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mem/packet.hh b/src/mem/packet.hh
index 94508f697..32c4cf631 100644
--- a/src/mem/packet.hh
+++ b/src/mem/packet.hh
@@ -502,7 +502,15 @@ class Packet : public Printable
bool isUpgrade() const { return cmd.isUpgrade(); }
bool isRequest() const { return cmd.isRequest(); }
bool isResponse() const { return cmd.isResponse(); }
- bool needsWritable() const { return cmd.needsWritable(); }
+ bool needsWritable() const
+ {
+ // we should never check if a response needsWritable, the
+ // request has this flag, and for a response we should rather
+ // look at the hasSharers flag (if not set, the response is to
+ // be considered writable)
+ assert(isRequest());
+ return cmd.needsWritable();
+ }
bool needsResponse() const { return cmd.needsResponse(); }
bool isInvalidate() const { return cmd.isInvalidate(); }
bool isEviction() const { return cmd.isEviction(); }