changeset 2764cd55d2ad in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=2764cd55d2ad
description:
        MEM: Differentiate functional cache accesses from CPU and memory

        This patch changes the functionalAccess member function in the cache
        model such that it is aware of what port the access came from, i.e. if
        it came from the CPU side or from the memory side. By adding this
        information, it is possible to respect the 'forwardSnoops' flag for
        snooping requests coming from the memory side and not forward
        them. This fixes an outstanding issue with the IO bus getting accesses
        that have no valid destination port and also cleans up future changes
        to the bus model.

diffstat:

 src/mem/cache/cache.hh      |  17 ++++++++++++++---
 src/mem/cache/cache_impl.hh |  24 +++++++++++++++---------
 2 files changed, 29 insertions(+), 12 deletions(-)

diffs (102 lines):

diff -r a33fd5964e66 -r 2764cd55d2ad src/mem/cache/cache.hh
--- a/src/mem/cache/cache.hh    Mon Jan 16 22:37:05 2012 -0500
+++ b/src/mem/cache/cache.hh    Tue Jan 17 12:55:07 2012 -0600
@@ -1,4 +1,16 @@
 /*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved.
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
  * Copyright (c) 2002-2005 The Regents of The University of Michigan
  * All rights reserved.
  *
@@ -225,10 +237,9 @@
     /**
      * Performs the access specified by the request.
      * @param pkt The request to perform.
-     * @return The result of the access.
+     * @param fromCpuSide from the CPU side port or the memory side port
      */
-    void functionalAccess(PacketPtr pkt, CachePort *incomingPort,
-                          CachePort *otherSidePort);
+    void functionalAccess(PacketPtr pkt, bool fromCpuSide);
 
     /**
      * Handles a response (cache line fill/write ack) from the bus.
diff -r a33fd5964e66 -r 2764cd55d2ad src/mem/cache/cache_impl.hh
--- a/src/mem/cache/cache_impl.hh       Mon Jan 16 22:37:05 2012 -0500
+++ b/src/mem/cache/cache_impl.hh       Tue Jan 17 12:55:07 2012 -0600
@@ -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
@@ -768,9 +768,7 @@
 
 template<class TagStore>
 void
-Cache<TagStore>::functionalAccess(PacketPtr pkt,
-                                  CachePort *incomingPort,
-                                  CachePort *otherSidePort)
+Cache<TagStore>::functionalAccess(PacketPtr pkt, bool fromCpuSide)
 {
     Addr blk_addr = blockAlign(pkt->getAddr());
     BlkType *blk = tags->findBlock(pkt->getAddr());
@@ -796,10 +794,10 @@
                       (mshr && mshr->inService && mshr->isPendingDirty()));
 
     bool done = have_dirty
-        || incomingPort->checkFunctional(pkt)
+        || cpuSidePort->checkFunctional(pkt)
         || mshrQueue.checkFunctional(pkt, blk_addr)
         || writeBuffer.checkFunctional(pkt, blk_addr)
-        || otherSidePort->checkFunctional(pkt);
+        || memSidePort->checkFunctional(pkt);
 
     DPRINTF(Cache, "functional %s %x %s%s%s\n",
             pkt->cmdString(), pkt->getAddr(),
@@ -812,7 +810,15 @@
     if (done) {
         pkt->makeResponse();
     } else {
-        otherSidePort->sendFunctional(pkt);
+        // if it came as a request from the CPU side then make sure it
+        // continues towards the memory side
+        if (fromCpuSide) {
+            memSidePort->sendFunctional(pkt);
+        } else if (forwardSnoops) {
+            // if it came from the memory side, it must be a snoop request
+            // and we should only forward it if we are forwarding snoops
+            cpuSidePort->sendFunctional(pkt);
+        }
     }
 }
 
@@ -1598,7 +1604,7 @@
 void
 Cache<TagStore>::CpuSidePort::recvFunctional(PacketPtr pkt)
 {
-    myCache()->functionalAccess(pkt, this, otherPort);
+    myCache()->functionalAccess(pkt, true);
 }
 
 
@@ -1670,7 +1676,7 @@
 void
 Cache<TagStore>::MemSidePort::recvFunctional(PacketPtr pkt)
 {
-    myCache()->functionalAccess(pkt, this, otherPort);
+    myCache()->functionalAccess(pkt, false);
 }
 
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to