linux/arch/powerpc
Michael Ellerman fd1eaaaaa6 powerpc/64s: Use EMIT_WARN_ENTRY for SRR debug warnings
When CONFIG_PPC_RFI_SRR_DEBUG=y we check the SRR values before returning
from interrupts. This is done in asm using EMIT_BUG_ENTRY, and passing
BUGFLAG_WARNING.

However that fails to create an exception table entry for the warning,
and so do_program_check() fails the exception table search and proceeds
to call _exception(), resulting in an oops like:

  Oops: Exception in kernel mode, sig: 5 [#1]
  LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
  Modules linked in:
  CPU: 2 PID: 1204 Comm: sigreturn_unali Tainted: P                  5.16.0-rc2-00194-g91ca3d4f77c5 #12
  NIP:  c00000000000c5b0 LR: 0000000000000000 CTR: 0000000000000000
  ...
  NIP [c00000000000c5b0] system_call_common+0x150/0x268
  LR [0000000000000000] 0x0
  Call Trace:
  [c00000000db73e10] [c00000000000c558] system_call_common+0xf8/0x268 (unreliable)
  ...
  Instruction dump:
  7cc803a6 888d0931 2c240000 4082001c 38800000 988d0931 e8810170 e8a10178
  7c9a03a6 7cbb03a6 7d7a02a6 e9810170 <7f0b6088> 7d7b02a6 e9810178 7f0b6088

We should instead use EMIT_WARN_ENTRY, which creates an exception table
entry for the warning, allowing the warning to be correctly recognised,
and the code to resume after printing the warning.

Note however that because this warning is buried deep in the interrupt
return path, we are not able to recover from it (due to MSR_RI being
clear), so we still end up in die() with an unrecoverable exception.

Fixes: 59dc5bfca0 ("powerpc/64s: avoid reloading (H)SRR registers if they are still valid")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211221135101.2085547-2-mpe@ellerman.id.au
2021-12-25 10:56:01 +11:00
..
boot powerpc/toc: Future proof kernel toc 2021-12-23 22:35:01 +11:00
configs powerpc/microwatt: add POWER9_CPU, clear PPC_64S_HASH_MMU 2021-12-09 22:41:16 +11:00
crypto powerpc: flexible GPR range save/restore macros 2021-11-29 23:15:20 +11:00
include powerpc/code-patching: Replace patch_instruction() by ppc_inst_write() in selftests 2021-12-23 22:36:58 +11:00
kernel powerpc/64s: Use EMIT_WARN_ENTRY for SRR debug warnings 2021-12-25 10:56:01 +11:00
kexec powerpc/kernel: Add __init attribute to eligible functions 2021-12-23 22:33:10 +11:00
kvm Merge branch 'topic/ppc-kvm' into next 2021-12-15 11:29:53 +11:00
lib powerpc/32: Fix boot failure with GCC latent entropy plugin 2021-12-23 22:36:58 +11:00
math-emu
mm powerpc/code-patching: Move patch_exception() outside code-patching.c 2021-12-23 22:36:55 +11:00
net bpf ppc32: Access only if addr is kernel address 2021-11-25 11:25:32 +11:00
perf powerpc/perf: Fix spelling of "its" 2021-12-23 22:36:58 +11:00
platforms powerpc/mm: Switch obsolete dssall to .long 2021-12-23 22:35:13 +11:00
purgatory
sysdev powerpc/pasemi: Add __init attribute to eligible functions 2021-12-23 22:33:14 +11:00
tools
xmon powerpc/xmon: Add __init attribute to eligible functions 2021-12-23 22:33:12 +11:00
Kbuild
Kconfig powerpc/64s: Move hash MMU support code under CONFIG_PPC_64S_HASH_MMU 2021-12-09 22:41:13 +11:00
Kconfig.debug
Makefile powerpc: check for support for -Wa,-m{power4,any} 2021-12-23 22:35:12 +11:00
Makefile.postlink