Skip to content

Commit

Permalink
target/arm/ptw: Report stage 2 fault level for stage 2 faults on stag…
Browse files Browse the repository at this point in the history
…e 1 ptw

When we report faults due to stage 2 faults during a stage 1
page table walk, the 'level' parameter should be the level
of the walk in stage 2 that faulted, not the level of the
walk in stage 1. Correct the reporting of these faults.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230807141514.19075-15-peter.maydell@linaro.org
  • Loading branch information
pm215 committed Aug 22, 2023
1 parent d53e250 commit a729d63
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions target/arm/ptw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2048,9 +2048,13 @@ static bool get_phys_addr_lpae(CPUARMState *env, S1Translate *ptw,
do_translation_fault:
fi->type = ARMFault_Translation;
do_fault:
fi->level = level;
/* Tag the error as S2 for failed S1 PTW at S2 or ordinary S2. */
fi->stage2 = fi->s1ptw || regime_is_stage2(mmu_idx);
if (fi->s1ptw) {
/* Retain the existing stage 2 fi->level */
assert(fi->stage2);
} else {
fi->level = level;
fi->stage2 = regime_is_stage2(mmu_idx);
}
fi->s1ns = fault_s1ns(ptw->in_space, mmu_idx);
return true;
}
Expand Down

0 comments on commit a729d63

Please sign in to comment.