gem5  v21.1.0.2
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
gem5::DmaPort Class Reference

#include <dma_device.hh>

Inheritance diagram for gem5::DmaPort:
gem5::RequestPort gem5::Drainable gem5::Port gem5::AtomicRequestProtocol gem5::TimingRequestProtocol gem5::FunctionalRequestProtocol

Classes

struct  DmaReqState
 

Public Member Functions

 DmaPort (ClockedObject *dev, System *s, uint32_t sid=0, uint32_t ssid=0)
 
void dmaAction (Packet::Command cmd, Addr addr, int size, Event *event, uint8_t *data, Tick delay, Request::Flags flag=0)
 
void dmaAction (Packet::Command cmd, Addr addr, int size, Event *event, uint8_t *data, uint32_t sid, uint32_t ssid, Tick delay, Request::Flags flag=0)
 
bool dmaPending () const
 
DrainState drain () override
 Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight. More...
 
- Public Member Functions inherited from gem5::RequestPort
 RequestPort (const std::string &name, SimObject *_owner, PortID id=InvalidPortID)
 Request port. More...
 
virtual ~RequestPort ()
 
void bind (Port &peer) override
 Bind this request port to a response port. More...
 
void unbind () override
 Unbind this request port and the associated response port. More...
 
virtual bool isSnooping () const
 Determine if this request port is snooping or not. More...
 
AddrRangeList getAddrRanges () const
 Get the address ranges of the connected responder port. More...
 
void printAddr (Addr a)
 Inject a PrintReq for the given address to print the state of that address throughout the memory system. More...
 
Tick sendAtomic (PacketPtr pkt)
 Send an atomic request packet, where the data is moved and the state is updated in zero time, without interleaving with other memory accesses. More...
 
Tick sendAtomicBackdoor (PacketPtr pkt, MemBackdoorPtr &backdoor)
 Send an atomic request packet like above, but also request a backdoor to the data being accessed. More...
 
void sendFunctional (PacketPtr pkt) const
 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. More...
 
bool sendTimingReq (PacketPtr pkt)
 Attempt to send a timing request to the responder port by calling its corresponding receive function. More...
 
bool tryTiming (PacketPtr pkt) const
 Check if the responder can handle a timing request. More...
 
bool sendTimingSnoopResp (PacketPtr pkt)
 Attempt to send a timing snoop response packet to the response port by calling its corresponding receive function. More...
 
virtual void sendRetryResp ()
 Send a retry to the response port that previously attempted a sendTimingResp to this request port and failed. More...
 
- Public Member Functions inherited from gem5::Port
virtual ~Port ()
 Virtual destructor due to inheritance. More...
 
PortgetPeer ()
 Return a reference to this port's peer. More...
 
const std::string name () const
 Return port name (for DPRINTF). More...
 
PortID getId () const
 Get the port id. More...
 
bool isConnected () const
 Is this port currently connected to a peer? More...
 
void takeOverFrom (Port *old)
 A utility function to make it easier to swap out ports. More...
 
- Public Member Functions inherited from gem5::Drainable
DrainState drainState () const
 Return the current drain state of an object. More...
 
virtual void notifyFork ()
 Notify a child process of a fork. More...
 

Public Attributes

ClockedObject *const device
 The device that owns this port. More...
 
System *const sys
 The system that device/port are in. More...
 
const RequestorID requestorId
 Id for all requests. More...
 

Protected Member Functions

bool recvTimingResp (PacketPtr pkt) override
 Receive a timing response from the peer. More...
 
void recvReqRetry () override
 Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on the peer) and was unsuccessful. More...
 
- Protected Member Functions inherited from gem5::RequestPort
virtual void recvRangeChange ()
 Called to receive an address range change from the peer response port. More...
 
Tick recvAtomicSnoop (PacketPtr pkt) override
 Default implementations. More...
 
void recvFunctionalSnoop (PacketPtr pkt) override
 Receive a functional snoop request packet from the peer. More...
 
