xen/arm: traps: drop unreachable stage 2 decoding from panic_PAR()

panic_PAR() is only called from va_to_par(), which translates using
__va_to_par(), i.e. "at s1e2r" on arm64 and ATS1HR on arm32. Both
perform an EL2 stage 1 only translation, so PAR.S (PAR_STAGE2) and
PAR.PTW (PAR_STAGE21) can never be set.

This has been the case since commit a14447dbcf ("xen: arm: do not
panic when failing to translate a guest address"), which made
gva_to_par() and gva_to_ipa() return -EFAULT instead of calling
panic_PAR() for guest translations.

Print stage 1 unconditionally and keep an ASSERT() to document the
invariant. PAR_STAGE21 has no user left, so drop it. While at it, fix
the spacing in the decode_fsc() call.

No functional change intended.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
This commit is contained in:
Michal Orzel committed 2026-08-27 11:25:41 +02:00
1 parent 4e1f58ea1a
commit 79225a0c77
2 files changed
+9 -9

No files matched your search

-1
View File
@@ -507,7 +507,6 @@ extern register_t __cpu_logical_map[];
/* .... If F == 1 */
#define PAR_FSC_SHIFT (1)
#define PAR_FSC_MASK (_AC(0x3f,U)<<PAR_FSC_SHIFT)
#define PAR_STAGE21 (_AC(1,U)<<8) /* Stage 2 Fault During Stage 1 Walk */
#define PAR_STAGE2 (_AC(1,U)<<9) /* Stage 2 Fault */
/* If F == 0 */
+9 -8
View File
@@ -379,16 +379,17 @@ void panic_PAR(uint64_t par)
{
const char *msg;
int level = -1;
int stage = par & PAR_STAGE2 ? 2 : 1;
int second_in_first = !!(par & PAR_STAGE21);
msg = decode_fsc( (par&PAR_FSC_MASK) >> PAR_FSC_SHIFT, &level);
/*
* The only caller translates using "at s1e2r" (arm64) or ATS1HR
* (arm32), i.e. an EL2 stage 1 only translation.
*/
ASSERT(!(par & PAR_STAGE2));
printk("PAR: %016"PRIx64": %s stage %d%s%s\n",
par, msg,
stage,
second_in_first ? " during second stage lookup" : "",
fsc_level_str(level));
msg = decode_fsc((par & PAR_FSC_MASK) >> PAR_FSC_SHIFT, &level);
printk("PAR: %016"PRIx64": %s stage 1%s\n",
par, msg, fsc_level_str(level));
panic("Error during Hypervisor-to-physical address translation\n");
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.