changeset 7f4d25789dc4 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=7f4d25789dc4
description:
        MEM: Add a snooping DMA port subclass for table walker

        This patch makes the (device) DmaPort non-snooping and removes the
        recvSnoop constructor parameter and instead introduces a
        SnoopingDmaPort subclass for the ARM table walker.

        Functionality is unchanged, as are the stats, and the patch merely
        clarifies that the normal DMA ports are not snooping (although they
        may issue requests that are snooped by others, as done with PCI, PCIe,
        AMBA4 ACE etc).

        Currently this port is declared in the ARM table walker as it is not
        used anywhere else. If other ports were to have similar behaviour it
        could be moved in a future patch.

diffstat:

 src/arch/arm/table_walker.cc |   2 +-
 src/arch/arm/table_walker.hh |  39 ++++++++++++++++++++++++++++++++++++---
 src/dev/io_device.cc         |   7 +++----
 src/dev/io_device.hh         |  27 +--------------------------
 4 files changed, 41 insertions(+), 34 deletions(-)

diffs (148 lines):

diff -r e22ded364548 -r 7f4d25789dc4 src/arch/arm/table_walker.cc
--- a/src/arch/arm/table_walker.cc      Wed May 23 09:01:56 2012 -0400
+++ b/src/arch/arm/table_walker.cc      Wed May 23 09:14:12 2012 -0400
@@ -51,7 +51,7 @@
 
 TableWalker::TableWalker(const Params *p)
     : MemObject(p), port(this, params()->sys, params()->min_backoff,
-                         params()->max_backoff, true),
+                         params()->max_backoff),
       tlb(NULL), currState(NULL), pending(false),
       masterId(p->sys->getMasterId(name())),
       doL1DescEvent(this), doL2DescEvent(this), doProcessEvent(this)
diff -r e22ded364548 -r 7f4d25789dc4 src/arch/arm/table_walker.hh
--- a/src/arch/arm/table_walker.hh      Wed May 23 09:01:56 2012 -0400
+++ b/src/arch/arm/table_walker.hh      Wed May 23 09:14:12 2012 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010 ARM Limited
+ * Copyright (c) 2010-2012 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -51,7 +51,6 @@
 #include "sim/eventq.hh"
 #include "sim/fault_fwd.hh"
 
-class DmaPort;
 class ThreadContext;
 
 namespace ArmISA {
@@ -260,6 +259,40 @@
 
     };
 
+  protected:
+
+    /**
+     * A snooping DMA port that currently does nothing besides
+     * extending the DMA port to accept snoops without complaining.
+     */
+    class SnoopingDmaPort : public DmaPort
+    {
+
+      protected:
+
+        virtual void recvTimingSnoopReq(PacketPtr pkt)
+        { }
+
+        virtual Tick recvAtomicSnoop(PacketPtr pkt)
+        { return 0; }
+
+        virtual void recvFunctionalSnoop(PacketPtr pkt)
+        { }
+
+        virtual bool isSnooping() const { return true; }
+
+      public:
+
+        /**
+         * A snooping DMA port merely calls the construtor of the DMA
+         * port.
+         */
+        SnoopingDmaPort(MemObject *dev, System *s, Tick min_backoff,
+                        Tick max_backoff) :
+            DmaPort(dev, s, min_backoff, max_backoff)
+        { }
+    };
+
     struct WalkerState //: public SimObject
     {
         /** Thread context that we're doing the walk for */
@@ -329,7 +362,7 @@
 
 
     /** Port to issue translation requests from */
-    DmaPort port;
+    SnoopingDmaPort port;
 
     /** TLB that is initiating these table walks */
     TLB *tlb;
diff -r e22ded364548 -r 7f4d25789dc4 src/dev/io_device.cc
--- a/src/dev/io_device.cc      Wed May 23 09:01:56 2012 -0400
+++ b/src/dev/io_device.cc      Wed May 23 09:14:12 2012 -0400
@@ -120,13 +120,12 @@
 }
 
 
-DmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff,
-                 bool recv_snoops)
-    : MasterPort(dev->name() + "-dmaport", dev), device(dev), sys(s),
+DmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff)
+    : MasterPort(dev->name() + "-dma", dev), device(dev), sys(s),
       masterId(s->getMasterId(dev->name())),
       pendingCount(0), actionInProgress(0), drainEvent(NULL),
       backoffTime(0), minBackoffDelay(min_backoff),
-      maxBackoffDelay(max_backoff), inRetry(false), recvSnoops(recv_snoops),
+      maxBackoffDelay(max_backoff), inRetry(false),
       backoffEvent(this)
 { }
 
diff -r e22ded364548 -r 7f4d25789dc4 src/dev/io_device.hh
--- a/src/dev/io_device.hh      Wed May 23 09:01:56 2012 -0400
+++ b/src/dev/io_device.hh      Wed May 23 09:14:12 2012 -0400
@@ -143,34 +143,10 @@
      * it is that it's sending. */
     bool inRetry;
 
-    /** Port accesses a cache which requires snooping */
-    bool recvSnoops;
-
     virtual bool recvTimingResp(PacketPtr pkt);
 
-    virtual void recvTimingSnoopReq(PacketPtr pkt)
-    {
-        if (!recvSnoops)
-            panic("%s was not expecting a snoop\n", name());
-    }
-
-    virtual Tick recvAtomicSnoop(PacketPtr pkt)
-    {
-        if (!recvSnoops)
-            panic("%s was not expecting a snoop\n", name());
-        return 0;
-    }
-
-    virtual void recvFunctionalSnoop(PacketPtr pkt)
-    {
-        if (!recvSnoops)
-            panic("%s was not expecting a snoop\n", name());
-    }
-
     virtual void recvRetry() ;
 
-    virtual bool isSnooping() const { return recvSnoops; }
-
     void queueDma(PacketPtr pkt, bool front = false);
     void sendDma();
 
@@ -178,8 +154,7 @@
     EventWrapper<DmaPort, &DmaPort::sendDma> backoffEvent;
 
   public:
-    DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff,
-            bool recv_snoops = false);
+    DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff);
 
     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