void recvTimingSnoopReq (PacketPtr pkt) override
 Receive a timing snoop request from the peer. More...
 
void recvRetrySnoopResp () override
 Called by the peer if sendTimingSnoopResp was called on this protocol (causing recvTimingSnoopResp to be called on the peer) and was unsuccessful. More...
 
- Protected Member Functions inherited from gem5::Port
void reportUnbound () const
 
 Port (const std::string &_name, PortID _id)
 Abstract base class for ports. More...
 
- Protected Member Functions inherited from gem5::AtomicRequestProtocol
Tick send (AtomicResponseProtocol *peer, PacketPtr pkt)
 Send an atomic request packet, where the data is moved and the state is updated in zero time, without interleaving with other memory accesses. More...
 
Tick sendBackdoor (AtomicResponseProtocol *peer, PacketPtr pkt, MemBackdoorPtr &backdoor)
 Send an atomic request packet like above, but also request a backdoor to the data being accessed. More...
 
- Protected Member Functions inherited from gem5::TimingRequestProtocol
bool sendReq (TimingResponseProtocol *peer, PacketPtr pkt)
 Attempt to send a timing request to the peer by calling its corresponding receive function. More...
 
bool trySend (TimingResponseProtocol *peer, PacketPtr pkt) const
 Check if the peer can handle a timing request. More...
 
bool sendSnoopResp (TimingResponseProtocol *peer, PacketPtr pkt)
 Attempt to send a timing snoop response packet to it's peer by calling its corresponding receive function. More...
 
void sendRetryResp (TimingResponseProtocol *peer)
 Send a retry to the peer that previously attempted a sendTimingResp to this protocol and failed. More...
 
- Protected Member Functions inherited from gem5::FunctionalRequestProtocol
void send (FunctionalResponseProtocol *peer, PacketPtr pkt) const
 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. More...
 
- Protected Member Functions inherited from gem5::Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain. More...
 
void signalDrainDone () const
 Signal that an object is drained. More...
 

Protected Attributes

std::deque< DmaReqState * > transmitList
 Use a deque as we never do any insertion or removal in the middle. More...
 
EventFunctionWrapper sendEvent
 Event used to schedule a future sending from the transmit list. More...
 
uint32_t pendingCount = 0
 Number of outstanding packets the dma port has. More...
 
PacketPtr inRetry = nullptr
 The packet (if any) waiting for a retry to send. More...
 
const uint32_t defaultSid
 Default streamId. More...
 
const uint32_t defaultSSid
 Default substreamId. More...
 
const int cacheLineSize
 
- Protected Attributes inherited from gem5::RequestPort
SimObjectowner
 
- Protected Attributes inherited from gem5::Port
const PortID id
 A numeric identifier to distinguish ports in a vector, and set to InvalidPortID in case this port is not part of a vector. More...
 
Port_peer
 A pointer to this port's peer. More...
 
bool _connected
 Whether this port is currently connected to a peer port. More...
 

Private Member Functions

void trySendTimingReq ()
 Take the first request on the transmit list and attempt to send a timing packet from it. More...
 
void sendDma ()
 For timing, attempt to send the first item on the transmit list, and if it is successful and there are more packets waiting, then schedule the sending of the next packet. More...
 
bool sendAtomicReq (DmaReqState *state)
 Send the next packet from a DMA request in atomic mode. More...
 
bool sendAtomicBdReq (DmaReqState *state)
 Send the next packet from a DMA request in atomic mode, and request and/or use memory backdoors if possible. More...
 
void handleRespPacket (PacketPtr pkt, Tick delay=0)
 Handle a response packet by updating the corresponding DMA request state to reflect the bytes received, and also update the pending request counter. More...
 
void handleResp (DmaReqState *state, Addr addr, Addr size, Tick delay=0)
 

Private Attributes

AddrRangeMap< MemBackdoorPtr, 1 > memBackdoors
 

Detailed Description

Definition at line 61 of file dma_device.hh.

Constructor & Destructor Documentation

