From b7618c69a511e3fde5cdb674a91e5683f92e770f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 22 Dec 2017 01:07:55 -0800 Subject: 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 Reviewed-by: Jason Lowe-Power --- src/cpu/checker/cpu.hh | 15 +++++---------- src/cpu/checker/thread_context.hh | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'src/cpu/checker') diff --git a/src/cpu/checker/cpu.hh b/src/cpu/checker/cpu.hh index 213106bd2..b1a457491 100644 --- a/src/cpu/checker/cpu.hh +++ b/src/cpu/checker/cpu.hh @@ -62,12 +62,7 @@ #include "params/CheckerCPU.hh" #include "sim/eventq.hh" -// forward declarations -namespace TheISA -{ - class TLB; -} - +class BaseTLB; template class BaseDynInst; class ThreadContext; @@ -140,8 +135,8 @@ class CheckerCPU : public BaseCPU, public ExecContext ThreadContext *tc; - TheISA::TLB *itb; - TheISA::TLB *dtb; + BaseTLB *itb; + BaseTLB *dtb; Addr dbg_vtophys(Addr addr); @@ -166,8 +161,8 @@ class CheckerCPU : public BaseCPU, public ExecContext // Primary thread being run. SimpleThread *thread; - TheISA::TLB* getITBPtr() { return itb; } - TheISA::TLB* getDTBPtr() { return dtb; } + BaseTLB* getITBPtr() { return itb; } + BaseTLB* getDTBPtr() { return dtb; } virtual Counter totalInsts() const override { diff --git a/src/cpu/checker/thread_context.hh b/src/cpu/checker/thread_context.hh index 5208932de..975bd9f96 100644 --- a/src/cpu/checker/thread_context.hh +++ b/src/cpu/checker/thread_context.hh @@ -112,9 +112,9 @@ class CheckerThreadContext : public ThreadContext actualTC->setThreadId(id); } - TheISA::TLB *getITBPtr() { return actualTC->getITBPtr(); } + BaseTLB *getITBPtr() { return actualTC->getITBPtr(); } - TheISA::TLB *getDTBPtr() { return actualTC->getDTBPtr(); } + BaseTLB *getDTBPtr() { return actualTC->getDTBPtr(); } CheckerCPU *getCheckerCpuPtr() { -- cgit v1.2.3