41 #ifndef __ARCH_ARM_TABLE_WALKER_HH__
42 #define __ARCH_ARM_TABLE_WALKER_HH__
50 #include "params/ArmTableWalker.hh"
74 virtual bool xn()
const = 0;
75 virtual uint8_t
ap()
const = 0;
79 virtual std::string
dbgHeader()
const = 0;
83 panic(
"texcb() not implemented for this class\n");
87 panic(
"shareable() not implemented for this class\n");
121 return "Inserting Section Descriptor into TLB\n";
144 panic(
"Super sections not implemented\n");
151 panic(
"Super sections not implemented\n");
160 panic(
"Super sections not implemented\n");
271 return "Inserting L2 Descriptor into TLB\n";
286 return large() ? 16 : 12;
400 return "Inserting Page descriptor into TLB\n";
403 return "Inserting Block descriptor into TLB\n";
453 panic(
"Invalid AArch64 VM granule size\n");
462 panic(
"Invalid AArch64 VM granule size\n");
465 panic(
"AArch64 page table entry must be block or page\n");
512 int va_hi = va_lo + stride - 1;
551 }
else if (currState->
aarch64) {
552 if (currState->
el ==
EL2 || currState->
el ==
EL3) {
603 return ((!rw) << 2) | (user << 1);
887 void init()
override;
904 bool timing,
bool functional,
bool secure,
911 uint8_t texcb,
bool s);
913 LongDescriptor &lDescriptor);
915 LongDescriptor &lDescriptor);
977 #endif //__ARCH_ARM_TABLE_WALKER_HH__
uint8_t ap() const
Three bit access protection flags.
void regStats() override
Register statistics for this object.
EventWrapper< TableWalker,&TableWalker::doL2LongDescriptorWrapper > doL2LongDescEvent
void memAttrsLPAE(ThreadContext *tc, TlbEntry &te, LongDescriptor &lDescriptor)
bool global(WalkerState *currState) const
Is the translation global (no asid used)?
bool global(WalkerState *currState) const
Is the translation global (no asid used)?
void doL2DescriptorWrapper()
EntryType type() const
Return the descriptor type.
Addr pfn() const
Return the physical frame, bits shifted right.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
uint8_t attrIndx() const
Attribute index.
bool isFetch
If the access is a fetch (for execution, and no-exec) must be checked?
LookupLevel lookupLevel
Current lookup level for this descriptor.
bool doingStage2
Indicates whether the translation has been passed onto the second stage mmu, and no more work is requ...
virtual uint64_t getRawData() const
L1Descriptor()
Default ctor.
virtual TlbEntry::DomainType domain() const =0
EventWrapper< TableWalker,&TableWalker::processWalkWrapper > doProcessEvent
uint32_t data
The raw bits of the entry.
virtual Addr pfn() const =0
const PortID InvalidPortID
DrainState
Object drain/handover states.
void doL3LongDescriptorWrapper()
unsigned numSquashable
The number of walks belonging to squashed instructions that can be removed from the pendingQueue per ...
Addr l2Addr() const
Address of L2 descriptor if it exists.
std::list< WalkerState * > stateQueues[MAX_LOOKUP_LEVELS]
Queues of requests for all the different lookup levels.
TableWalker * tableWalker
GrainSize grainSize
Width of the granule size in bits.
bool pending
If a timing translation is currently in progress.
Addr paddr(Addr va) const
Return the complete physical address given a VA.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
Bitfield< 21, 20 > stride
static uint8_t pageSizeNtoStatBin(uint8_t N)
Stats::Vector statWalksShortTerminatedAtLevel
Fault testWalk(Addr pa, Addr size, TlbEntry::DomainType domain, LookupLevel lookup_level)
TableWalker(const Params *p)
bool isWrite
If the access is a write.
Stats::Histogram statPendingWalks
DrainState drain() override
Notify an object that it needs to drain its state.
bool haveSecurity
Cached copies of system-level properties.
bool af() const
Returns true if the access flag (AF) is set.
Stats::Scalar statWalksShortDescriptor
bool timing
If the mode is timing or atomic.
Stats::Scalar statSquashedBefore
A vector of scalar stats.
void processWalkWrapper()
uint8_t offsetBits() const
Return the bit width of the page/block offset.
CPSR cpsr
Cached copy of the cpsr as it existed when translation began.
bool stage2Req
Flag indicating if a second stage of lookup is required.
bool haveVirtualization() const
bool shareable() const
If the section is shareable.
TLB::Translation * transState
Translation state for delayed requests.
HTCR htcr
Cached copy of the htcr as it existed when translation began.
void doL2LongDescriptorWrapper()
bool user() const
User/privileged level access protection flag.
Addr paddr() const
Return the physcal address of the entry, bits in position.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
This is a simple scalar statistic, like a counter.
Addr vaddr
The virtual address that is being translated with tagging removed.
virtual bool secure(bool have_security, WalkerState *currState) const =0
DmaPort * port
Port shared by the two table walkers.
uint8_t memAttr() const
Memory attributes, only used by stage 2 translations.
void memAttrs(ThreadContext *tc, TlbEntry &te, SCTLR sctlr, uint8_t texcb, bool s)
Addr paddr(Addr va) const
Return complete physical address given a VA.
bool xnTable() const
Is execution allowed on subsequent lookup levels?
bool large() const
What is the size of the mapping?
bool xn() const
Is execution allowed on this mapping?
virtual uint8_t offsetBits() const =0
uint8_t ap() const
Three bit access protection flags.
EventWrapper< TableWalker,&TableWalker::doL1DescriptorWrapper > doL1DescEvent
HCR hcr
Cached copy of the htcr as it existed when translation began.
bool xn() const
Is the translation not allow execution?
MasterID masterId
Master id assigned by the MMU.
Stats::Vector statWalksLongTerminatedAtLevel
bool secure(bool have_security, WalkerState *currState) const
Returns true if this entry targets the secure physical address map.
void insertTableEntry(DescriptorBase &descriptor, bool longDescriptor)
int physAddrRange
Current physical address range in bits.
Fault fault
The fault that we are going to return.
bool invalid() const
Is the entry invalid.
static LookupLevel toLookupLevel(uint8_t lookup_level_as_int)
virtual bool xn() const =0
bool supersection() const
Is the page a Supersection (16MB)?
uint64_t Tick
Tick count type.
static uint8_t ap(bool rw, bool user)
Return the AP bits as compatible with the AP[2:0] format.
bool _dirty
This entry has been modified (access flag set) and needs to be written back to memory.
bool pxn() const
Is privileged execution allowed on this mapping? (LPAE only)
void setMMU(Stage2MMU *m, MasterID master_id)
ExceptionLevel el
Current exception level.
void doL1LongDescriptorWrapper()
bool shareable() const
If the section is shareable.
bool isSecure
If the access comes from the secure state.
TlbEntry::DomainType domain() const
virtual uint8_t texcb() const
bool fetchDescriptor(Addr descAddr, uint8_t *data, int numBytes, Request::Flags flags, int queueIndex, Event *event, void(TableWalker::*doDescriptor)())
void doLongDescriptorWrapper(LookupLevel curr_lookup_level)
Event * LongDescEventByLevel[4]
bool contiguousHint() const
Contiguous hint bit.
Stats::Histogram statWalkServiceTime
TLB::ArmTranslationType tranType
The translation type that has been requested.
bool functional
If the atomic mode should be functional.
SCTLR sctlr
Cached copy of the sctlr as it existed when translation began.
void doL0LongDescriptorWrapper()
virtual bool global(WalkerState *currState) const =0
Addr nextDescAddr(Addr va) const
Return the address of the next descriptor.
static unsigned adjustTableSizeAArch64(unsigned tsz)
uint8_t sh() const
2-bit shareability field
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint8_t userTable() const
User/privileged mode protection flag for subsequent levels of lookup.
TlbEntry::DomainType domain() const
Domain Client/Manager: ARM DDI 0406B: B3-31.
uint8_t rwTable() const
R/W protection flag for subsequent levels of lookup.
Addr paddr() const
Return the physical address of the entry.
bool pxnTable() const
Is privileged execution allowed on subsequent lookup levels?
bool dirty() const
This entry needs to be written back to memory.
void completeDrain()
Checks if all state is cleared and if so, completes drain.
SCTLR sctlr
Cached copy of the sctlr as it existed when translation began.
bool secure(bool have_security, WalkerState *currState) const
bool rw() const
Read/write access protection flag.
bool _dirty
This entry has been modified (access flag set) and needs to be written back to memory.
Stats::Histogram statWalkWaitTime
const Params * params() const
L2Descriptor()
Default ctor.
Stats::Scalar statSquashedAfter
static const unsigned REQUESTED
TLB * tlb
TLB that is initiating these table walks.
bool dirty() const
This entry needs to be written back to memory.
SCR scr
Cached copy of the scr as it existed when translation began.
void drainResume() override
Resume execution after a successful drain.
Addr pfn() const
Return the physical frame, bits shifted right.
virtual uint8_t ap() const =0
EventWrapper< TableWalker,&TableWalker::doL3LongDescriptorWrapper > doL3LongDescEvent
Addr paddr(Addr va) const
Return the physcal address of the entry, bits in position.
std::list< WalkerState * > pendingQueue
Queue of requests that have passed are waiting because the walker is currently busy.
Tick startTime
Timestamp for calculating elapsed time in service (for stats)
Stats::Scalar statWalks
Statistics.
virtual const std::string name() const
uint64_t data
The raw bits of the entry.
ThreadContext * tc
Thread context that we're doing the walk for.
static const unsigned COMPLETED
Addr pfn() const
Return the physical frame, bits shifted right.
virtual uint64_t getRawData() const =0
bool xn() const
Is execution allowed on this mapping?
virtual uint8_t offsetBits() const
Fault walk(RequestPtr req, ThreadContext *tc, uint16_t asid, uint8_t _vmid, bool _isHyp, TLB::Mode mode, TLB::Translation *_trans, bool timing, bool functional, bool secure, TLB::ArmTranslationType tranType, bool _stage2Req)
EventWrapper< TableWalker,&TableWalker::doL0LongDescriptorWrapper > doL0LongDescEvent
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
LongDescriptor longDesc
Long-format descriptor (LPAE and AArch64)
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
unsigned levels
Page entries walked during service (for stats)
Level 2 page table descriptor.
uint8_t apTable() const
Two bit access protection flags for subsequent levels of lookup.
const SimObjectParams * _params
Cached copy of the object parameters.
void doL1DescriptorWrapper()
BaseTLB::Mode mode
Save mode for use in delayed response.
uint8_t texcb() const
Memory region attributes: ARM DDI 0406B: B3-32.
uint16_t asid
ASID that we're servicing the request under.
Stats::Scalar statWalksLongDescriptor
VTCR_t vtcr
Cached copy of the vtcr as it existed when translation began.
Stats::Vector2d statRequestOrigin
EventWrapper< TableWalker,&TableWalker::doL1LongDescriptorWrapper > doL1LongDescEvent
virtual bool shareable() const
L1Descriptor l1Desc
Short-format descriptors.
void nextWalk(ThreadContext *tc)
virtual std::string dbgHeader() const
uint32_t data
The raw bits of the entry.
virtual std::string dbgHeader() const =0
bool dirty() const
This entry needs to be written back to memory.
bool secureTable() const
Whether the subsequent levels of lookup are secure.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
EntryType
Descriptor type.
EventWrapper< TableWalker,&TableWalker::doL2DescriptorWrapper > doL2DescEvent
L2Descriptor(L1Descriptor &parent)
bool secureLookup
Helper variables used to implement hierarchical access permissions when the long-desc.
Stage2MMU * stage2Mmu
The MMU to forward second stage look upts to.
A 2-Dimensional vecto of scalar stats.
virtual TlbEntry::DomainType domain() const
EntryType
Type of page table entry ARM DDI 0406B: B3-8.
bool aarch64
True if the current lookup is performed in AArch64 state.
virtual uint64_t getRawData() const
T mbits(T val, int first, int last)
Mask off the given bits in place like bits() but without shifting.
bool aarch64
If the access is performed in AArch64 state.
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
bool secure(bool have_security, WalkerState *currState) const
Returns true if this entry targets the secure physical address map.
Fault processWalkAArch64()
ArmTableWalkerParams Params
const bool isStage2
Indicates whether this table walker is part of the stage 2 mmu.
virtual uint8_t offsetBits() const
Addr nextTableAddr() const
Return the address of the next page table.
void setAp0()
Set access flag that this entry has been touched.
static bool checkAddrSizeFaultAArch64(Addr addr, int currPhysAddrRange)
Returns true if the address exceeds the range permitted by the system-wide setting or by the TCR_ELx ...
virtual std::string dbgHeader() const
bool haveLargeAsid64() const
virtual uint64_t getRawData() const
virtual std::string dbgHeader() const
std::shared_ptr< FaultBase > Fault
Long-descriptor format (LPAE)
void setAf()
Set access flag that this entry has been touched.
uint8_t ap() const
2-bit access protection flags
void memAttrsAArch64(ThreadContext *tc, TlbEntry &te, LongDescriptor &lDescriptor)
BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a master port with a given name and index.
Addr vaddr_tainted
The virtual address that is being translated.
RequestPtr req
Request that is currently being serviced.
bool delayed
Whether the response is delayed in timing mode due to additional lookups.
void setAp0()
Set access flag that this entry has been touched.
TLB::Translation * stage2Tran
A pointer to the stage 2 translation that's in progress.
Stats::Vector statPageSizes
bool global(WalkerState *currState) const
Is the translation global (no asid used)?
bool _dirty
This entry has been modified (access flag set) and needs to be written back to memory.
uint8_t texcb() const
Memory region attributes: ARM DDI 0406B: B3-32.