◆ DmaPort()

gem5::DmaPort::DmaPort ( ClockedObject dev,
System s,
uint32_t  sid = 0,
uint32_t  ssid = 0 
)

Definition at line 58 of file dma_device.cc.

References sendDma().

Member Function Documentation

◆ dmaAction() [1/2]

void gem5::DmaPort::dmaAction ( Packet::Command  cmd,
Addr  addr,
int  size,
Event event,
uint8_t *  data,
Tick  delay,
Request::Flags  flag = 0 
)

◆ dmaAction() [2/2]

void gem5::DmaPort::dmaAction ( Packet::Command  cmd,
Addr  addr,
int  size,
Event event,
uint8_t *  data,
uint32_t  sid,
uint32_t  ssid,
Tick  delay,
Request::Flags  flag = 0 
)

◆ dmaPending()

bool gem5::DmaPort::dmaPending ( ) const
inline

Definition at line 198 of file dma_device.hh.

References pendingCount.

Referenced by gem5::DmaDevice::dmaPending().

◆ drain()

DrainState gem5::DmaPort::drain ( )
overridevirtual

Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight.

Draining is mostly used before forking and creating a check point.

This function notifies an object that it needs to drain its state.

If the object does not need further simulation to drain internal buffers, it returns DrainState::Drained and automatically switches to the Drained state. If the object needs more simulation, it returns DrainState::Draining and automatically enters the Draining state. Other return values are invalid.

Note
An object that has entered the Drained state can be disturbed by other objects in the system and consequently stop being drained. These perturbations are not visible in the drain state. The simulator therefore repeats the draining process until all objects return DrainState::Drained on the first call to drain().
Returns
DrainState::Drained if the object is drained at this point in time, DrainState::Draining if it needs further simulation.

Implements gem5::Drainable.

Definition at line 156 of file dma_device.cc.

References DPRINTF, gem5::Drained, gem5::Draining, and pendingCount.

◆ handleResp()

void gem5::DmaPort::handleResp ( DmaReqState state,
Addr  addr,
Addr  size,
Tick  delay = 0 
)
private

◆ handleRespPacket()

void gem5::DmaPort::handleRespPacket ( PacketPtr  pkt,
Tick  delay = 0 
)
private

Handle a response packet by updating the corresponding DMA request state to reflect the bytes received, and also update the pending request counter.

If the DMA request that this packet is part of is complete, then signal the completion event if present, potentially with a delay added to it.

Parameters
pktResponse packet to handler
delayAdditional delay for scheduling the completion event

Definition at line 67 of file dma_device.cc.

References gem5::Packet::getAddr(), handleResp(), gem5::Packet::isResponse(), gem5::Packet::req, and gem5::Packet::senderState.

Referenced by recvTimingResp(), sendAtomicBdReq(), and sendAtomicReq().

◆ recvReqRetry()

void gem5::DmaPort::recvReqRetry ( )
overrideprotectedvirtual

Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on the peer) and was unsuccessful.

Implements gem5::TimingRequestProtocol.

Definition at line 167 of file dma_device.cc.

References transmitList, and trySendTimingReq().

◆ recvTimingResp()

bool gem5::DmaPort::recvTimingResp ( PacketPtr  pkt)
overrideprotectedvirtual

Receive a timing response from the peer.

Implements gem5::TimingRequestProtocol.

Definition at line 132 of file dma_device.cc.

References gem5::Packet::cacheResponding(), handleRespPacket(), gem5::Packet::hasSharers(), and gem5::Packet::req.

◆ sendAtomicBdReq()

bool gem5::DmaPort::sendAtomicBdReq ( DmaReqState state)
private

◆ sendAtomicReq()

bool gem5::DmaPort::sendAtomicReq ( DmaReqState state)
private

◆ sendDma()

void gem5::DmaPort::sendDma ( )
private

For timing, attempt to send the first item on the transmit list, and if it is successful and there are more packets waiting, then schedule the sending of the next packet.

For atomic, simply send and process everything on the transmit list.

