diff options
Diffstat (limited to 'src/arch/arm/tlb.cc')
-rw-r--r-- | src/arch/arm/tlb.cc | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/src/arch/arm/tlb.cc b/src/arch/arm/tlb.cc index 2b50d4b28..872f351c6 100644 --- a/src/arch/arm/tlb.cc +++ b/src/arch/arm/tlb.cc @@ -150,7 +150,7 @@ TLB::finalizePhysical(const RequestPtr &req, TlbEntry* TLB::lookup(Addr va, uint16_t asn, uint8_t vmid, bool hyp, bool secure, - bool functional, bool ignore_asn, uint8_t target_el) + bool functional, bool ignore_asn, ExceptionLevel target_el) { TlbEntry *retval = NULL; @@ -236,7 +236,8 @@ TLB::printTlb() const } void -TLB::flushAllSecurity(bool secure_lookup, uint8_t target_el, bool ignore_el) +TLB::flushAllSecurity(bool secure_lookup, ExceptionLevel target_el, + bool ignore_el) { DPRINTF(TLB, "Flushing all TLB entries (%s lookup)\n", (secure_lookup ? "secure" : "non-secure")); @@ -244,9 +245,11 @@ TLB::flushAllSecurity(bool secure_lookup, uint8_t target_el, bool ignore_el) TlbEntry *te; while (x < size) { te = &table[x]; + const bool el_match = ignore_el ? + true : te->checkELMatch(target_el); + if (te->valid && secure_lookup == !te->nstid && - (te->vmid == vmid || secure_lookup) && - checkELMatch(target_el, te->el, ignore_el)) { + (te->vmid == vmid || secure_lookup) && el_match) { DPRINTF(TLB, " - %s\n", te->print()); te->valid = false; @@ -260,12 +263,12 @@ TLB::flushAllSecurity(bool secure_lookup, uint8_t target_el, bool ignore_el) // If there's a second stage TLB (and we're not it) then flush it as well // if we're currently in hyp mode if (!isStage2 && isHyp) { - stage2Tlb->flushAllSecurity(secure_lookup, true); + stage2Tlb->flushAllSecurity(secure_lookup, EL1, true); } } void -TLB::flushAllNs(uint8_t target_el, bool ignore_el) +TLB::flushAllNs(ExceptionLevel target_el, bool ignore_el) { bool hyp = target_el == EL2; @@ -275,8 +278,10 @@ TLB::flushAllNs(uint8_t target_el, bool ignore_el) TlbEntry *te; while (x < size) { te = &table[x]; - if (te->valid && te->nstid && te->isHyp == hyp && - checkELMatch(target_el, te->el, ignore_el)) { + const bool el_match = ignore_el ? + true : te->checkELMatch(target_el); + + if (te->valid && te->nstid && te->isHyp == hyp && el_match) { DPRINTF(TLB, " - %s\n", te->print()); flushedEntries++; @@ -289,12 +294,13 @@ TLB::flushAllNs(uint8_t target_el, bool ignore_el) // If there's a second stage TLB (and we're not it) then flush it as well if (!isStage2 && !hyp) { - stage2Tlb->flushAllNs(false, true); + stage2Tlb->flushAllNs(EL1, true); } } void -TLB::flushMvaAsid(Addr mva, uint64_t asn, bool secure_lookup, uint8_t target_el) +TLB::flushMvaAsid(Addr mva, uint64_t asn, bool secure_lookup, + ExceptionLevel target_el) { DPRINTF(TLB, "Flushing TLB entries with mva: %#x, asid: %#x " "(%s lookup)\n", mva, asn, (secure_lookup ? @@ -304,7 +310,7 @@ TLB::flushMvaAsid(Addr mva, uint64_t asn, bool secure_lookup, uint8_t target_el) } void -TLB::flushAsid(uint64_t asn, bool secure_lookup, uint8_t target_el) +TLB::flushAsid(uint64_t asn, bool secure_lookup, ExceptionLevel target_el) { DPRINTF(TLB, "Flushing TLB entries with asid: %#x (%s lookup)\n", asn, (secure_lookup ? "secure" : "non-secure")); @@ -316,7 +322,7 @@ TLB::flushAsid(uint64_t asn, bool secure_lookup, uint8_t target_el) te = &table[x]; if (te->valid && te->asid == asn && secure_lookup == !te->nstid && (te->vmid == vmid || secure_lookup) && - checkELMatch(target_el, te->el, false)) { + te->checkELMatch(target_el)) { te->valid = false; DPRINTF(TLB, " - %s\n", te->print()); @@ -328,7 +334,7 @@ TLB::flushAsid(uint64_t asn, bool secure_lookup, uint8_t target_el) } void -TLB::flushMva(Addr mva, bool secure_lookup, uint8_t target_el) +TLB::flushMva(Addr mva, bool secure_lookup, ExceptionLevel target_el) { DPRINTF(TLB, "Flushing TLB entries with mva: %#x (%s lookup)\n", mva, (secure_lookup ? "secure" : "non-secure")); @@ -338,7 +344,7 @@ TLB::flushMva(Addr mva, bool secure_lookup, uint8_t target_el) void TLB::_flushMva(Addr mva, uint64_t asn, bool secure_lookup, - bool ignore_asn, uint8_t target_el) + bool ignore_asn, ExceptionLevel target_el) { TlbEntry *te; // D5.7.2: Sign-extend address to 64 bits @@ -360,26 +366,12 @@ TLB::_flushMva(Addr mva, uint64_t asn, bool secure_lookup, } void -TLB::flushIpaVmid(Addr ipa, bool secure_lookup, uint8_t target_el) +TLB::flushIpaVmid(Addr ipa, bool secure_lookup, ExceptionLevel target_el) { assert(!isStage2); stage2Tlb->_flushMva(ipa, 0xbeef, secure_lookup, true, target_el); } -bool -TLB::checkELMatch(uint8_t target_el, uint8_t tentry_el, bool ignore_el) -{ - bool elMatch = true; - if (!ignore_el) { - if (target_el == 2 || target_el == 3) { - elMatch = (tentry_el == target_el); - } else { - elMatch = (tentry_el == 0) || (tentry_el == 1); - } - } - return elMatch; -} - void TLB::drainResume() { |