Skip to contentSkip to conversation

powerpc/64s: Fix hash fault to use TRAP accessor

PATCH Applied Nicholas Piggin 2 participants 2 messages Mar 16, 2021 – Mar 31, 2021 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

PATCH 1/1 powerpc/64s: Fix hash fault to use TRAP accessor

Hash faults use the trap vector to decide whether this is an instruction or data fault. This should use the TRAP accessor rather than open access regs->trap.

This won't cause a problem at the moment because 64s only uses trap flags for system call interrupts (the norestart flag), but that could change if any other trap flags get used in future.

Fixes a4922f5442e7e ("powerpc/64s: move the hash fault handling logic to C")
---
 arch/powerpc/mm/book3s64/hash_utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/book3s64/hash_utils.c +2 -2
index 1c4b0a29f0f5..977da0dce80c 100644
@@ -1545,10 +1545,10 @@ DEFINE_INTERRUPT_HANDLER_RET(__do_hash_fault)
 	if (user_mode(regs) || (region_id == USER_REGION_ID))
 		access &= ~_PAGE_PRIVILEGED;
 
-	if (regs->trap == 0x400)
+	if (TRAP(regs) == 0x400)
 		access |= _PAGE_EXEC;
 
-	err = hash_page_mm(mm, ea, access, regs->trap, flags);
+	err = hash_page_mm(mm, ea, access, TRAP(regs), flags);
 	if (unlikely(err < 0)) {
 		// failed to instert a hash PTE due to an hypervisor error
 		if (user_mode(regs)) {
Signature · 1 line
2.23.0
#1 lore raw
Quoted 7 lines · Nicholas Piggin

Hash faults use the trap vector to decide whether this is an instruction or data fault. This should use the TRAP accessor rather than open access regs->trap.

This won't cause a problem at the moment because 64s only uses trap flags for system call interrupts (the norestart flag), but that could change if any other trap flags get used in future.

Applied to powerpc/next.

[1/1] powerpc/64s: Fix hash fault to use TRAP accessor

      https://git.kernel.org/powerpc/c/1479e3d3b7559133b0a107772b5841e9c2cad450

cheers