Definition at line 330 of file dma_device.cc.

References gem5::System::bypassCaches(), gem5::context_switch_task_id::DMA, gem5::ChunkGenerator::done(), DPRINTF, gem5::DmaPort::DmaReqState::gen, inRetry, gem5::System::isAtomicMode(), gem5::System::isTimingMode(), panic, gem5::Event::scheduled(), sendAtomicBdReq(), sendAtomicReq(), sendEvent, sys, transmitList, and trySendTimingReq().

Referenced by dmaAction(), and DmaPort().

◆ trySendTimingReq()

void gem5::DmaPort::trySendTimingReq ( )
private

Take the first request on the transmit list and attempt to send a timing packet from it.

If it is successful, schedule the sending of the next packet. Otherwise remember that we are waiting for a retry.

Definition at line 204 of file dma_device.cc.

References gem5::Clocked::clockEdge(), gem5::Packet::cmdString(), gem5::DmaPort::DmaReqState::createPacket(), device, gem5::context_switch_task_id::DMA, DPRINTF, gem5::DmaPort::DmaReqState::gen, gem5::Packet::getAddr(), inRetry, gem5::ChunkGenerator::last(), gem5::ChunkGenerator::next(), gem5::EventManager::schedule(), sendEvent, gem5::RequestPort::sendTimingReq(), and transmitList.

Referenced by recvReqRetry(), and sendDma().

Member Data Documentation

◆ cacheLineSize

const int gem5::DmaPort::cacheLineSize
protected

Definition at line 178 of file dma_device.hh.

Referenced by dmaAction().

◆ defaultSid

const uint32_t gem5::DmaPort::defaultSid
protected

Default streamId.

Definition at line 173 of file dma_device.hh.

Referenced by dmaAction().

◆ defaultSSid

const uint32_t gem5::DmaPort::defaultSSid
protected

Default substreamId.

Definition at line 176 of file dma_device.hh.

Referenced by dmaAction().

◆ device

ClockedObject* const gem5::DmaPort::device

The device that owns this port.

Definition at line 150 of file dma_device.hh.

Referenced by handleResp(), and trySendTimingReq().

◆ inRetry

PacketPtr gem5::DmaPort::inRetry = nullptr
protected

The packet (if any) waiting for a retry to send.

Definition at line 170 of file dma_device.hh.

Referenced by sendDma(), and trySendTimingReq().

◆ memBackdoors

AddrRangeMap<MemBackdoorPtr, 1> gem5::DmaPort::memBackdoors
private

Definition at line 64 of file dma_device.hh.

Referenced by sendAtomicBdReq().

◆ pendingCount

uint32_t gem5::DmaPort::pendingCount = 0
protected

Number of outstanding packets the dma port has.

Definition at line 167 of file dma_device.hh.

Referenced by dmaAction(), dmaPending(), drain(), and handleResp().

◆ requestorId

const RequestorID gem5::DmaPort::requestorId

Id for all requests.

Definition at line 157 of file dma_device.hh.

Referenced by dmaAction().

◆ sendEvent

EventFunctionWrapper gem5::DmaPort::sendEvent
protected

Event used to schedule a future sending from the transmit list.

Definition at line 164 of file dma_device.hh.

Referenced by sendDma(), and trySendTimingReq().

◆ sys

System* const gem5::DmaPort::sys

The system that device/port are in.

This is used to select which mode we are currently operating in.

Definition at line 154 of file dma_device.hh.

Referenced by gem5::DmaReadFifo::resumeFill(), and sendDma().

◆ transmitList

std::deque<DmaReqState *> gem5::DmaPort::transmitList
protected

Use a deque as we never do any insertion or removal in the middle.

Definition at line 161 of file dma_device.hh.

Referenced by dmaAction(), recvReqRetry(), sendDma(), and trySendTimingReq().


The documentation for this class was generated from the following files:

Generated on Tue Sep 21 2021 12:27:30 for gem5 by doxygen 1.8.17