Go to the documentation of this file.
40 #include "debug/SMMUv3.hh"
41 #include "debug/SMMUv3Hazard.hh"
54 pkt->
req->substreamId() : 0;
119 assert(!
"Stalls are broken");
124 DPRINTF(
SMMUv3,
"Resume at tick = %d. Fault duration = %d (%.3fus)\n",
146 panic(
"Transaction crosses 4k boundary (addr=%#x size=%#x)!\n",
168 bool wasPrefetched =
false;
227 panic(
"Translation Fault (addr=%#x, size=%#x, sid=%d, ssid=%d, "
228 "isWrite=%d, isPrefetch=%d, isAtsRequest=%d)\n",
262 bool haveConfig =
true;
323 DPRINTF(
SMMUv3,
"micro TLB miss vaddr=%#x sid=%#x ssid=%#x\n",
330 "micro TLB hit vaddr=%#x amask=%#x sid=%#x ssid=%#x paddr=%#x\n",
356 "RESPONSE Interface TLB miss vaddr=%#x sid=%#x ssid=%#x\n",
363 "RESPONSE Interface TLB hit vaddr=%#x amask=%#x sid=%#x ssid=%#x "
371 wasPrefetched =
e->prefetched;
389 DPRINTF(
SMMUv3,
"SMMU TLB miss vaddr=%#x asid=%#x vmid=%#x\n",
396 "SMMU TLB hit vaddr=%#x amask=%#x asid=%#x vmid=%#x paddr=%#x\n",
418 e.prefetched =
false;
423 e.pa = tr.
addr &
e.vaMask;
431 "micro TLB upd vaddr=%#x amask=%#x paddr=%#x sid=%#x ssid=%#x\n",
432 e.va,
e.vaMask,
e.pa,
e.sid,
e.ssid);
455 e.pa = tr.
addr &
e.vaMask;
468 "RESPONSE Interface upd vaddr=%#x amask=%#x paddr=%#x sid=%#x "
469 "ssid=%#x\n",
e.va,
e.vaMask,
e.pa,
e.sid,
e.ssid);
491 e.pa = tr.
addr &
e.vaMask;
497 "SMMU TLB upd vaddr=%#x amask=%#x paddr=%#x asid=%#x vmid=%#x\n",
498 e.va,
e.vaMask,
e.pa,
e.asid,
e.vmid);
524 DPRINTF(
SMMUv3,
"Config hit sid=%#x ssid=%#x ttb=%#08x asid=%#x\n",
606 panic(
"Bad or unimplemented STE config %d\n",
619 tc.
httb = 0xdeadbeef;
637 tc.
ttb0 = 0xcafebabe;
638 tc.
ttb1 = 0xcafed00d;
652 unsigned stage,
unsigned level)
654 const char *indent = stage==2 ?
" " :
"";
662 unsigned walkCacheLevels =
667 if ((1 <<
level) & walkCacheLevels) {
676 "base=%#x (S%d, L%d)\n",
691 unsigned stage,
unsigned level,
692 bool leaf, uint8_t permissions)
694 unsigned walkCacheLevels =
708 e.permissions = permissions;
712 DPRINTF(
SMMUv3,
"%sWalkCache upd va=%#x mask=%#x asid=%#x vmid=%#x "
713 "tpa=%#x leaf=%s (S%d, L%d)\n",
714 e.stage==2 ?
" " :
"",
715 e.va,
e.vaMask,
e.asid,
e.vmid,
716 e.pa,
e.leaf,
e.stage,
e.level);
749 level, pte, pte_addr);
833 level, pte, pte_addr);
921 table_addr = s2tr.
addr;
1011 e.ipa =
addr &
e.ipaMask;
1051 Addr other4k = (*it)->request.addr & ~0xfff
ULL;
1052 if (addr4k == other4k)
1062 DPRINTF(SMMUv3Hazard,
"4kReg: p=%p a4k=%#x\n",
1076 found_hazard =
false;
1082 Addr other4k = (*it)->request.addr & ~0xfff
ULL;
1084 DPRINTF(SMMUv3Hazard,
"4kHold: p=%p a4k=%#x Q: p=%p a4k=%#x\n",
1085 this, addr4k, *it, other4k);
1087 if (addr4k == other4k) {
1089 "4kHold: p=%p a4k=%#x WAIT on p=%p a4k=%#x\n",
1090 this, addr4k, *it, other4k);
1094 DPRINTF(SMMUv3Hazard,
"4kHold: p=%p a4k=%#x RESUME\n",
1099 found_hazard =
true;
1103 }
while (found_hazard);
1109 DPRINTF(SMMUv3Hazard,
"4kRel: p=%p a4k=%#x\n",
1119 panic(
"hazard4kRelease: request not found");
1138 depReqs.push_back(
this);
1156 found_hazard =
false;
1158 for (
auto it = depReqs.begin(); it!=depReqs.end() && *it!=
this; ++it) {
1159 DPRINTF(SMMUv3Hazard,
"IdHold: p=%p oid=%d Q: %p\n",
1163 DPRINTF(SMMUv3Hazard,
"IdHold: p=%p oid=%d WAIT on=%p\n",
1168 DPRINTF(SMMUv3Hazard,
"IdHold: p=%p oid=%d RESUME\n",
1173 found_hazard =
true;
1177 }
while (found_hazard);
1192 for (it = depReqs.begin(); it != depReqs.end(); ++it) {
1197 if (it == depReqs.end())
1198 panic(
"hazardIdRelease: request not found");
1258 panic(
"Not in atomic or timing mode");
1268 a.pkt->setAddr(tr.
addr);
1269 a.pkt->req->setPaddr(tr.
addr);
1305 panic(
"Event queue full - aborting\n");
1311 DPRINTF(
SMMUv3,
"Sending event to addr=%#08x (pos=%d): type=%#x stag=%#x "
1312 "flags=%#x sid=%#x ssid=%#x va=%#08x ipa=%#x\n",
1319 doWrite(yield, event_addr, &ev,
sizeof(ev));
1322 panic(
"eventq msi not enabled\n");
1335 panic(
"SID %#x out of range, max=%#x", sid, max_sid);
1343 if (split!= 7 && split!=8 && split!=16)
1344 panic(
"Invalid stream table split %d", split);
1349 bits(sid, 32, split) *
sizeof(l2_ptr);
1353 doReadConfig(yield, l2_addr, &l2_ptr,
sizeof(l2_ptr), sid, 0);
1355 DPRINTF(
SMMUv3,
"Got L1STE L1 at %#x: 0x%016x\n", l2_addr, l2_ptr);
1359 panic(
"Invalid level 1 stream table descriptor");
1363 panic(
"StreamID %d out of level 1 descriptor range %d",
1373 panic(
"Invalid stream table format");
1378 doReadConfig(yield, ste_addr, &ste,
sizeof(ste), sid, 0);
1380 DPRINTF(
SMMUv3,
"Got STE at %#x [0]: 0x%016x\n", ste_addr, ste.dw0);
1381 DPRINTF(
SMMUv3,
" STE at %#x [1]: 0x%016x\n", ste_addr, ste.dw1);
1382 DPRINTF(
SMMUv3,
" STE at %#x [2]: 0x%016x\n", ste_addr, ste.dw2);
1383 DPRINTF(
SMMUv3,
" STE at %#x [3]: 0x%016x\n", ste_addr, ste.dw3);
1390 panic(
"STE @ %#x not valid\n", ste_addr);
1399 uint32_t sid, uint32_t ssid)
1406 unsigned max_ssid = 1 << ste.dw0.
s1cdmax;
1407 if (ssid >= max_ssid)
1408 panic(
"SSID %#x out of range, max=%#x", ssid, max_ssid);
1417 bits(ssid, 24, split) *
sizeof(l2_ptr);
1424 doReadConfig(yield, l2_addr, &l2_ptr,
sizeof(l2_ptr), sid, ssid);
1426 DPRINTF(
SMMUv3,
"Got L1CD at %#x: 0x%016x\n", l2_addr, l2_ptr);
1428 cd_addr = l2_ptr +
bits(ssid, split-1, 0) *
sizeof(
cd);
1454 panic(
"CD @ %#x not valid\n", cd_addr);
1461 void *ptr,
size_t size,
1462 uint32_t sid, uint32_t ssid)
1469 void *ptr,
unsigned stage,
const Entry * lookup(uint32_t sid, uint32_t ssid, Addr va, bool updStats=true)
std::enable_if<!std::is_same< T, void >::value, T >::type get()
get() is the way we can extrapolate arguments from the coroutine caller.
const unsigned walkCacheS2Levels
void makeAtomicResponse()
void doReadCD(Yield &yield, ContextDescriptor &cd, const StreamTableEntry &ste, uint32_t sid, uint32_t ssid)
void makeTimingResponse()
const unsigned walkCacheS1Levels
const Entry * lookup(Addr va, Addr vaMask, uint16_t asid, uint16_t vmid, unsigned stage, unsigned level, bool updStats=true)
bool isTimingMode() const
Is the system in timing mode?
const Entry * lookup(Addr ipa, uint16_t vmid, bool updStats=true)
virtual Addr index(Addr va, unsigned level) const =0
void completeTransaction(Yield &yield, const TranslResult &tr)
const bool ipaCacheEnable
CallerType: A reference to an object of this class will be passed to the coroutine task.
const bool prefetchReserveLastWay
void store(const Entry &incoming)
const bool configCacheEnable
unsigned wrBufSlotsRemaining
static SMMUTranslRequest prefetch(Addr addr, uint32_t sid, uint32_t ssid)
virtual unsigned lastLevel() const =0
Tick M5_CLASS_VAR_USED faultTick
const PageTableOps * getPageTableOps(uint8_t trans_granule)
uint64_t Tick
Tick count type.
void issuePrefetch(Addr addr)
bool ifcTLBLookup(Yield &yield, TranslResult &tr, bool &wasPrefetched)
void store(const Entry &incoming)
RequestPtr req
A pointer to the original request.
TranslResult walkStage1And2(Yield &yield, Addr addr, const PageTableOps *pt_ops, unsigned level, Addr walkPtr)
void scheduleDeviceRetries()
TranslResult walkStage2(Yield &yield, Addr addr, bool final_tr, const PageTableOps *pt_ops, unsigned level, Addr walkPtr)
SMMUAction runProcessTiming(SMMUProcess *proc, PacketPtr pkt)
void store(const Entry &incoming)
void doReadPTE(Yield &yield, Addr va, Addr addr, void *ptr, unsigned stage, unsigned level)
Bitfield< 51, 6 > s1ctxptr
const bool walkCacheEnable
void microTLBUpdate(Yield &yield, const TranslResult &tr)
const Entry * lookup(Addr va, uint16_t asid, uint16_t vmid, bool updStats=true)
void configCacheUpdate(Yield &yield, const TranslContext &tc)
virtual Addr pageMask(pte_t pte, unsigned level) const =0
bool configCacheLookup(Yield &yield, TranslContext &tc)
@ STE_CONFIG_STAGE1_AND_2
void doBroadcastSignal(SMMUSignal &sig)
SMMUTranslRequest request
SMMUSemaphore devicePortSem
void doWrite(Yield &yield, Addr addr, const void *ptr, size_t size)
SMMUv3DeviceInterface & ifc
virtual ~SMMUTranslationProcess()
TranslResult translateStage2(Yield &yield, Addr addr, bool final_tr)
virtual unsigned firstLevel(uint8_t tsz) const =0
SMMUSemaphore microTLBSem
bool hazard4kCheck()
Used to force ordering on transactions with same (SID, SSID, 4k page) to avoid multiple identical pag...
static SMMUTranslRequest fromPacket(PacketPtr pkt, bool ats=false)
void ifcTLBUpdate(Yield &yield, const TranslResult &tr)
bool findConfig(Yield &yield, TranslContext &tc, TranslResult &tr)
unsigned pendingMemAccesses
Stats::Distribution translationTimeDist
void walkCacheLookup(Yield &yield, const WalkCache::Entry *&walkEntry, Addr addr, uint16_t asid, uint16_t vmid, unsigned stage, unsigned level)
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
void completePrefetch(Yield &yield)
Bitfield< 63, 59 > s1cdmax
const Entry * lookup(uint32_t sid, uint32_t ssid, bool updStats=true)
void doRead(Yield &yield, Addr addr, void *ptr, size_t size)
static OrderID orderId(PacketPtr pkt)
SMMUSignal dependentReqRemoved
void scheduleWakeup(Tick when)
void hazard4kHold(Yield &yield)
virtual void main(Yield &yield)
virtual bool isValid(pte_t pte, unsigned level) const =0
void store(const Entry &incoming)
void smmuTLBUpdate(Yield &yield, const TranslResult &tr)
void signalDrainDone() const
Signal that an object is drained.
void doSemaphoreUp(SMMUSemaphore &sem)
const unsigned requestPortWidth
void sendEvent(Yield &yield, const SMMUEvent &ev)
void doReadSTE(Yield &yield, StreamTableEntry &ste, uint32_t sid)
const bool prefetchEnable
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
const std::string & name()
void setAddr(Addr _addr)
Update the address of this packet mid-transaction.
Bitfield< 37, 32 > s2t0sz
virtual Addr nextLevelPointer(pte_t pte, unsigned level) const =0
SMMUSemaphore requestPortSem
std::list< SMMUTranslationProcess * > duplicateReqs
TranslResult bypass(Addr addr) const
const bool microTLBEnable
void doReadConfig(Yield &yield, Addr addr, void *ptr, size_t size, uint32_t sid, uint32_t ssid)
void hazardIdHold(Yield &yield)
Stats::Scalar steL1Fetches
virtual bool isWritable(pte_t pte, unsigned level, bool stage2) const =0
SMMUSignal duplicateReqRemoved
void store(const Entry &incoming, AllocPolicy alloc)
unsigned xlateSlotsRemaining
bool smmuTLBLookup(Yield &yield, TranslResult &tr)
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void doSemaphoreDown(Yield &yield, SMMUSemaphore &sem)
std::list< SMMUTranslationProcess * > dependentWrites[SMMU_MAX_TRANS_ID]
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Cycles is a wrapper class for representing cycle counts, i.e.
TranslResult translateStage1And2(Yield &yield, Addr addr)
uint8_t stage1TranslGranule
void hazardIdRegister()
Used to force ordering on transactions with the same orderId.
uint8_t stage2TranslGranule
bool microTLBLookup(Yield &yield, TranslResult &tr)
virtual bool isLeaf(pte_t pte, unsigned level) const =0
void walkCacheUpdate(Yield &yield, Addr va, Addr vaMask, Addr pa, unsigned stage, unsigned level, bool leaf, uint8_t permissions)
void beginTransaction(const SMMUTranslRequest &req)
virtual Addr walkMask(unsigned level) const =0
void doDelay(Yield &yield, Cycles cycles)
void doWaitForSignal(Yield &yield, SMMUSignal &sig)
TranslResult smmuTranslation(Yield &yield)
bool isAtomicMode() const
Is the system in atomic mode?
SMMUTranslationProcess(const std::string &name, SMMUv3 &_smmu, SMMUv3DeviceInterface &_ifc)
std::string csprintf(const char *format, const Args &...args)
TranslResult combineTranslations(const TranslResult &s1tr, const TranslResult &s2tr) const
const std::string name() const
Stats::Distribution ptwTimeDist
#define ULL(N)
uint64_t constant
Stats::Scalar cdL1Fetches
std::list< SMMUTranslationProcess * > dependentReads[SMMU_MAX_TRANS_ID]
const bool walkCacheNonfinalEnable
#define panic(...)
This implements a cprintf based panic() function.
Tick curTick()
The current simulated tick.
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Generated on Wed Sep 30 2020 14:02:10 for gem5 by doxygen 1.8.17