From bce923c1891d85b9503523cb66fcf1511f30cd9d Mon Sep 17 00:00:00 2001 From: Dylan Johnson Date: Tue, 2 Aug 2016 10:38:03 +0100 Subject: [PATCH] arm: correctly assign faulting IPA's to HPFAR_EL2 This patch corrects IPA reporting if the translation faults in a stage 2 lookup. Change-Id: I0b914527f8a9f98a5e980a131cf9d03e5584b4e9 --- src/arch/arm/faults.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/arch/arm/faults.cc b/src/arch/arm/faults.cc index 621076fe5..0a39dbba6 100644 --- a/src/arch/arm/faults.cc +++ b/src/arch/arm/faults.cc @@ -969,7 +969,17 @@ AbortFault::invoke(ThreadContext *tc, const StaticInstPtr &inst) } else { // AArch64 // Set the FAR register. Nothing else to do if we are in AArch64 state // because the syndrome register has already been set inside invoke64() - tc->setMiscReg(AbortFault::getFaultAddrReg64(), faultAddr); + if (stage2) { + // stage 2 fault, set HPFAR_EL2 to the faulting IPA + // and FAR_EL2 to the Original VA + tc->setMiscReg(AbortFault::getFaultAddrReg64(), OVAddr); + tc->setMiscReg(MISCREG_HPFAR_EL2, bits(faultAddr, 47, 12) << 4); + + DPRINTF(Faults, "Abort Fault (Stage 2) VA: 0x%x IPA: 0x%x\n", + OVAddr, faultAddr); + } else { + tc->setMiscReg(AbortFault::getFaultAddrReg64(), faultAddr); + } } } -- 2.30.2