From: Giacomo Travaglini Date: Sun, 13 Sep 2020 14:44:29 +0000 (+0100) Subject: arch-sparc: Replace any getDTBPtr/getITBPtr usage X-Git-Tag: develop-gem5-snapshot~556 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=18f2e3ab3cbfdfb30e387ee904271c7b3f037521;p=gem5.git arch-sparc: Replace any getDTBPtr/getITBPtr usage JIRA: https://gem5.atlassian.net/browse/GEM5-790 Change-Id: I931b7b4203b9ae18f46e2d985c7c7b5b339cb9e6 Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34982 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/src/arch/sparc/faults.cc b/src/arch/sparc/faults.cc index 33ba921db..53e75765f 100644 --- a/src/arch/sparc/faults.cc +++ b/src/arch/sparc/faults.cc @@ -30,9 +30,9 @@ #include +#include "arch/sparc/mmu.hh" #include "arch/sparc/process.hh" #include "arch/sparc/se_workload.hh" -#include "arch/sparc/tlb.hh" #include "arch/sparc/types.hh" #include "base/bitfield.hh" #include "base/trace.hh" @@ -669,8 +669,9 @@ FastInstructionAccessMMUMiss::invoke(ThreadContext *tc, // false for syscall emulation mode regardless of whether the // address is real in preceding code. Not sure sure that this is // correct, but also not sure if it matters at all. - dynamic_cast(tc->getITBPtr())-> - insert(alignedvaddr, partition_id, context_id, false, entry.pte); + static_cast(tc->getMMUPtr())->insertItlbEntry( + alignedvaddr, partition_id, context_id, + false, entry.pte); } void @@ -756,8 +757,9 @@ FastDataAccessMMUMiss::invoke(ThreadContext *tc, const StaticInstPtr &inst) // false for syscall emulation mode regardless of whether the // address is real in preceding code. Not sure sure that this is // correct, but also not sure if it matters at all. - dynamic_cast(tc->getDTBPtr())-> - insert(alignedvaddr, partition_id, context_id, false, entry.pte); + static_cast(tc->getMMUPtr())->insertDtlbEntry( + alignedvaddr, partition_id, context_id, + false, entry.pte); } void diff --git a/src/arch/sparc/mmu.hh b/src/arch/sparc/mmu.hh index 39f5008e4..f784015e2 100644 --- a/src/arch/sparc/mmu.hh +++ b/src/arch/sparc/mmu.hh @@ -39,6 +39,7 @@ #define __ARCH_SPARC_MMU_HH__ #include "arch/generic/mmu.hh" +#include "arch/sparc/tlb.hh" #include "params/SparcMMU.hh" @@ -50,6 +51,22 @@ class MMU : public BaseMMU MMU(const SparcMMUParams &p) : BaseMMU(p) {} + + void + insertItlbEntry(Addr vpn, int partition_id, int context_id, bool real, + const PageTableEntry& PTE, int entry=-1) + { + static_cast(itb)->insert(vpn, partition_id, + context_id, real, PTE, entry); + } + + void + insertDtlbEntry(Addr vpn, int partition_id, int context_id, bool real, + const PageTableEntry& PTE, int entry=-1) + { + static_cast(dtb)->insert(vpn, partition_id, + context_id, real, PTE, entry); + } }; } // namespace SparcISA diff --git a/src/arch/sparc/tlb.cc b/src/arch/sparc/tlb.cc index 20f316f21..9dde4ef78 100644 --- a/src/arch/sparc/tlb.cc +++ b/src/arch/sparc/tlb.cc @@ -33,6 +33,7 @@ #include "arch/sparc/asi.hh" #include "arch/sparc/faults.hh" #include "arch/sparc/interrupts.hh" +#include "arch/sparc/mmu.hh" #include "arch/sparc/registers.hh" #include "base/bitfield.hh" #include "base/compiler.hh" @@ -955,7 +956,7 @@ TLB::doMmuRegRead(ThreadContext *tc, Packet *pkt) DPRINTF(IPR, "Memory Mapped IPR Read: asi=%#X a=%#x\n", (uint32_t)pkt->req->getArchFlags(), pkt->getAddr()); - TLB *itb = dynamic_cast(tc->getITBPtr()); + TLB *itb = static_cast(tc->getMMUPtr()->itb); switch (asi) { case ASI_LSU_CONTROL_REG: @@ -1151,7 +1152,7 @@ TLB::doMmuRegWrite(ThreadContext *tc, Packet *pkt) DPRINTF(IPR, "Memory Mapped IPR Write: asi=%#X a=%#x d=%#X\n", (uint32_t)asi, va, data); - TLB *itb = dynamic_cast(tc->getITBPtr()); + TLB *itb = static_cast(tc->getMMUPtr()->itb); switch (asi) { case ASI_LSU_CONTROL_REG: @@ -1388,7 +1389,7 @@ void TLB::GetTsbPtr(ThreadContext *tc, Addr addr, int ctx, Addr *ptrs) { uint64_t tag_access = mbits(addr,63,13) | mbits(ctx,12,0); - TLB *itb = dynamic_cast(tc->getITBPtr()); + TLB *itb = static_cast(tc->getMMUPtr()->itb); ptrs[0] = MakeTsbPtr(Ps0, tag_access, c0_tsb_ps0, c0_config, diff --git a/src/arch/sparc/tlb.hh b/src/arch/sparc/tlb.hh index 929134308..4a15b8f7f 100644 --- a/src/arch/sparc/tlb.hh +++ b/src/arch/sparc/tlb.hh @@ -49,9 +49,7 @@ const Addr PAddrImplMask = ULL(0x000000FFFFFFFFFF); class TLB : public BaseTLB { - // These faults need to be able to populate the tlb in SE mode. - friend class FastInstructionAccessMMUMiss; - friend class FastDataAccessMMUMiss; + friend class MMU; // TLB state protected: