mem-cache: Add support for checking whether a cache is busy
authorNikos Nikoleris <nikos.nikoleris@arm.com>
Fri, 29 Sep 2017 14:24:13 +0000 (15:24 +0100)
committerNikos Nikoleris <nikos.nikoleris@arm.com>
Tue, 5 Dec 2017 11:47:01 +0000 (11:47 +0000)
This changeset adds support for checking whether the cache is
currently busy and a timing request would be rejected.

Change-Id: I5e37b011b2387b1fa1c9e687b9be545f06ffb5f5
Reviewed-on: https://gem5-review.googlesource.com/5042
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

src/mem/cache/cache.cc
src/mem/cache/cache.hh

index 2a3dddc196e2155431081cba4f5e4cc42cb721b1..bd1318fb93a0c0c15589ea41675a4f08a1602c9c 100644 (file)
@@ -2542,30 +2542,35 @@ Cache::CpuSidePort::getAddrRanges() const
 }
 
 bool
-Cache::CpuSidePort::recvTimingReq(PacketPtr pkt)
+Cache::CpuSidePort::tryTiming(PacketPtr pkt)
 {
     assert(!cache->system->bypassCaches());
 
-    bool success = false;
+    // always let express snoop packets through if even if blocked
+    if (pkt->isExpressSnoop()) {
+        return true;
+    } else if (isBlocked() || mustSendRetry) {
+        // either already committed to send a retry, or blocked
+        mustSendRetry = true;
+        return false;
+    }
+    mustSendRetry = false;
+    return true;
+}
+
+bool
+Cache::CpuSidePort::recvTimingReq(PacketPtr pkt)
+{
+    assert(!cache->system->bypassCaches());
 
     // always let express snoop packets through if even if blocked
     if (pkt->isExpressSnoop()) {
-        // do not change the current retry state
         bool M5_VAR_USED bypass_success = cache->recvTimingReq(pkt);
         assert(bypass_success);
         return true;
-    } else if (blocked || mustSendRetry) {
-        // either already committed to send a retry, or blocked
-        success = false;
-    } else {
-        // pass it on to the cache, and let the cache decide if we
-        // have to retry or not
-        success = cache->recvTimingReq(pkt);
     }
 
-    // remember if we have to retry
-    mustSendRetry = !success;
-    return success;
+    return tryTiming(pkt) && cache->recvTimingReq(pkt);
 }
 
 Tick
index a39a9c7402d8f5bb95c3e397711d2aeb5feeca4b..790c685f4b1035c8d6dd4f77cb07247eb1ffc7d0 100644 (file)
@@ -90,6 +90,8 @@ class Cache : public BaseCache
 
         virtual bool recvTimingSnoopResp(PacketPtr pkt);
 
+        virtual bool tryTiming(PacketPtr pkt);
+
         virtual bool recvTimingReq(PacketPtr pkt);
 
         virtual Tick recvAtomic(PacketPtr pkt);