arch-arm: Use HCR_EL2.CD for stage2 table walks

When determining the cacheability of table walks,
SCTLR.C should only be used in stage1 EL1&0 translations.
Stage2 translations should rely on HCR_EL2.CD instead

Change-Id: I1b0830bc3fb5086f68d7a7a1560c7fed5d126d28
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
Giacomo Travaglini
2024-02-22 16:41:10 +00:00
parent 854662f48f
commit 09f0c20be2
2 changed files with 15 additions and 3 deletions

View File

@@ -283,6 +283,15 @@ TableWalker::drainResume()
}
}
bool
TableWalker::uncacheableWalk() const
{
bool disable_cacheability = isStage2 ?
currState->hcr.cd :
currState->sctlr.c == 0;
return disable_cacheability || currState->isUncacheable;
}
Fault
TableWalker::walk(const RequestPtr &_req, ThreadContext *_tc, uint16_t _asid,
vmid_t _vmid, MMU::Mode _mode,
@@ -664,7 +673,7 @@ TableWalker::processWalk()
currState->isSecure ? "s" : "ns");
Request::Flags flag = Request::PT_WALK;
if (currState->sctlr.c == 0 || currState->isUncacheable) {
if (uncacheableWalk()) {
flag.set(Request::UNCACHEABLE);
}
@@ -819,7 +828,7 @@ TableWalker::processWalkLPAE()
desc_addr, currState->isSecure ? "s" : "ns");
}
if (currState->sctlr.c == 0 || currState->isUncacheable) {
if (uncacheableWalk()) {
flag.set(Request::UNCACHEABLE);
}
@@ -1057,7 +1066,7 @@ TableWalker::processWalkAArch64()
}
Request::Flags flag = Request::PT_WALK;
if (currState->sctlr.c == 0 || currState->isUncacheable) {
if (uncacheableWalk()) {
flag.set(Request::UNCACHEABLE);
}

View File

@@ -1188,6 +1188,9 @@ class TableWalker : public ClockedObject
/// system-wide setting or by the TCR_ELx IPS/PS setting
bool checkAddrSizeFaultAArch64(Addr addr, int pa_range);
/// Returns true if the table walk should be uncacheable
bool uncacheableWalk() const;
Fault processWalkAArch64();
void processWalkWrapper();
EventFunctionWrapper doProcessEvent;