diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2012-04-14 05:45:07 -0400 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2012-04-14 05:45:07 -0400 |
commit | dccca0d3a9c985972d3d603190e62899d03825e8 (patch) | |
tree | f186c5b7c6656397f04660ec2e43a2cb1a6c11f6 /src/mem/port.hh | |
parent | b9bc530ad20bceeed6e43ea459d271046f43e70c (diff) | |
download | gem5-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/mem/port.hh')
-rw-r--r-- | src/mem/port.hh | 127 |
1 files changed, 97 insertions, 30 deletions
diff --git a/src/mem/port.hh b/src/mem/port.hh index 80bb3b085..61c92d8e4 100644 --- a/src/mem/port.hh +++ b/src/mem/port.hh @@ -115,28 +115,35 @@ class Port /** These functions are protected because they should only be * called by a peer port, never directly by any outside object. */ - /** Called to recive a timing call from the peer port. */ + /** + * Receive a timing request or response packet from the peer port. + */ virtual bool recvTiming(PacketPtr pkt) = 0; - /** Called to recive a atomic call from the peer port. */ - virtual Tick recvAtomic(PacketPtr pkt) = 0; - - /** Called to recive a functional call from the peer port. */ - virtual void recvFunctional(PacketPtr pkt) = 0; + /** + * Receive a timing snoop request or snoop response packet from + * the peer port. + */ + virtual bool recvTimingSnoop(PacketPtr pkt) + { + panic("%s was not expecting a timing snoop\n", name()); + return false; + } /** - * Called by a peer port if sendTiming was unsuccesful, and had to - * wait. + * Called by a peer port if sendTiming or sendTimingSnoop was + * unsuccesful, and had to wait. */ virtual void recvRetry() = 0; public: /** - * Attempt to send a timing packet to the peer port by calling its - * receive function. If the send does not succeed, as indicated by - * the return value, then the sender must wait for a recvRetry at - * which point it can re-issue a sendTiming. + * Attempt to send a timing request or response packet to the peer + * port by calling its receive function. If the send does not + * succeed, as indicated by the return value, then the sender must + * wait for a recvRetry at which point it can re-issue a + * sendTiming. * * @param pkt Packet to send. * @@ -145,30 +152,23 @@ class Port bool sendTiming(PacketPtr pkt) { return peer->recvTiming(pkt); } /** - * Send a retry to a peer port that previously attempted a sendTiming - * which was unsuccessful. - */ - void sendRetry() { return peer->recvRetry(); } - - /** - * Send an atomic packet, where the data is moved and the state - * is updated in zero time, without interleaving with other - * memory accesses. + * Attempt to send a timing snoop request or snoop response packet + * to the peer port by calling its receive function. If the send + * does not succeed, as indicated by the return value, then the + * sender must wait for a recvRetry at which point it can re-issue + * a sendTimingSnoop. * * @param pkt Packet to send. * - * @return Estimated latency of access. - */ - Tick sendAtomic(PacketPtr pkt) { return peer->recvAtomic(pkt); } + * @return If the send was succesful or not. + */ + bool sendTimingSnoop(PacketPtr pkt) { return peer->recvTimingSnoop(pkt); } /** - * Send a functional packet, where the data is instantly updated - * everywhere in the memory system, without affecting the current - * state of any block or moving the block. - * - * @param pkt Packet to send. + * Send a retry to a peer port that previously attempted a + * sendTiming or sendTimingSnoop which was unsuccessful. */ - void sendFunctional(PacketPtr pkt) { return peer->recvFunctional(pkt); } + void sendRetry() { return peer->recvRetry(); } }; @@ -198,6 +198,43 @@ class MasterPort : public Port bool isConnected() const; /** + * Send an atomic request packet, where the data is moved and the + * state is updated in zero time, without interleaving with other + * memory accesses. + * + * @param pkt Packet to send. + * + * @return Estimated latency of access. + */ + Tick sendAtomic(PacketPtr pkt); + + /** + * Send a functional request packet, where the data is instantly + * updated everywhere in the memory system, without affecting the + * current state of any block or moving the block. + * + * @param pkt Packet to send. + */ + void sendFunctional(PacketPtr pkt); + + /** + * Receive an atomic snoop request packet from the slave port. + */ + virtual Tick recvAtomicSnoop(PacketPtr pkt) + { + panic("%s was not expecting an atomic snoop\n", name()); + return 0; + } + + /** + * Receive a functional snoop request packet from the slave port. + */ + virtual void recvFunctionalSnoop(PacketPtr pkt) + { + panic("%s was not expecting a functional snoop\n", name()); + } + + /** * Called to receive an address range change from the peer slave * port. the default implementation ignored the change and does * nothing. Override this function in a derived class if the owner @@ -257,6 +294,36 @@ class SlavePort : public Port bool isConnected() const; /** + * Send an atomic snoop request packet, where the data is moved + * and the state is updated in zero time, without interleaving + * with other memory accesses. + * + * @param pkt Snoop packet to send. + * + * @return Estimated latency of access. + */ + Tick sendAtomicSnoop(PacketPtr pkt); + + /** + * Send a functional snoop request packet, where the data is + * instantly updated everywhere in the memory system, without + * affecting the current state of any block or moving the block. + * + * @param pkt Snoop packet to send. + */ + void sendFunctionalSnoop(PacketPtr pkt); + + /** + * Receive an atomic request packet from the master port. + */ + virtual Tick recvAtomic(PacketPtr pkt) = 0; + + /** + * Receive a functional request packet from the master port. + */ + virtual void recvFunctional(PacketPtr pkt) = 0; + + /** * Called by a peer port in order to determine the block size of * the owner of this port. */ |