dev: Use regular atomic accesses for DMA in bypass mode.

These are now accelerated with backdoor accesses and should be at least
as fast as functional accesses. This removes a dependency on port
proxies, and also stops the HDLCD from using functional accesses.

Change-Id: I5e959288eb533d09cffa7b79938aa2f61e4aff7d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38720
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2020-12-24 06:48:21 -08:00
parent c5da197679
commit 43114ad1dd
2 changed files with 10 additions and 10 deletions

View File

@@ -370,8 +370,8 @@ DmaReadFifo::DmaReadFifo(DmaPort &_port, size_t size,
unsigned max_pending,
Request::Flags flags)
: maxReqSize(max_req_size), fifoSize(size),
reqFlags(flags), port(_port), proxy(port, port.sys->cacheLineSize()),
cacheLineSize(port.sys->cacheLineSize()), buffer(size)
reqFlags(flags), port(_port), cacheLineSize(port.sys->cacheLineSize()),
buffer(size)
{
freeRequests.resize(max_pending);
for (auto &e : freeRequests)
@@ -465,7 +465,7 @@ DmaReadFifo::resumeFill()
const bool old_eob(atEndOfBlock());
if (port.sys->bypassCaches())
resumeFillFunctional();
resumeFillBypass();
else
resumeFillTiming();
@@ -474,7 +474,7 @@ DmaReadFifo::resumeFill()
}
void
DmaReadFifo::resumeFillFunctional()
DmaReadFifo::resumeFillBypass()
{
const size_t fifo_space = buffer.capacity() - buffer.size();
if (fifo_space >= cacheLineSize || buffer.capacity() < cacheLineSize) {
@@ -483,11 +483,13 @@ DmaReadFifo::resumeFillFunctional()
std::vector<uint8_t> tmp_buffer(xfer_size);
assert(pendingRequests.empty());
DPRINTF(DMA, "KVM Bypassing startAddr=%#x xfer_size=%#x " \
DPRINTF(DMA, "Direct bypass startAddr=%#x xfer_size=%#x " \
"fifo_space=%#x block_remaining=%#x\n",
nextAddr, xfer_size, fifo_space, block_remaining);
proxy.readBlob(nextAddr, tmp_buffer.data(), xfer_size);
port.dmaAction(MemCmd::ReadReq, nextAddr, xfer_size, nullptr,
tmp_buffer.data(), 0, reqFlags);
buffer.write(tmp_buffer.begin(), xfer_size);
nextAddr += xfer_size;
}

View File

@@ -49,7 +49,6 @@
#include "base/circlebuf.hh"
#include "dev/io_device.hh"
#include "mem/backdoor.hh"
#include "mem/port_proxy.hh"
#include "params/DmaDevice.hh"
#include "sim/drain.hh"
#include "sim/system.hh"
@@ -508,7 +507,6 @@ class DmaReadFifo : public Drainable, public Serializable
const Request::Flags reqFlags;
DmaPort &port;
PortProxy proxy;
const int cacheLineSize;
@@ -554,8 +552,8 @@ class DmaReadFifo : public Drainable, public Serializable
/** Try to issue new DMA requests during normal execution*/
void resumeFillTiming();
/** Try to bypass DMA requests in KVM execution mode */
void resumeFillFunctional();
/** Try to bypass DMA requests in non-caching mode */
void resumeFillBypass();
private: // Internal state
Fifo<uint8_t> buffer;