arch-riscv: Move pmpReset implementation to MMU::reset() (#1406)

The PMP is part of RISC-V MMU subssystem, it should be put in
RiscvISA::MMU::reset()
This commit is contained in:
Yu-Cheng Chang
2024-08-06 05:21:48 +08:00
committed by GitHub
parent edd73bd330
commit 5df08fdb08
2 changed files with 11 additions and 6 deletions

View File

@@ -188,13 +188,10 @@ Reset::invoke(ThreadContext *tc, const StaticInstPtr &inst)
new_pc->vl(0);
tc->pcState(*new_pc);
// Reset PMP Cfg
auto* mmu = dynamic_cast<RiscvISA::MMU*>(tc->getMMUPtr());
if (mmu == nullptr) {
warn("MMU is not Riscv MMU instance, we can't reset PMP");
return;
auto* mmu = tc->getMMUPtr();
if (mmu != nullptr) {
mmu->reset();
}
mmu->getPMP()->pmpReset();
}
void

View File

@@ -42,6 +42,7 @@
#include "arch/riscv/isa.hh"
#include "arch/riscv/page_size.hh"
#include "arch/riscv/pma_checker.hh"
#include "arch/riscv/pmp.hh"
#include "arch/riscv/tlb.hh"
#include "params/RiscvMMU.hh"
@@ -60,6 +61,13 @@ class MMU : public BaseMMU
: BaseMMU(p), pma(p.pma_checker)
{}
void
reset() override
{
// Reset PMP Cfg
getPMP()->pmpReset();
}
TranslationGenPtr
translateFunctional(Addr start, Addr size, ThreadContext *tc,
Mode mode, Request::Flags flags) override