Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/65752?usp=email )

Change subject: mem: Add an API for requesting a back door without a Packet/Request.
......................................................................

mem: Add an API for requesting a back door without a Packet/Request.

Make this part of the Functional protocol, since it should always
return immediately, can be shared by the atomic and timing protocols,
and thematically fits with that protocol.

The default implementation on the receiving end just ignores the
request and leaves the back door pointer set to null, effectively
making back doors default "off" which matches their behavior in the
atomic protocol.

This mechamism helps fix a bug in the TLM gem5 bridges which need to
translate to/from the DMI and back door mechanisms, where there can be
an explicit request for a back door which does not have a transaction
associated with it. It is also necessary for bridging DMI requests in
timing mode, since the DMI requests must be instant, and the timing
protocol does not send/receive packets instantly.

Change-Id: I905f13b9bc83c3fa7877b05ce932e17c308125e2
---
M src/mem/port.cc
M src/mem/port.hh
M src/mem/protocol/functional.cc
M src/mem/protocol/functional.hh
4 files changed, 99 insertions(+), 0 deletions(-)



diff --git a/src/mem/port.cc b/src/mem/port.cc
index 00f7ce6..18793d4 100644
--- a/src/mem/port.cc
+++ b/src/mem/port.cc
@@ -102,6 +102,11 @@

     // Functional protocol.
     void recvFunctional(PacketPtr) override { blowUp(); }
+    void
+    recvMemBackdoorReq(const MemBackdoorReq &, MemBackdoorPtr &) override
+    {
+        blowUp();
+    }

     // General.
AddrRangeList getAddrRanges() const override { return AddrRangeList(); }
@@ -205,4 +210,15 @@
     return recvAtomic(pkt);
 }

+void
+ResponsePort::recvMemBackdoorReq(const MemBackdoorReq &req,
+        MemBackdoorPtr &backdoor)
+{
+    if (!defaultBackdoorWarned) {
+        DPRINTF(ResponsePort,
+                "Port %s doesn't support requesting a back door.", name());
+        defaultBackdoorWarned = true;
+    }
+}
+
 } // namespace gem5
diff --git a/src/mem/port.hh b/src/mem/port.hh
index 33ff117..fb0f4b8 100644
--- a/src/mem/port.hh
+++ b/src/mem/port.hh
@@ -161,6 +161,21 @@
      */
     void sendFunctional(PacketPtr pkt) const;

+    /**
+     * Send a request for a back door to a range of memory.
+     *
+ * @param req An object which describes what back door is being requested. + * @param backdoor Can be set to a back door pointer by the target to let + * caller have direct access to the requested range. The original + * caller should initialize this pointer to nullptr. If a receiver
+     *        does not want to provide a back door, they should leave this
+ * value. If an intermediary wants to support a back door across it, + * it should pass this pointer through, or if not, return without
+     *        passing the request further downstream.
+     */
+    void sendMemBackdoorReq(const MemBackdoorReq &req,
+            MemBackdoorPtr &backdoor);
+
   public:
     /* The timing protocol. */

@@ -438,6 +453,8 @@
      * Default implementations.
      */
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override;
+    void recvMemBackdoorReq(const MemBackdoorReq &req,
+            MemBackdoorPtr &backdoor) override;

     bool
     tryTiming(PacketPtr pkt) override
@@ -491,6 +508,18 @@
     }
 }

+inline void
+RequestPort::sendMemBackdoorReq(const MemBackdoorReq &req,
+        MemBackdoorPtr &backdoor)
+{
+    try {
+        return FunctionalRequestProtocol::sendMemBackdoorReq(
+                _responsePort, req, backdoor);
+    } catch (UnboundPortException) {
+        reportUnbound();
+    }
+}
+
 inline bool
 RequestPort::sendTimingReq(PacketPtr pkt)
 {
diff --git a/src/mem/protocol/functional.cc b/src/mem/protocol/functional.cc
index 0f54d92..29cec23 100644
--- a/src/mem/protocol/functional.cc
+++ b/src/mem/protocol/functional.cc
@@ -53,6 +53,14 @@
     return peer->recvFunctional(pkt);
 }

+void
+FunctionalRequestProtocol::sendMemBackdoorReq(
+        FunctionalResponseProtocol *peer,
+        const MemBackdoorReq &req, MemBackdoorPtr &backdoor)
+{
+    return peer->recvMemBackdoorReq(req, backdoor);
+}
+
 /* The response protocol. */

 void
diff --git a/src/mem/protocol/functional.hh b/src/mem/protocol/functional.hh
index 27db171..4f330b4 100644
--- a/src/mem/protocol/functional.hh
+++ b/src/mem/protocol/functional.hh
@@ -41,6 +41,7 @@
 #ifndef __MEM_GEM5_PROTOCOL_FUNCTIONAL_HH__
 #define __MEM_GEM5_PROTOCOL_FUNCTIONAL_HH__

+#include "mem/backdoor.hh"
 #include "mem/packet.hh"

 namespace gem5
@@ -66,6 +67,16 @@
      * Receive a functional snoop request packet from the peer.
      */
     virtual void recvFunctionalSnoop(PacketPtr pkt) = 0;
+
+    /**
+     * Send a request for a back door to a range of memory.
+     *
+ * @param req An object which describes what back door is being requested. + * @param backdoor Can be set to a back door pointer by the target to let
+     *        caller have direct access to the requested range.
+     */
+    void sendMemBackdoorReq(FunctionalResponseProtocol *peer,
+            const MemBackdoorReq &req, MemBackdoorPtr &backdoor);
 };

 class FunctionalResponseProtocol
@@ -86,6 +97,16 @@
      * Receive a functional request packet from the peer.
      */
     virtual void recvFunctional(PacketPtr pkt) = 0;
+
+    /**
+     * Receive a request for a back door to a range of memory.
+     *
+ * @param req An object which describes what back door is being requested. + * @param backdoor Can be set to a back door pointer by the target to let
+     *        caller have direct access to the requested range.
+     */
+    virtual void recvMemBackdoorReq(const MemBackdoorReq &req,
+            MemBackdoorPtr &backdoor) = 0;
 };

 } // namespace gem5

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/65752?usp=email To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I905f13b9bc83c3fa7877b05ce932e17c308125e2
Gerrit-Change-Number: 65752
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-CC: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to