2 * Copyright (c) 2010-2013, 2016-2019 ARM Limited
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
14 * Copyright (c) 2001-2005 The Regents of The University of Michigan
15 * All rights reserved.
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 #include "arch/arm/tlb.hh"
51 #include "arch/arm/faults.hh"
52 #include "arch/arm/pagetable.hh"
53 #include "arch/arm/stage2_lookup.hh"
54 #include "arch/arm/stage2_mmu.hh"
55 #include "arch/arm/system.hh"
56 #include "arch/arm/table_walker.hh"
57 #include "arch/arm/utility.hh"
58 #include "base/inifile.hh"
59 #include "base/str.hh"
60 #include "base/trace.hh"
61 #include "cpu/base.hh"
62 #include "cpu/thread_context.hh"
63 #include "debug/Checkpoint.hh"
64 #include "debug/TLB.hh"
65 #include "debug/TLBVerbose.hh"
66 #include "mem/page_table.hh"
67 #include "mem/request.hh"
68 #include "params/ArmTLB.hh"
69 #include "sim/full_system.hh"
70 #include "sim/process.hh"
73 using namespace ArmISA
;
75 TLB::TLB(const ArmTLBParams
*p
)
76 : BaseTLB(p
), table(new TlbEntry
[p
->size
]), size(p
->size
),
77 isStage2(p
->is_stage2
), stage2Req(false), stage2DescReq(false), _attr(0),
78 directToStage2(false), tableWalker(p
->walker
), stage2Tlb(NULL
),
79 stage2Mmu(NULL
), test(nullptr), rangeMRU(1),
80 aarch64(false), aarch64EL(EL0
), isPriv(false), isSecure(false),
81 isHyp(false), asid(0), vmid(0), hcr(0), dacr(0),
82 miscRegValid(false), miscRegContext(0), curTranType(NormalTran
)
84 const ArmSystem
*sys
= dynamic_cast<const ArmSystem
*>(p
->sys
);
86 tableWalker
->setTlb(this);
88 // Cache system-level properties
89 haveLPAE
= tableWalker
->haveLPAE();
90 haveVirtualization
= tableWalker
->haveVirtualization();
91 haveLargeAsid64
= tableWalker
->haveLargeAsid64();
94 m5opRange
= sys
->m5opRange();
105 if (stage2Mmu
&& !isStage2
)
106 stage2Tlb
= stage2Mmu
->stage2Tlb();
110 TLB::setMMU(Stage2MMU
*m
, MasterID master_id
)
113 tableWalker
->setMMU(m
, master_id
);
117 TLB::translateFunctional(ThreadContext
*tc
, Addr va
, Addr
&pa
)
121 if (directToStage2
) {
123 return stage2Tlb
->translateFunctional(tc
, va
, pa
);
126 TlbEntry
*e
= lookup(va
, asid
, vmid
, isHyp
, isSecure
, true, false,
127 aarch64
? aarch64EL
: EL1
);
135 TLB::finalizePhysical(const RequestPtr
&req
,
136 ThreadContext
*tc
, Mode mode
) const
138 const Addr paddr
= req
->getPaddr();
140 if (m5opRange
.contains(paddr
))
141 req
->setFlags(Request::MMAPPED_IPR
);
147 TLB::lookup(Addr va
, uint16_t asn
, uint8_t vmid
, bool hyp
, bool secure
,
148 bool functional
, bool ignore_asn
, ExceptionLevel target_el
)
151 TlbEntry
*retval
= NULL
;
153 // Maintaining LRU array
155 while (retval
== NULL
&& x
< size
) {
156 if ((!ignore_asn
&& table
[x
].match(va
, asn
, vmid
, hyp
, secure
, false,
158 (ignore_asn
&& table
[x
].match(va
, vmid
, hyp
, secure
, target_el
))) {
159 // We only move the hit entry ahead when the position is higher
161 if (x
> rangeMRU
&& !functional
) {
162 TlbEntry tmp_entry
= table
[x
];
163 for (int i
= x
; i
> 0; i
--)
164 table
[i
] = table
[i
- 1];
165 table
[0] = tmp_entry
;
175 DPRINTF(TLBVerbose
, "Lookup %#x, asn %#x -> %s vmn 0x%x hyp %d secure %d "
176 "ppn %#x size: %#x pa: %#x ap:%d ns:%d nstid:%d g:%d asid: %d "
178 va
, asn
, retval
? "hit" : "miss", vmid
, hyp
, secure
,
179 retval
? retval
->pfn
: 0, retval
? retval
->size
: 0,
180 retval
? retval
->pAddr(va
) : 0, retval
? retval
->ap
: 0,
181 retval
? retval
->ns
: 0, retval
? retval
->nstid
: 0,
182 retval
? retval
->global
: 0, retval
? retval
->asid
: 0,
183 retval
? retval
->el
: 0);
188 // insert a new TLB entry
190 TLB::insert(Addr addr
, TlbEntry
&entry
)
192 DPRINTF(TLB
, "Inserting entry into TLB with pfn:%#x size:%#x vpn: %#x"
193 " asid:%d vmid:%d N:%d global:%d valid:%d nc:%d xn:%d"
194 " ap:%#x domain:%#x ns:%d nstid:%d isHyp:%d\n", entry
.pfn
,
195 entry
.size
, entry
.vpn
, entry
.asid
, entry
.vmid
, entry
.N
,
196 entry
.global
, entry
.valid
, entry
.nonCacheable
, entry
.xn
,
197 entry
.ap
, static_cast<uint8_t>(entry
.domain
), entry
.ns
, entry
.nstid
,
200 if (table
[size
- 1].valid
)
201 DPRINTF(TLB
, " - Replacing Valid entry %#x, asn %d vmn %d ppn %#x "
202 "size: %#x ap:%d ns:%d nstid:%d g:%d isHyp:%d el: %d\n",
203 table
[size
-1].vpn
<< table
[size
-1].N
, table
[size
-1].asid
,
204 table
[size
-1].vmid
, table
[size
-1].pfn
<< table
[size
-1].N
,
205 table
[size
-1].size
, table
[size
-1].ap
, table
[size
-1].ns
,
206 table
[size
-1].nstid
, table
[size
-1].global
, table
[size
-1].isHyp
,
209 //inserting to MRU position and evicting the LRU one
211 for (int i
= size
- 1; i
> 0; --i
)
212 table
[i
] = table
[i
-1];
216 ppRefills
->notify(1);
220 TLB::printTlb() const
224 DPRINTF(TLB
, "Current TLB contents:\n");
228 DPRINTF(TLB
, " * %s\n", te
->print());
234 TLB::flushAllSecurity(bool secure_lookup
, ExceptionLevel target_el
,
237 DPRINTF(TLB
, "Flushing all TLB entries (%s lookup)\n",
238 (secure_lookup
? "secure" : "non-secure"));
243 const bool el_match
= ignore_el
?
244 true : te
->checkELMatch(target_el
);
246 if (te
->valid
&& secure_lookup
== !te
->nstid
&&
247 (te
->vmid
== vmid
|| secure_lookup
) && el_match
) {
249 DPRINTF(TLB
, " - %s\n", te
->print());
258 // If there's a second stage TLB (and we're not it) then flush it as well
259 // if we're currently in hyp mode
260 if (!isStage2
&& isHyp
) {
261 stage2Tlb
->flushAllSecurity(secure_lookup
, EL1
, true);
266 TLB::flushAllNs(ExceptionLevel target_el
, bool ignore_el
)
268 bool hyp
= target_el
== EL2
;
270 DPRINTF(TLB
, "Flushing all NS TLB entries (%s lookup)\n",
271 (hyp
? "hyp" : "non-hyp"));
276 const bool el_match
= ignore_el
?
277 true : te
->checkELMatch(target_el
);
279 if (te
->valid
&& te
->nstid
&& te
->isHyp
== hyp
&& el_match
) {
281 DPRINTF(TLB
, " - %s\n", te
->print());
290 // If there's a second stage TLB (and we're not it) then flush it as well
291 if (!isStage2
&& !hyp
) {
292 stage2Tlb
->flushAllNs(EL1
, true);
297 TLB::flushMvaAsid(Addr mva
, uint64_t asn
, bool secure_lookup
,
298 ExceptionLevel target_el
)
300 DPRINTF(TLB
, "Flushing TLB entries with mva: %#x, asid: %#x "
301 "(%s lookup)\n", mva
, asn
, (secure_lookup
?
302 "secure" : "non-secure"));
303 _flushMva(mva
, asn
, secure_lookup
, false, target_el
);
308 TLB::flushAsid(uint64_t asn
, bool secure_lookup
, ExceptionLevel target_el
)
310 DPRINTF(TLB
, "Flushing TLB entries with asid: %#x (%s lookup)\n", asn
,
311 (secure_lookup
? "secure" : "non-secure"));
318 if (te
->valid
&& te
->asid
== asn
&& secure_lookup
== !te
->nstid
&&
319 (te
->vmid
== vmid
|| secure_lookup
) &&
320 te
->checkELMatch(target_el
)) {
323 DPRINTF(TLB
, " - %s\n", te
->print());
332 TLB::flushMva(Addr mva
, bool secure_lookup
, ExceptionLevel target_el
)
334 DPRINTF(TLB
, "Flushing TLB entries with mva: %#x (%s lookup)\n", mva
,
335 (secure_lookup
? "secure" : "non-secure"));
336 _flushMva(mva
, 0xbeef, secure_lookup
, true, target_el
);
341 TLB::_flushMva(Addr mva
, uint64_t asn
, bool secure_lookup
,
342 bool ignore_asn
, ExceptionLevel target_el
)
345 // D5.7.2: Sign-extend address to 64 bits
348 bool hyp
= target_el
== EL2
;
350 te
= lookup(mva
, asn
, vmid
, hyp
, secure_lookup
, false, ignore_asn
,
353 if (secure_lookup
== !te
->nstid
) {
354 DPRINTF(TLB
, " - %s\n", te
->print());
358 te
= lookup(mva
, asn
, vmid
, hyp
, secure_lookup
, false, ignore_asn
,
364 TLB::flushIpaVmid(Addr ipa
, bool secure_lookup
, ExceptionLevel target_el
)
367 stage2Tlb
->_flushMva(ipa
, 0xbeef, secure_lookup
, true, target_el
);
373 // We might have unserialized something or switched CPUs, so make
374 // sure to re-read the misc regs.
375 miscRegValid
= false;
379 TLB::takeOverFrom(BaseTLB
*_otlb
)
381 TLB
*otlb
= dynamic_cast<TLB
*>(_otlb
);
382 /* Make sure we actually have a valid type */
385 haveLPAE
= otlb
->haveLPAE
;
386 directToStage2
= otlb
->directToStage2
;
387 stage2Req
= otlb
->stage2Req
;
388 stage2DescReq
= otlb
->stage2DescReq
;
390 /* Sync the stage2 MMU if they exist in both
391 * the old CPU and the new
394 stage2Tlb
&& otlb
->stage2Tlb
) {
395 stage2Tlb
->takeOverFrom(otlb
->stage2Tlb
);
398 panic("Incompatible TLB type!");
407 .name(name() + ".inst_hits")
408 .desc("ITB inst hits")
412 .name(name() + ".inst_misses")
413 .desc("ITB inst misses")
417 .name(name() + ".inst_accesses")
418 .desc("ITB inst accesses")
422 .name(name() + ".read_hits")
423 .desc("DTB read hits")
427 .name(name() + ".read_misses")
428 .desc("DTB read misses")
432 .name(name() + ".read_accesses")
433 .desc("DTB read accesses")
437 .name(name() + ".write_hits")
438 .desc("DTB write hits")
442 .name(name() + ".write_misses")
443 .desc("DTB write misses")
447 .name(name() + ".write_accesses")
448 .desc("DTB write accesses")
452 .name(name() + ".hits")
457 .name(name() + ".misses")
462 .name(name() + ".accesses")
463 .desc("DTB accesses")
467 .name(name() + ".flush_tlb")
468 .desc("Number of times complete TLB was flushed")
472 .name(name() + ".flush_tlb_mva")
473 .desc("Number of times TLB was flushed by MVA")
477 .name(name() + ".flush_tlb_mva_asid")
478 .desc("Number of times TLB was flushed by MVA & ASID")
482 .name(name() + ".flush_tlb_asid")
483 .desc("Number of times TLB was flushed by ASID")
487 .name(name() + ".flush_entries")
488 .desc("Number of entries that have been flushed from TLB")
492 .name(name() + ".align_faults")
493 .desc("Number of TLB faults due to alignment restrictions")
497 .name(name() + ".prefetch_faults")
498 .desc("Number of TLB faults due to prefetch")
502 .name(name() + ".domain_faults")
503 .desc("Number of TLB faults due to domain restrictions")
507 .name(name() + ".perms_faults")
508 .desc("Number of TLB faults due to permissions restrictions")
511 instAccesses
= instHits
+ instMisses
;
512 readAccesses
= readHits
+ readMisses
;
513 writeAccesses
= writeHits
+ writeMisses
;
514 hits
= readHits
+ writeHits
+ instHits
;
515 misses
= readMisses
+ writeMisses
+ instMisses
;
516 accesses
= readAccesses
+ writeAccesses
+ instAccesses
;
520 TLB::regProbePoints()
522 ppRefills
.reset(new ProbePoints::PMU(getProbeManager(), "Refills"));
526 TLB::translateSe(const RequestPtr
&req
, ThreadContext
*tc
, Mode mode
,
527 Translation
*translation
, bool &delay
, bool timing
)
530 Addr vaddr_tainted
= req
->getVaddr();
533 vaddr
= purifyTaggedAddr(vaddr_tainted
, tc
, aarch64EL
, (TCR
)ttbcr
,
536 vaddr
= vaddr_tainted
;
537 Request::Flags flags
= req
->getFlags();
539 bool is_fetch
= (mode
== Execute
);
540 bool is_write
= (mode
== Write
);
543 assert(flags
& MustBeOne
|| req
->isPrefetch());
544 if (sctlr
.a
|| !(flags
& AllowUnaligned
)) {
545 if (vaddr
& mask(flags
& AlignmentMask
)) {
546 // LPAE is always disabled in SE mode
547 return std::make_shared
<DataAbort
>(
549 TlbEntry::DomainType::NoAccess
, is_write
,
550 ArmFault::AlignmentFault
, isStage2
,
557 Process
*p
= tc
->getProcessPtr();
559 if (!p
->pTable
->translate(vaddr
, paddr
))
560 return std::make_shared
<GenericPageTableFault
>(vaddr_tainted
);
561 req
->setPaddr(paddr
);
563 return finalizePhysical(req
, tc
, mode
);
567 TLB::checkPermissions(TlbEntry
*te
, const RequestPtr
&req
, Mode mode
)
569 // a data cache maintenance instruction that operates by MVA does
570 // not generate a Data Abort exeception due to a Permission fault
571 if (req
->isCacheMaintenance()) {
575 Addr vaddr
= req
->getVaddr(); // 32-bit don't have to purify
576 Request::Flags flags
= req
->getFlags();
577 bool is_fetch
= (mode
== Execute
);
578 bool is_write
= (mode
== Write
);
579 bool is_priv
= isPriv
&& !(flags
& UserMode
);
581 // Get the translation type from the actuall table entry
582 ArmFault::TranMethod tranMethod
= te
->longDescFormat
? ArmFault::LpaeTran
583 : ArmFault::VmsaTran
;
585 // If this is the second stage of translation and the request is for a
586 // stage 1 page table walk then we need to check the HCR.PTW bit. This
587 // allows us to generate a fault if the request targets an area marked
588 // as a device or strongly ordered.
589 if (isStage2
&& req
->isPTWalk() && hcr
.ptw
&&
590 (te
->mtype
!= TlbEntry::MemoryType::Normal
)) {
591 return std::make_shared
<DataAbort
>(
592 vaddr
, te
->domain
, is_write
,
593 ArmFault::PermissionLL
+ te
->lookupLevel
,
594 isStage2
, tranMethod
);
597 // Generate an alignment fault for unaligned data accesses to device or
598 // strongly ordered memory
600 if (te
->mtype
!= TlbEntry::MemoryType::Normal
) {
601 if (vaddr
& mask(flags
& AlignmentMask
)) {
603 return std::make_shared
<DataAbort
>(
604 vaddr
, TlbEntry::DomainType::NoAccess
, is_write
,
605 ArmFault::AlignmentFault
, isStage2
,
611 if (te
->nonCacheable
) {
612 // Prevent prefetching from I/O devices.
613 if (req
->isPrefetch()) {
614 // Here we can safely use the fault status for the short
615 // desc. format in all cases
616 return std::make_shared
<PrefetchAbort
>(
617 vaddr
, ArmFault::PrefetchUncacheable
,
618 isStage2
, tranMethod
);
622 if (!te
->longDescFormat
) {
623 switch ((dacr
>> (static_cast<uint8_t>(te
->domain
) * 2)) & 0x3) {
626 DPRINTF(TLB
, "TLB Fault: Data abort on domain. DACR: %#x"
627 " domain: %#x write:%d\n", dacr
,
628 static_cast<uint8_t>(te
->domain
), is_write
);
630 // Use PC value instead of vaddr because vaddr might
631 // be aligned to cache line and should not be the
632 // address reported in FAR
633 return std::make_shared
<PrefetchAbort
>(
635 ArmFault::DomainLL
+ te
->lookupLevel
,
636 isStage2
, tranMethod
);
638 return std::make_shared
<DataAbort
>(
639 vaddr
, te
->domain
, is_write
,
640 ArmFault::DomainLL
+ te
->lookupLevel
,
641 isStage2
, tranMethod
);
643 // Continue with permissions check
646 panic("UNPRED domain\n");
652 // The 'ap' variable is AP[2:0] or {AP[2,1],1b'0}, i.e. always three bits
653 uint8_t ap
= te
->longDescFormat
? te
->ap
<< 1 : te
->ap
;
654 uint8_t hap
= te
->hap
;
656 if (sctlr
.afe
== 1 || te
->longDescFormat
)
660 bool isWritable
= true;
661 // If this is a stage 2 access (eg for reading stage 1 page table entries)
662 // then don't perform the AP permissions check, we stil do the HAP check
669 DPRINTF(TLB
, "Access permissions 0, checking rs:%#x\n",
672 switch ((int)sctlr
.rs
) {
677 abt
= is_write
|| !is_priv
;
693 abt
= !is_priv
&& is_write
;
694 isWritable
= is_priv
;
700 panic("UNPRED premissions\n");
702 abt
= !is_priv
|| is_write
;
711 panic("Unknown permissions %#x\n", ap
);
715 bool hapAbt
= is_write
? !(hap
& 2) : !(hap
& 1);
716 bool xn
= te
->xn
|| (isWritable
&& sctlr
.wxn
) ||
717 (ap
== 3 && sctlr
.uwxn
&& is_priv
);
718 if (is_fetch
&& (abt
|| xn
||
719 (te
->longDescFormat
&& te
->pxn
&& is_priv
) ||
720 (isSecure
&& te
->ns
&& scr
.sif
))) {
722 DPRINTF(TLB
, "TLB Fault: Prefetch abort on permission check. AP:%d "
723 "priv:%d write:%d ns:%d sif:%d sctlr.afe: %d \n",
724 ap
, is_priv
, is_write
, te
->ns
, scr
.sif
,sctlr
.afe
);
725 // Use PC value instead of vaddr because vaddr might be aligned to
726 // cache line and should not be the address reported in FAR
727 return std::make_shared
<PrefetchAbort
>(
729 ArmFault::PermissionLL
+ te
->lookupLevel
,
730 isStage2
, tranMethod
);
731 } else if (abt
| hapAbt
) {
733 DPRINTF(TLB
, "TLB Fault: Data abort on permission check. AP:%d priv:%d"
734 " write:%d\n", ap
, is_priv
, is_write
);
735 return std::make_shared
<DataAbort
>(
736 vaddr
, te
->domain
, is_write
,
737 ArmFault::PermissionLL
+ te
->lookupLevel
,
738 isStage2
| !abt
, tranMethod
);
745 TLB::checkPermissions64(TlbEntry
*te
, const RequestPtr
&req
, Mode mode
,
750 // A data cache maintenance instruction that operates by VA does
751 // not generate a Permission fault unless:
752 // * It is a data cache invalidate (dc ivac) which requires write
753 // permissions to the VA, or
754 // * It is executed from EL0
755 if (req
->isCacheClean() && aarch64EL
!= EL0
&& !isStage2
) {
759 Addr vaddr_tainted
= req
->getVaddr();
760 Addr vaddr
= purifyTaggedAddr(vaddr_tainted
, tc
, aarch64EL
, (TCR
)ttbcr
,
763 Request::Flags flags
= req
->getFlags();
764 bool is_fetch
= (mode
== Execute
);
765 // Cache clean operations require read permissions to the specified VA
766 bool is_write
= !req
->isCacheClean() && mode
== Write
;
767 bool is_atomic
= req
->isAtomic();
768 bool is_priv M5_VAR_USED
= isPriv
&& !(flags
& UserMode
);
770 updateMiscReg(tc
, curTranType
);
772 // If this is the second stage of translation and the request is for a
773 // stage 1 page table walk then we need to check the HCR.PTW bit. This
774 // allows us to generate a fault if the request targets an area marked
775 // as a device or strongly ordered.
776 if (isStage2
&& req
->isPTWalk() && hcr
.ptw
&&
777 (te
->mtype
!= TlbEntry::MemoryType::Normal
)) {
778 return std::make_shared
<DataAbort
>(
779 vaddr_tainted
, te
->domain
, is_write
,
780 ArmFault::PermissionLL
+ te
->lookupLevel
,
781 isStage2
, ArmFault::LpaeTran
);
784 // Generate an alignment fault for unaligned accesses to device or
785 // strongly ordered memory
787 if (te
->mtype
!= TlbEntry::MemoryType::Normal
) {
788 if (vaddr
& mask(flags
& AlignmentMask
)) {
790 return std::make_shared
<DataAbort
>(
792 TlbEntry::DomainType::NoAccess
,
793 is_atomic
? false : is_write
,
794 ArmFault::AlignmentFault
, isStage2
,
800 if (te
->nonCacheable
) {
801 // Prevent prefetching from I/O devices.
802 if (req
->isPrefetch()) {
803 // Here we can safely use the fault status for the short
804 // desc. format in all cases
805 return std::make_shared
<PrefetchAbort
>(
807 ArmFault::PrefetchUncacheable
,
808 isStage2
, ArmFault::LpaeTran
);
812 uint8_t ap
= 0x3 & (te
->ap
); // 2-bit access protection field
816 uint8_t pxn
= te
->pxn
;
817 bool r
= !is_write
&& !is_fetch
;
821 // grant_read is used for faults from an atomic instruction that
822 // both reads and writes from a memory location. From a ISS point
823 // of view they count as read if a read to that address would have
824 // generated the fault; they count as writes otherwise
825 bool grant_read
= true;
826 DPRINTF(TLBVerbose
, "Checking permissions: ap:%d, xn:%d, pxn:%d, r:%d, "
827 "w:%d, x:%d\n", ap
, xn
, pxn
, r
, w
, x
);
830 assert(ArmSystem::haveVirtualization(tc
) && aarch64EL
!= EL2
);
831 // In stage 2 we use the hypervisor access permission bits.
832 // The following permissions are described in ARM DDI 0487A.f
834 uint8_t hap
= 0x3 & te
->hap
;
835 grant_read
= hap
& 0x1;
837 // sctlr.wxn overrides the xn bit
838 grant
= !sctlr
.wxn
&& !xn
;
839 } else if (is_write
) {
848 grant_read
= ap
& 0x1;
849 uint8_t perm
= (ap
<< 2) | (xn
<< 1) | pxn
;
859 grant
= r
|| w
|| (x
&& !sctlr
.wxn
);
880 if (checkPAN(tc
, ap
, req
, mode
)) {
886 uint8_t perm
= (ap
<< 2) | (xn
<< 1) | pxn
;
890 grant
= r
|| w
|| (x
&& !sctlr
.wxn
);
898 // regions that are writeable at EL0 should not be
920 if (hcr
.e2h
&& checkPAN(tc
, ap
, req
, mode
)) {
928 uint8_t perm
= (ap
& 0x2) | xn
;
931 grant
= r
|| w
|| (x
&& !sctlr
.wxn
) ;
953 DPRINTF(TLB
, "TLB Fault: Prefetch abort on permission check. "
954 "AP:%d priv:%d write:%d ns:%d sif:%d "
956 ap
, is_priv
, is_write
, te
->ns
, scr
.sif
, sctlr
.afe
);
957 // Use PC value instead of vaddr because vaddr might be aligned to
958 // cache line and should not be the address reported in FAR
959 return std::make_shared
<PrefetchAbort
>(
961 ArmFault::PermissionLL
+ te
->lookupLevel
,
962 isStage2
, ArmFault::LpaeTran
);
965 DPRINTF(TLB
, "TLB Fault: Data abort on permission check. AP:%d "
966 "priv:%d write:%d\n", ap
, is_priv
, is_write
);
967 return std::make_shared
<DataAbort
>(
968 vaddr_tainted
, te
->domain
,
969 (is_atomic
&& !grant_read
) ? false : is_write
,
970 ArmFault::PermissionLL
+ te
->lookupLevel
,
971 isStage2
, ArmFault::LpaeTran
);
979 TLB::checkPAN(ThreadContext
*tc
, uint8_t ap
, const RequestPtr
&req
, Mode mode
)
981 // The PAN bit has no effect on:
982 // 1) Instruction accesses.
983 // 2) Data Cache instructions other than DC ZVA
984 // 3) Address translation instructions, other than ATS1E1RP and
985 // ATS1E1WP when ARMv8.2-ATS1E1 is implemented. (Unimplemented in
987 // 4) Unprivileged instructions (Unimplemented in gem5)
988 AA64MMFR1 mmfr1
= tc
->readMiscReg(MISCREG_ID_AA64MMFR1_EL1
);
989 if (mmfr1
.pan
&& cpsr
.pan
&& (ap
& 0x1) && mode
!= Execute
&&
990 (!req
->isCacheMaintenance() ||
991 (req
->getFlags() & Request::CACHE_BLOCK_ZERO
))) {
999 TLB::translateMmuOff(ThreadContext
*tc
, const RequestPtr
&req
, Mode mode
,
1000 TLB::ArmTranslationType tranType
, Addr vaddr
, bool long_desc_format
)
1002 bool is_fetch
= (mode
== Execute
);
1003 req
->setPaddr(vaddr
);
1004 // When the MMU is off the security attribute corresponds to the
1005 // security state of the processor
1007 req
->setFlags(Request::SECURE
);
1009 // @todo: double check this (ARM ARM issue C B3.2.1)
1010 if (long_desc_format
|| sctlr
.tre
== 0 || nmrr
.ir0
== 0 ||
1011 nmrr
.or0
== 0 || prrr
.tr0
!= 0x2) {
1012 if (!req
->isCacheMaintenance()) {
1013 req
->setFlags(Request::UNCACHEABLE
);
1015 req
->setFlags(Request::STRICT_ORDER
);
1018 // Set memory attributes
1020 temp_te
.ns
= !isSecure
;
1021 if (isStage2
|| hcr
.dc
== 0 || isSecure
||
1022 (isHyp
&& !(tranType
& S1CTran
))) {
1024 temp_te
.mtype
= is_fetch
? TlbEntry::MemoryType::Normal
1025 : TlbEntry::MemoryType::StronglyOrdered
;
1026 temp_te
.innerAttrs
= 0x0;
1027 temp_te
.outerAttrs
= 0x0;
1028 temp_te
.shareable
= true;
1029 temp_te
.outerShareable
= true;
1031 temp_te
.mtype
= TlbEntry::MemoryType::Normal
;
1032 temp_te
.innerAttrs
= 0x3;
1033 temp_te
.outerAttrs
= 0x3;
1034 temp_te
.shareable
= false;
1035 temp_te
.outerShareable
= false;
1037 temp_te
.setAttributes(long_desc_format
);
1038 DPRINTF(TLBVerbose
, "(No MMU) setting memory attributes: shareable: "
1039 "%d, innerAttrs: %d, outerAttrs: %d, isStage2: %d\n",
1040 temp_te
.shareable
, temp_te
.innerAttrs
, temp_te
.outerAttrs
,
1042 setAttr(temp_te
.attributes
);
1044 return testTranslation(req
, mode
, TlbEntry::DomainType::NoAccess
);
1048 TLB::translateMmuOn(ThreadContext
* tc
, const RequestPtr
&req
, Mode mode
,
1049 Translation
*translation
, bool &delay
, bool timing
,
1050 bool functional
, Addr vaddr
,
1051 ArmFault::TranMethod tranMethod
)
1053 TlbEntry
*te
= NULL
;
1054 bool is_fetch
= (mode
== Execute
);
1057 Request::Flags flags
= req
->getFlags();
1058 Addr vaddr_tainted
= req
->getVaddr();
1060 Fault fault
= getResultTe(&te
, req
, tc
, mode
, translation
, timing
,
1061 functional
, &mergeTe
);
1062 // only proceed if we have a valid table entry
1063 if ((te
== NULL
) && (fault
== NoFault
)) delay
= true;
1065 // If we have the table entry transfer some of the attributes to the
1066 // request that triggered the translation
1068 // Set memory attributes
1070 "Setting memory attributes: shareable: %d, innerAttrs: %d, "
1071 "outerAttrs: %d, mtype: %d, isStage2: %d\n",
1072 te
->shareable
, te
->innerAttrs
, te
->outerAttrs
,
1073 static_cast<uint8_t>(te
->mtype
), isStage2
);
1074 setAttr(te
->attributes
);
1076 if (te
->nonCacheable
&& !req
->isCacheMaintenance())
1077 req
->setFlags(Request::UNCACHEABLE
);
1079 // Require requests to be ordered if the request goes to
1080 // strongly ordered or device memory (i.e., anything other
1081 // than normal memory requires strict order).
1082 if (te
->mtype
!= TlbEntry::MemoryType::Normal
)
1083 req
->setFlags(Request::STRICT_ORDER
);
1085 Addr pa
= te
->pAddr(vaddr
);
1088 if (isSecure
&& !te
->ns
) {
1089 req
->setFlags(Request::SECURE
);
1091 if ((!is_fetch
) && (vaddr
& mask(flags
& AlignmentMask
)) &&
1092 (te
->mtype
!= TlbEntry::MemoryType::Normal
)) {
1093 // Unaligned accesses to Device memory should always cause an
1094 // abort regardless of sctlr.a
1096 bool is_write
= (mode
== Write
);
1097 return std::make_shared
<DataAbort
>(
1099 TlbEntry::DomainType::NoAccess
, is_write
,
1100 ArmFault::AlignmentFault
, isStage2
,
1104 // Check for a trickbox generated address fault
1105 if (fault
== NoFault
)
1106 fault
= testTranslation(req
, mode
, te
->domain
);
1109 if (fault
== NoFault
) {
1110 // Don't try to finalize a physical address unless the
1111 // translation has completed (i.e., there is a table entry).
1112 return te
? finalizePhysical(req
, tc
, mode
) : NoFault
;
1119 TLB::translateFs(const RequestPtr
&req
, ThreadContext
*tc
, Mode mode
,
1120 Translation
*translation
, bool &delay
, bool timing
,
1121 TLB::ArmTranslationType tranType
, bool functional
)
1123 // No such thing as a functional timing access
1124 assert(!(timing
&& functional
));
1126 updateMiscReg(tc
, tranType
);
1128 Addr vaddr_tainted
= req
->getVaddr();
1131 vaddr
= purifyTaggedAddr(vaddr_tainted
, tc
, aarch64EL
, (TCR
)ttbcr
,
1134 vaddr
= vaddr_tainted
;
1135 Request::Flags flags
= req
->getFlags();
1137 bool is_fetch
= (mode
== Execute
);
1138 bool is_write
= (mode
== Write
);
1139 bool long_desc_format
= aarch64
|| longDescFormatInUse(tc
);
1140 ArmFault::TranMethod tranMethod
= long_desc_format
? ArmFault::LpaeTran
1141 : ArmFault::VmsaTran
;
1145 DPRINTF(TLBVerbose
, "CPSR is priv:%d UserMode:%d secure:%d S1S2NsTran:%d\n",
1146 isPriv
, flags
& UserMode
, isSecure
, tranType
& S1S2NsTran
);
1148 DPRINTF(TLB
, "translateFs addr %#x, mode %d, st2 %d, scr %#x sctlr %#x "
1149 "flags %#lx tranType 0x%x\n", vaddr_tainted
, mode
, isStage2
,
1150 scr
, sctlr
, flags
, tranType
);
1152 if ((req
->isInstFetch() && (!sctlr
.i
)) ||
1153 ((!req
->isInstFetch()) && (!sctlr
.c
))){
1154 if (!req
->isCacheMaintenance()) {
1155 req
->setFlags(Request::UNCACHEABLE
);
1157 req
->setFlags(Request::STRICT_ORDER
);
1160 assert(flags
& MustBeOne
|| req
->isPrefetch());
1161 if (sctlr
.a
|| !(flags
& AllowUnaligned
)) {
1162 if (vaddr
& mask(flags
& AlignmentMask
)) {
1164 return std::make_shared
<DataAbort
>(
1166 TlbEntry::DomainType::NoAccess
, is_write
,
1167 ArmFault::AlignmentFault
, isStage2
,
1173 // If guest MMU is off or hcr.vm=0 go straight to stage2
1174 if ((isStage2
&& !hcr
.vm
) || (!isStage2
&& !sctlr
.m
)) {
1175 return translateMmuOff(tc
, req
, mode
, tranType
, vaddr
,
1178 DPRINTF(TLBVerbose
, "Translating %s=%#x context=%d\n",
1179 isStage2
? "IPA" : "VA", vaddr_tainted
, asid
);
1180 // Translation enabled
1181 return translateMmuOn(tc
, req
, mode
, translation
, delay
, timing
,
1182 functional
, vaddr
, tranMethod
);
1187 TLB::translateAtomic(const RequestPtr
&req
, ThreadContext
*tc
, Mode mode
,
1188 TLB::ArmTranslationType tranType
)
1190 updateMiscReg(tc
, tranType
);
1192 if (directToStage2
) {
1194 return stage2Tlb
->translateAtomic(req
, tc
, mode
, tranType
);
1200 fault
= translateFs(req
, tc
, mode
, NULL
, delay
, false, tranType
);
1202 fault
= translateSe(req
, tc
, mode
, NULL
, delay
, false);
1208 TLB::translateFunctional(const RequestPtr
&req
, ThreadContext
*tc
, Mode mode
,
1209 TLB::ArmTranslationType tranType
)
1211 updateMiscReg(tc
, tranType
);
1213 if (directToStage2
) {
1215 return stage2Tlb
->translateFunctional(req
, tc
, mode
, tranType
);
1221 fault
= translateFs(req
, tc
, mode
, NULL
, delay
, false, tranType
, true);
1223 fault
= translateSe(req
, tc
, mode
, NULL
, delay
, false);
1229 TLB::translateTiming(const RequestPtr
&req
, ThreadContext
*tc
,
1230 Translation
*translation
, Mode mode
, TLB::ArmTranslationType tranType
)
1232 updateMiscReg(tc
, tranType
);
1234 if (directToStage2
) {
1236 stage2Tlb
->translateTiming(req
, tc
, translation
, mode
, tranType
);
1240 assert(translation
);
1242 translateComplete(req
, tc
, translation
, mode
, tranType
, isStage2
);
1246 TLB::translateComplete(const RequestPtr
&req
, ThreadContext
*tc
,
1247 Translation
*translation
, Mode mode
, TLB::ArmTranslationType tranType
,
1253 fault
= translateFs(req
, tc
, mode
, translation
, delay
, true, tranType
);
1255 fault
= translateSe(req
, tc
, mode
, translation
, delay
, true);
1256 DPRINTF(TLBVerbose
, "Translation returning delay=%d fault=%d\n", delay
, fault
!=
1258 // If we have a translation, and we're not in the middle of doing a stage
1259 // 2 translation tell the translation that we've either finished or its
1260 // going to take a while. By not doing this when we're in the middle of a
1261 // stage 2 translation we prevent marking the translation as delayed twice,
1262 // one when the translation starts and again when the stage 1 translation
1264 if (translation
&& (callFromS2
|| !stage2Req
|| req
->hasPaddr() || fault
!= NoFault
)) {
1266 translation
->finish(fault
, req
, tc
, mode
);
1268 translation
->markDelayed();
1274 TLB::getTableWalkerPort()
1276 return &stage2Mmu
->getDMAPort();
1280 TLB::updateMiscReg(ThreadContext
*tc
, ArmTranslationType tranType
)
1282 // check if the regs have changed, or the translation mode is different.
1283 // NOTE: the tran type doesn't affect stage 2 TLB's as they only handle
1284 // one type of translation anyway
1285 if (miscRegValid
&& miscRegContext
== tc
->contextId() &&
1286 ((tranType
== curTranType
) || isStage2
)) {
1290 DPRINTF(TLBVerbose
, "TLB variables changed!\n");
1291 cpsr
= tc
->readMiscReg(MISCREG_CPSR
);
1293 // Dependencies: SCR/SCR_EL3, CPSR
1294 isSecure
= inSecureState(tc
) &&
1295 !(tranType
& HypMode
) && !(tranType
& S1S2NsTran
);
1297 aarch64EL
= tranTypeEL(cpsr
, tranType
);
1298 aarch64
= isStage2
?
1300 ELIs64(tc
, aarch64EL
== EL0
? EL1
: aarch64EL
);
1302 if (aarch64
) { // AArch64
1303 // determine EL we need to translate in
1304 switch (aarch64EL
) {
1308 sctlr
= tc
->readMiscReg(MISCREG_SCTLR_EL1
);
1309 ttbcr
= tc
->readMiscReg(MISCREG_TCR_EL1
);
1310 uint64_t ttbr_asid
= ttbcr
.a1
?
1311 tc
->readMiscReg(MISCREG_TTBR1_EL1
) :
1312 tc
->readMiscReg(MISCREG_TTBR0_EL1
);
1313 asid
= bits(ttbr_asid
,
1314 (haveLargeAsid64
&& ttbcr
.as
) ? 63 : 55, 48);
1318 sctlr
= tc
->readMiscReg(MISCREG_SCTLR_EL2
);
1319 ttbcr
= tc
->readMiscReg(MISCREG_TCR_EL2
);
1323 sctlr
= tc
->readMiscReg(MISCREG_SCTLR_EL3
);
1324 ttbcr
= tc
->readMiscReg(MISCREG_TCR_EL3
);
1328 hcr
= tc
->readMiscReg(MISCREG_HCR_EL2
);
1329 scr
= tc
->readMiscReg(MISCREG_SCR_EL3
);
1330 isPriv
= aarch64EL
!= EL0
;
1331 if (haveVirtualization
) {
1332 vmid
= bits(tc
->readMiscReg(MISCREG_VTTBR_EL2
), 55, 48);
1333 isHyp
= aarch64EL
== EL2
;
1334 isHyp
|= tranType
& HypMode
;
1335 isHyp
&= (tranType
& S1S2NsTran
) == 0;
1336 isHyp
&= (tranType
& S1CTran
) == 0;
1337 // Work out if we should skip the first stage of translation and go
1338 // directly to stage 2. This value is cached so we don't have to
1339 // compute it for every translation.
1340 stage2Req
= isStage2
||
1341 (hcr
.vm
&& !isHyp
&& !isSecure
&&
1342 !(tranType
& S1CTran
) && (aarch64EL
< EL2
) &&
1343 !(tranType
& S1E1Tran
)); // <--- FIX THIS HACK
1344 stage2DescReq
= isStage2
|| (hcr
.vm
&& !isHyp
&& !isSecure
&&
1346 directToStage2
= !isStage2
&& stage2Req
&& !sctlr
.m
;
1350 directToStage2
= false;
1352 stage2DescReq
= false;
1355 sctlr
= tc
->readMiscReg(snsBankedIndex(MISCREG_SCTLR
, tc
,
1357 ttbcr
= tc
->readMiscReg(snsBankedIndex(MISCREG_TTBCR
, tc
,
1359 scr
= tc
->readMiscReg(MISCREG_SCR
);
1360 isPriv
= cpsr
.mode
!= MODE_USER
;
1361 if (longDescFormatInUse(tc
)) {
1362 uint64_t ttbr_asid
= tc
->readMiscReg(
1363 snsBankedIndex(ttbcr
.a1
? MISCREG_TTBR1
:
1366 asid
= bits(ttbr_asid
, 55, 48);
1367 } else { // Short-descriptor translation table format in use
1368 CONTEXTIDR context_id
= tc
->readMiscReg(snsBankedIndex(
1369 MISCREG_CONTEXTIDR
, tc
,!isSecure
));
1370 asid
= context_id
.asid
;
1372 prrr
= tc
->readMiscReg(snsBankedIndex(MISCREG_PRRR
, tc
,
1374 nmrr
= tc
->readMiscReg(snsBankedIndex(MISCREG_NMRR
, tc
,
1376 dacr
= tc
->readMiscReg(snsBankedIndex(MISCREG_DACR
, tc
,
1378 hcr
= tc
->readMiscReg(MISCREG_HCR
);
1380 if (haveVirtualization
) {
1381 vmid
= bits(tc
->readMiscReg(MISCREG_VTTBR
), 55, 48);
1382 isHyp
= cpsr
.mode
== MODE_HYP
;
1383 isHyp
|= tranType
& HypMode
;
1384 isHyp
&= (tranType
& S1S2NsTran
) == 0;
1385 isHyp
&= (tranType
& S1CTran
) == 0;
1387 sctlr
= tc
->readMiscReg(MISCREG_HSCTLR
);
1389 // Work out if we should skip the first stage of translation and go
1390 // directly to stage 2. This value is cached so we don't have to
1391 // compute it for every translation.
1392 stage2Req
= hcr
.vm
&& !isStage2
&& !isHyp
&& !isSecure
&&
1393 !(tranType
& S1CTran
);
1394 stage2DescReq
= hcr
.vm
&& !isStage2
&& !isHyp
&& !isSecure
;
1395 directToStage2
= stage2Req
&& !sctlr
.m
;
1400 directToStage2
= false;
1401 stage2DescReq
= false;
1404 miscRegValid
= true;
1405 miscRegContext
= tc
->contextId();
1406 curTranType
= tranType
;
1410 TLB::tranTypeEL(CPSR cpsr
, ArmTranslationType type
)
1431 return currEL(cpsr
);
1434 panic("Unknown translation mode!\n");
1439 TLB::getTE(TlbEntry
**te
, const RequestPtr
&req
, ThreadContext
*tc
, Mode mode
,
1440 Translation
*translation
, bool timing
, bool functional
,
1441 bool is_secure
, TLB::ArmTranslationType tranType
)
1443 // In a 2-stage system, the IPA->PA translation can be started via this
1444 // call so make sure the miscRegs are correct.
1446 updateMiscReg(tc
, tranType
);
1448 bool is_fetch
= (mode
== Execute
);
1449 bool is_write
= (mode
== Write
);
1451 Addr vaddr_tainted
= req
->getVaddr();
1453 ExceptionLevel target_el
= aarch64
? aarch64EL
: EL1
;
1455 vaddr
= purifyTaggedAddr(vaddr_tainted
, tc
, target_el
, (TCR
)ttbcr
,
1458 vaddr
= vaddr_tainted
;
1460 *te
= lookup(vaddr
, asid
, vmid
, isHyp
, is_secure
, false, false, target_el
);
1462 if (req
->isPrefetch()) {
1463 // if the request is a prefetch don't attempt to fill the TLB or go
1464 // any further with the memory access (here we can safely use the
1465 // fault status for the short desc. format in all cases)
1467 return std::make_shared
<PrefetchAbort
>(
1468 vaddr_tainted
, ArmFault::PrefetchTLBMiss
, isStage2
);
1478 // start translation table walk, pass variables rather than
1479 // re-retreaving in table walker for speed
1480 DPRINTF(TLB
, "TLB Miss: Starting hardware table walker for %#x(%d:%d)\n",
1481 vaddr_tainted
, asid
, vmid
);
1483 fault
= tableWalker
->walk(req
, tc
, asid
, vmid
, isHyp
, mode
,
1484 translation
, timing
, functional
, is_secure
,
1485 tranType
, stage2DescReq
);
1486 // for timing mode, return and wait for table walk,
1487 if (timing
|| fault
!= NoFault
) {
1491 *te
= lookup(vaddr
, asid
, vmid
, isHyp
, is_secure
, false, false, target_el
);
1507 TLB::getResultTe(TlbEntry
**te
, const RequestPtr
&req
,
1508 ThreadContext
*tc
, Mode mode
,
1509 Translation
*translation
, bool timing
, bool functional
,
1515 // We are already in the stage 2 TLB. Grab the table entry for stage
1516 // 2 only. We are here because stage 1 translation is disabled.
1517 TlbEntry
*s2Te
= NULL
;
1518 // Get the stage 2 table entry
1519 fault
= getTE(&s2Te
, req
, tc
, mode
, translation
, timing
, functional
,
1520 isSecure
, curTranType
);
1521 // Check permissions of stage 2
1522 if ((s2Te
!= NULL
) && (fault
== NoFault
)) {
1524 fault
= checkPermissions64(s2Te
, req
, mode
, tc
);
1526 fault
= checkPermissions(s2Te
, req
, mode
);
1532 TlbEntry
*s1Te
= NULL
;
1534 Addr vaddr_tainted
= req
->getVaddr();
1536 // Get the stage 1 table entry
1537 fault
= getTE(&s1Te
, req
, tc
, mode
, translation
, timing
, functional
,
1538 isSecure
, curTranType
);
1539 // only proceed if we have a valid table entry
1540 if ((s1Te
!= NULL
) && (fault
== NoFault
)) {
1541 // Check stage 1 permissions before checking stage 2
1543 fault
= checkPermissions64(s1Te
, req
, mode
, tc
);
1545 fault
= checkPermissions(s1Te
, req
, mode
);
1546 if (stage2Req
& (fault
== NoFault
)) {
1547 Stage2LookUp
*s2Lookup
= new Stage2LookUp(this, stage2Tlb
, *s1Te
,
1548 req
, translation
, mode
, timing
, functional
, curTranType
);
1549 fault
= s2Lookup
->getTe(tc
, mergeTe
);
1550 if (s2Lookup
->isComplete()) {
1552 // We've finished with the lookup so delete it
1555 // The lookup hasn't completed, so we can't delete it now. We
1556 // get round this by asking the object to self delete when the
1557 // translation is complete.
1558 s2Lookup
->setSelfDelete();
1561 // This case deals with an S1 hit (or bypass), followed by
1562 // an S2 hit-but-perms issue
1564 DPRINTF(TLBVerbose
, "s2TLB: reqVa %#x, reqPa %#x, fault %p\n",
1565 vaddr_tainted
, req
->hasPaddr() ? req
->getPaddr() : ~0, fault
);
1566 if (fault
!= NoFault
) {
1567 ArmFault
*armFault
= reinterpret_cast<ArmFault
*>(fault
.get());
1568 armFault
->annotate(ArmFault::S1PTW
, false);
1569 armFault
->annotate(ArmFault::OVA
, vaddr_tainted
);
1579 TLB::setTestInterface(SimObject
*_ti
)
1584 TlbTestInterface
*ti(dynamic_cast<TlbTestInterface
*>(_ti
));
1585 fatal_if(!ti
, "%s is not a valid ARM TLB tester\n", _ti
->name());
1591 TLB::testTranslation(const RequestPtr
&req
, Mode mode
,
1592 TlbEntry::DomainType domain
)
1594 if (!test
|| !req
->hasSize() || req
->getSize() == 0 ||
1595 req
->isCacheMaintenance()) {
1598 return test
->translationCheck(req
, isPriv
, mode
, domain
);
1603 TLB::testWalk(Addr pa
, Addr size
, Addr va
, bool is_secure
, Mode mode
,
1604 TlbEntry::DomainType domain
, LookupLevel lookup_level
)
1609 return test
->walkCheck(pa
, size
, va
, is_secure
, isPriv
, mode
,
1610 domain
, lookup_level
);
1616 ArmTLBParams::create()
1618 return new ArmISA::TLB(this);