mem: Add function to check if the slave can receive a timing req
authorNikos Nikoleris <nikos.nikoleris@arm.com>
Fri, 29 Sep 2017 14:00:55 +0000 (15:00 +0100)
committerNikos Nikoleris <nikos.nikoleris@arm.com>
Tue, 5 Dec 2017 11:47:01 +0000 (11:47 +0000)
This changeset adds support for tryTiming, an interface that allows a
master to check if the slave is busy or otherwise if it can accept a
timing request.

Change-Id: Idc7c2337ae9ccf5dec54f308e488660591419a63
Reviewed-on: https://gem5-review.googlesource.com/5041
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Christian Menard <christian.menard@tu-dresden.de>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
src/mem/port.cc
src/mem/port.hh

index 2111fa429c10422fc74cae089f9515b6dcdf04ba..756eb8bddca042b7841bd3f6d5535cfce5ece1f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012,2015 ARM Limited
+ * Copyright (c) 2012,2015,2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -183,6 +183,13 @@ MasterPort::sendTimingReq(PacketPtr pkt)
     return _slavePort->recvTimingReq(pkt);
 }
 
+bool
+MasterPort::tryTiming(PacketPtr pkt) const
+{
+  assert(pkt->isRequest());
+  return _slavePort->tryTiming(pkt);
+}
+
 bool
 MasterPort::sendTimingSnoopResp(PacketPtr pkt)
 {
index 0d88441dc0d6efcaaf60c9cb9a1d93a4382436ab..39f6dead894a3f1f8331ebe9624d8c06795f4b99 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012,2015 ARM Limited
+ * Copyright (c) 2011-2012,2015,2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -223,6 +223,19 @@ class MasterPort : public BaseMasterPort
     */
     bool sendTimingReq(PacketPtr pkt);
 
+    /**
+     * Check if the slave can handle a timing request.
+     *
+     * If the send cannot be handled at the moment, as indicated by
+     * the return value, then the sender will receive a recvReqRetry
+     * at which point it can re-issue a sendTimingReq.
+     *
+     * @param pkt Packet to send.
+     *
+     * @return If the send was succesful or not.
+     */
+    bool tryTiming(PacketPtr pkt) const;
+
     /**
      * Attempt to send a timing snoop response packet to the slave
      * port by calling its corresponding receive function. If the send
@@ -451,6 +464,13 @@ class SlavePort : public BaseSlavePort
      */
     virtual bool recvTimingReq(PacketPtr pkt) = 0;
 
+    /**
+     * Availability request from the master port.
+     */
+    virtual bool tryTiming(PacketPtr pkt) {
+        panic("%s was not expecting a %s\n", name(), __func__);
+    }
+
     /**
      * Receive a timing snoop response from the master port.
      */