mem: Make the FSTranslatingPortProxy stop using vtophys.
That was the only place vtophys was still being used. Instead, use the data TLB to translate functional, and if that fails try the the instruction TLB. Change-Id: Ie5e1e1b5d470f010e25482d785f111dc4292db60 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26233 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -45,27 +45,38 @@
|
||||
|
||||
#include "mem/fs_translating_port_proxy.hh"
|
||||
|
||||
#include "arch/vtophys.hh"
|
||||
#include "arch/generic/tlb.hh"
|
||||
#include "base/chunk_generator.hh"
|
||||
#include "cpu/base.hh"
|
||||
#include "cpu/thread_context.hh"
|
||||
#include "sim/system.hh"
|
||||
|
||||
FSTranslatingPortProxy::FSTranslatingPortProxy(ThreadContext *tc)
|
||||
: PortProxy(tc->getCpuPtr()->getSendFunctional(),
|
||||
tc->getSystemPtr()->cacheLineSize()), _tc(tc)
|
||||
{
|
||||
}
|
||||
FSTranslatingPortProxy::FSTranslatingPortProxy(ThreadContext *tc) :
|
||||
PortProxy(tc->getCpuPtr()->getSendFunctional(),
|
||||
tc->getSystemPtr()->cacheLineSize()), _tc(tc),
|
||||
pageBytes(tc->getSystemPtr()->getPageBytes())
|
||||
{}
|
||||
|
||||
bool
|
||||
FSTranslatingPortProxy::tryReadBlob(Addr addr, void *p, int size) const
|
||||
{
|
||||
for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
|
||||
BaseTLB *dtb = _tc->getDTBPtr();
|
||||
BaseTLB *itb = _tc->getDTBPtr();
|
||||
|
||||
for (ChunkGenerator gen(addr, size, pageBytes); !gen.done();
|
||||
gen.next())
|
||||
{
|
||||
Addr paddr = TheISA::vtophys(_tc, gen.addr());
|
||||
auto req = std::make_shared<Request>(
|
||||
gen.addr(), gen.size(), 0, Request::funcMasterId, 0,
|
||||
_tc->contextId());
|
||||
if (dtb->translateFunctional(req, _tc, BaseTLB::Read) != NoFault &&
|
||||
itb->translateFunctional(req, _tc, BaseTLB::Read) != NoFault) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PortProxy::readBlobPhys(
|
||||
req->getPaddr(), req->getFlags(), p, gen.size());
|
||||
|
||||
PortProxy::readBlobPhys(paddr, 0, p, gen.size());
|
||||
p = static_cast<uint8_t *>(p) + gen.size();
|
||||
}
|
||||
return true;
|
||||
@@ -75,12 +86,22 @@ bool
|
||||
FSTranslatingPortProxy::tryWriteBlob(
|
||||
Addr addr, const void *p, int size) const
|
||||
{
|
||||
for (ChunkGenerator gen(addr, size, TheISA::PageBytes); !gen.done();
|
||||
BaseTLB *dtb = _tc->getDTBPtr();
|
||||
BaseTLB *itb = _tc->getDTBPtr();
|
||||
|
||||
for (ChunkGenerator gen(addr, size, pageBytes); !gen.done();
|
||||
gen.next())
|
||||
{
|
||||
Addr paddr = TheISA::vtophys(_tc, gen.addr());
|
||||
auto req = std::make_shared<Request>(
|
||||
gen.addr(), gen.size(), 0, Request::funcMasterId, 0,
|
||||
_tc->contextId());
|
||||
if (dtb->translateFunctional(req, _tc, BaseTLB::Write) != NoFault &&
|
||||
itb->translateFunctional(req, _tc, BaseTLB::Write) != NoFault) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PortProxy::writeBlobPhys(paddr, 0, p, gen.size());
|
||||
PortProxy::writeBlobPhys(
|
||||
req->getPaddr(), req->getFlags(), p, gen.size());
|
||||
p = static_cast<const uint8_t *>(p) + gen.size();
|
||||
}
|
||||
return true;
|
||||
@@ -89,12 +110,22 @@ FSTranslatingPortProxy::tryWriteBlob(
|
||||
bool
|
||||
FSTranslatingPortProxy::tryMemsetBlob(Addr address, uint8_t v, int size) const
|
||||
{
|
||||
for (ChunkGenerator gen(address, size, TheISA::PageBytes); !gen.done();
|
||||
BaseTLB *dtb = _tc->getDTBPtr();
|
||||
BaseTLB *itb = _tc->getDTBPtr();
|
||||
|
||||
for (ChunkGenerator gen(address, size, pageBytes); !gen.done();
|
||||
gen.next())
|
||||
{
|
||||
Addr paddr = TheISA::vtophys(_tc, gen.addr());
|
||||
auto req = std::make_shared<Request>(
|
||||
gen.addr(), gen.size(), 0, Request::funcMasterId, 0,
|
||||
_tc->contextId());
|
||||
if (dtb->translateFunctional(req, _tc, BaseTLB::Write) != NoFault &&
|
||||
itb->translateFunctional(req, _tc, BaseTLB::Write) != NoFault) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PortProxy::memsetBlobPhys(paddr, 0, v, gen.size());
|
||||
PortProxy::memsetBlobPhys(
|
||||
req->getPaddr(), req->getFlags(), v, gen.size());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ class FSTranslatingPortProxy : public PortProxy
|
||||
{
|
||||
private:
|
||||
ThreadContext* _tc;
|
||||
const Addr pageBytes;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user