summaryrefslogtreecommitdiff
path: root/src/dev
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-04-14 05:45:07 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-04-14 05:45:07 -0400
commitdccca0d3a9c985972d3d603190e62899d03825e8 (patch)
treef186c5b7c6656397f04660ec2e43a2cb1a6c11f6 /src/dev
parentb9bc530ad20bceeed6e43ea459d271046f43e70c (diff)
downloadgem5-dccca0d3a9c985972d3d603190e62899d03825e8.tar.xz
MEM: Separate snoops and normal memory requests/responses
This patch introduces port access methods that separates snoop request/responses from normal memory request/responses. The differentiation is made for functional, atomic and timing accesses and builds on the introduction of master and slave ports. Before the introduction of this patch, the packets belonging to the different phases of the protocol (request -> [forwarded snoop request -> snoop response]* -> response) all use the same port access functions, even though the snoop packets flow in the opposite direction to the normal packet. That is, a coherent master sends normal request and receives responses, but receives snoop requests and sends snoop responses (vice versa for the slave). These two distinct phases now use different access functions, as described below. Starting with the functional access, a master sends a request to a slave through sendFunctional, and the request packet is turned into a response before the call returns. In a system without cache coherence, this is all that is needed from the functional interface. For the cache-coherent scenario, a slave also sends snoop requests to coherent masters through sendFunctionalSnoop, with responses returned within the same packet pointer. This is currently used by the bus and caches, and the LSQ of the O3 CPU. The send/recvFunctional and send/recvFunctionalSnoop are moved from the Port super class to the appropriate subclass. Atomic accesses follow the same flow as functional accesses, with request being sent from master to slave through sendAtomic. In the case of cache-coherent ports, a slave can send snoop requests to a master through sendAtomicSnoop. Just as for the functional access methods, the atomic send and receive member functions are moved to the appropriate subclasses. The timing access methods are different from the functional and atomic in that requests and responses are separated in time and send/recvTiming are used for both directions. Hence, a master uses sendTiming to send a request to a slave, and a slave uses sendTiming to send a response back to a master, at a later point in time. Snoop requests and responses travel in the opposite direction, similar to what happens in functional and atomic accesses. With the introduction of this patch, it is possible to determine the direction of packets in the bus, and no longer necessary to look for both a master and a slave port with the requested port id. In contrast to the normal recvFunctional, recvAtomic and recvTiming that are pure virtual functions, the recvFunctionalSnoop, recvAtomicSnoop and recvTimingSnoop have a default implementation that calls panic. This is to allow non-coherent master and slave ports to not implement these functions.
Diffstat (limited to 'src/dev')
-rw-r--r--src/dev/io_device.cc15
-rw-r--r--src/dev/io_device.hh34
2 files changed, 40 insertions, 9 deletions
diff --git a/src/dev/io_device.cc b/src/dev/io_device.cc
index 2937c66b1..e1fc28949 100644
--- a/src/dev/io_device.cc
+++ b/src/dev/io_device.cc
@@ -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) 2006 The Regents of The University of Michigan
* All rights reserved.
*
@@ -121,6 +133,7 @@ DmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff,
bool
DmaPort::recvTiming(PacketPtr pkt)
{
+ assert(pkt->isResponse());
if (pkt->wasNacked()) {
DPRINTF(DMA, "Received nacked %s addr %#x\n",
pkt->cmdString(), pkt->getAddr());
@@ -136,8 +149,6 @@ DmaPort::recvTiming(PacketPtr pkt)
pkt->reinitNacked();
queueDma(pkt, true);
- } else if (pkt->isRequest() && recvSnoops) {
- return true;
} else if (pkt->senderState) {
DmaReqState *state;
backoffTime >>= 2;
diff --git a/src/dev/io_device.hh b/src/dev/io_device.hh
index 9bb2c3d87..b113f4379 100644
--- a/src/dev/io_device.hh
+++ b/src/dev/io_device.hh
@@ -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) 2004-2005 The Regents of The University of Michigan
* All rights reserved.
*
@@ -135,17 +147,25 @@ class DmaPort : public MasterPort
bool recvSnoops;
virtual bool recvTiming(PacketPtr pkt);
- virtual Tick recvAtomic(PacketPtr pkt)
- {
- if (recvSnoops) return 0;
- panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN
+ virtual bool recvTimingSnoop(PacketPtr pkt)
+ {
+ if (!recvSnoops)
+ panic("%s was not expecting a snoop\n", name());
+ return true;
}
- virtual void recvFunctional(PacketPtr pkt)
+
+ virtual Tick recvAtomicSnoop(PacketPtr pkt)
{
- if (recvSnoops) return;
+ if (!recvSnoops)
+ panic("%s was not expecting a snoop\n", name());
+ return 0;
+ }
- panic("dma port shouldn't be used for pio access.");
+ virtual void recvFunctionalSnoop(PacketPtr pkt)
+ {
+ if (!recvSnoops)
+ panic("%s was not expecting a snoop\n", name());
}
virtual void recvRetry() ;