diff options
author | Gabe Black <gabeblack@google.com> | 2017-12-22 01:07:55 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2017-12-22 23:16:03 +0000 |
commit | b7618c69a511e3fde5cdb674a91e5683f92e770f (patch) | |
tree | e7f472f1014db9e41a98a5b7df759d88db917742 /src/arch/alpha/ev5.cc | |
parent | 4ac0a01e2fdeee8f17d15636409acd7208d9187e (diff) | |
download | gem5-b7618c69a511e3fde5cdb674a91e5683f92e770f.tar.xz |
arch,cpu: "virtualize" the TLB interface.
CPUs have historically instantiated the architecture specific version
of the TLBs to avoid a virtual function call, making them a little bit
more dependent on what the current ISA is. Some simple performance
measurement, the x86 twolf regression on the atomic CPU, shows that
there isn't actually any performance benefit, and if anything the
simulator goes slightly faster (although still within margin of error)
when the TLB functions are virtual.
This change switches everything outside of the architectures themselves
to use the generic BaseTLB type, and then inside the ISA for them to
cast that to their architecture specific type to call into architecture
specific interfaces.
The ARM TLB needed the most adjustment since it was using non-standard
translation function signatures. Specifically, they all took an extra
"type" parameter which defaulted to normal, and translateTiming
returned a Fault. translateTiming actually doesn't need to return a
Fault because everywhere that consumed it just stored it into a
structure which it then deleted(?), and the fault is stored in the
Translation object when the translation is done.
A little more work is needed to fully obviate the arch/tlb.hh header,
so the TheISA::TLB type is still visible outside of the ISAs.
Specifically, the TlbEntry type is used in the generic PageTable which
lives in src/mem.
Change-Id: I51b68ee74411f9af778317eff222f9349d2ed575
Reviewed-on: https://gem5-review.googlesource.com/6921
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/arch/alpha/ev5.cc')
-rw-r--r-- | src/arch/alpha/ev5.cc | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/arch/alpha/ev5.cc b/src/arch/alpha/ev5.cc index 1e8231b66..4d72104b1 100644 --- a/src/arch/alpha/ev5.cc +++ b/src/arch/alpha/ev5.cc @@ -43,6 +43,24 @@ namespace AlphaISA { +template<typename T> +TLB * +getITBPtr(T *tc) +{ + auto tlb = dynamic_cast<TLB *>(tc->getITBPtr()); + assert(tlb); + return tlb; +} + +template<typename T> +TLB * +getDTBPtr(T *tc) +{ + auto tlb = dynamic_cast<TLB *>(tc->getDTBPtr()); + assert(tlb); + return tlb; +} + //////////////////////////////////////////////////////////////////////// // // Machine dependent functions @@ -161,7 +179,7 @@ ISA::readIpr(int idx, ThreadContext *tc) case IPR_DTB_PTE: { - TlbEntry &entry = tc->getDTBPtr()->index(1); + TlbEntry &entry = getDTBPtr(tc)->index(1); retval |= ((uint64_t)entry.ppn & ULL(0x7ffffff)) << 32; retval |= ((uint64_t)entry.xre & ULL(0xf)) << 8; @@ -358,21 +376,21 @@ ISA::setIpr(int idx, uint64_t val, ThreadContext *tc) // really a control write ipr[idx] = 0; - tc->getDTBPtr()->flushAll(); + getDTBPtr(tc)->flushAll(); break; case IPR_DTB_IAP: // really a control write ipr[idx] = 0; - tc->getDTBPtr()->flushProcesses(); + getDTBPtr(tc)->flushProcesses(); break; case IPR_DTB_IS: // really a control write ipr[idx] = val; - tc->getDTBPtr()->flushAddr(val, DTB_ASN_ASN(ipr[IPR_DTB_ASN])); + getDTBPtr(tc)->flushAddr(val, DTB_ASN_ASN(ipr[IPR_DTB_ASN])); break; case IPR_DTB_TAG: { @@ -395,7 +413,7 @@ ISA::setIpr(int idx, uint64_t val, ThreadContext *tc) entry.asn = DTB_ASN_ASN(ipr[IPR_DTB_ASN]); // insert new TAG/PTE value into data TLB - tc->getDTBPtr()->insert(val, entry); + getDTBPtr(tc)->insert(val, entry); } break; @@ -419,7 +437,7 @@ ISA::setIpr(int idx, uint64_t val, ThreadContext *tc) entry.asn = ITB_ASN_ASN(ipr[IPR_ITB_ASN]); // insert new TAG/PTE value into data TLB - tc->getITBPtr()->insert(ipr[IPR_ITB_TAG], entry); + getITBPtr(tc)->insert(ipr[IPR_ITB_TAG], entry); } break; @@ -427,21 +445,21 @@ ISA::setIpr(int idx, uint64_t val, ThreadContext *tc) // really a control write ipr[idx] = 0; - tc->getITBPtr()->flushAll(); + getITBPtr(tc)->flushAll(); break; case IPR_ITB_IAP: // really a control write ipr[idx] = 0; - tc->getITBPtr()->flushProcesses(); + getITBPtr(tc)->flushProcesses(); break; case IPR_ITB_IS: // really a control write ipr[idx] = val; - tc->getITBPtr()->flushAddr(val, ITB_ASN_ASN(ipr[IPR_ITB_ASN])); + getITBPtr(tc)->flushAddr(val, ITB_ASN_ASN(ipr[IPR_ITB_ASN])); break; default: |