changeset 64207bef62c3 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=64207bef62c3
description:
        Device: Make changes necessary to support a coherent page walker cache.

        Adds the flag 'recvSnoops' which enables pagewalkers using DmaPorts,
        to properly configure snoops.

diffstat:

 src/arch/arm/table_walker.cc |   2 +-
 src/dev/io_device.cc         |  12 ++++++++++--
 src/dev/io_device.hh         |  36 +++++++++++++++++++++++++++++++-----
 3 files changed, 42 insertions(+), 8 deletions(-)

diffs (107 lines):

diff -r 7a5780ab74d7 -r 64207bef62c3 src/arch/arm/table_walker.cc
--- a/src/arch/arm/table_walker.cc      Thu Dec 01 00:15:22 2011 -0800
+++ b/src/arch/arm/table_walker.cc      Thu Dec 01 00:15:22 2011 -0800
@@ -99,7 +99,7 @@
         System *sys = params()->sys;
         Tick minb = params()->min_backoff;
         Tick maxb = params()->max_backoff;
-        port = new DmaPort(this, sys, minb, maxb);
+        port = new DmaPort(this, sys, minb, maxb, true);
         return port;
     }
     return NULL;
diff -r 7a5780ab74d7 -r 64207bef62c3 src/dev/io_device.cc
--- a/src/dev/io_device.cc      Thu Dec 01 00:15:22 2011 -0800
+++ b/src/dev/io_device.cc      Thu Dec 01 00:15:22 2011 -0800
@@ -115,11 +115,13 @@
 }
 
 
-DmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff)
+DmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff,
+                 bool recv_snoops)
     : Port(dev->name() + "-dmaport", dev), device(dev), sys(s),
       pendingCount(0), actionInProgress(0), drainEvent(NULL),
       backoffTime(0), minBackoffDelay(min_backoff),
-      maxBackoffDelay(max_backoff), inRetry(false), backoffEvent(this)
+      maxBackoffDelay(max_backoff), inRetry(false), recvSnoops(recv_snoops),
+      snoopRangeSent(false), backoffEvent(this)
 { }
 
 bool
@@ -141,6 +143,12 @@
         pkt->reinitNacked();
         queueDma(pkt, true);
     } else if (pkt->senderState) {
+        if (recvSnoops) {
+            if (pkt->isRequest()) {
+                return true;
+            }
+        }
+
         DmaReqState *state;
         backoffTime >>= 2;
 
diff -r 7a5780ab74d7 -r 64207bef62c3 src/dev/io_device.hh
--- a/src/dev/io_device.hh      Thu Dec 01 00:15:22 2011 -0800
+++ b/src/dev/io_device.hh      Thu Dec 01 00:15:22 2011 -0800
@@ -130,20 +130,45 @@
      * it is that it's sending. */
     bool inRetry;
 
+    /** Port accesses a cache which requires snooping */
+    bool recvSnoops;
+
+    /** Records snoop response so we only reply once to a status change */
+    bool snoopRangeSent;
+
     virtual bool recvTiming(PacketPtr pkt);
     virtual Tick recvAtomic(PacketPtr pkt)
-    { panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN }
+    {
+        if (recvSnoops) return 0;
+
+        panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN
+    }
     virtual void recvFunctional(PacketPtr pkt)
-    { panic("dma port shouldn't be used for pio access."); }
+    {
+        if (recvSnoops) return;
+
+        panic("dma port shouldn't be used for pio access.");
+    }
 
     virtual void recvStatusChange(Status status)
-    { ; }
+    {
+        if (recvSnoops) {
+            if (status == RangeChange) {
+                if (!snoopRangeSent) {
+                    snoopRangeSent = true;
+                    sendStatusChange(Port::RangeChange);
+                }
+                return;
+            }
+            panic("Unexpected recvStatusChange\n");
+        }
+    }
 
     virtual void recvRetry() ;
 
     virtual void getDeviceAddressRanges(AddrRangeList &resp,
                                         bool &snoop)
-    { resp.clear(); snoop = false; }
+    { resp.clear(); snoop = recvSnoops; }
 
     void queueDma(PacketPtr pkt, bool front = false);
     void sendDma();
@@ -152,7 +177,8 @@
     EventWrapper<DmaPort, &DmaPort::sendDma> backoffEvent;
 
   public:
-    DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff);
+    DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff,
+            bool recv_snoops = false);
 
     void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
                    uint8_t *data, Tick delay, Request::Flags flag = 0);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to