linux-snapdragon/arch/powerpc
Ganesh Goudar 722ee4b29a powerpc/mce: Fix access error in mce handler
commit 3a1e92d0896e928ac2a5b58962d05a39afef2e23 upstream.

We queue an irq work for deferred processing of mce event in realmode
mce handler, where translation is disabled. Queuing of the work may
result in accessing memory outside RMO region, such access needs the
translation to be enabled for an LPAR running with hash mmu else the
kernel crashes.

After enabling translation in mce_handle_error() we used to leave it
enabled to avoid crashing here, but now with the commit
74c3354bc1 ("powerpc/pseries/mce: restore msr before returning from
handler") we are restoring the MSR to disable translation.

Hence to fix this enable the translation before queuing the work.

Without this change following trace is seen on injecting SLB multihit in
an LPAR running with hash mmu.

  Oops: Kernel access of bad area, sig: 11 [#1]
  LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
  CPU: 5 PID: 1883 Comm: insmod Tainted: G        OE     5.14.0-mce+ #137
  NIP:  c000000000735d60 LR: c000000000318640 CTR: 0000000000000000
  REGS: c00000001ebff9a0 TRAP: 0300   Tainted: G       OE      (5.14.0-mce+)
  MSR:  8000000000001003 <SF,ME,RI,LE>  CR: 28008228  XER: 00000001
  CFAR: c00000000031863c DAR: c00000027fa8fe08 DSISR: 40000000 IRQMASK: 0
  ...
  NIP llist_add_batch+0x0/0x40
  LR  __irq_work_queue_local+0x70/0xc0
  Call Trace:
    0xc00000001ebffc0c (unreliable)
    irq_work_queue+0x40/0x70
    machine_check_queue_event+0xbc/0xd0
    machine_check_early_common+0x16c/0x1f4

Fixes: 74c3354bc1 ("powerpc/pseries/mce: restore msr before returning from handler")
Signed-off-by: Ganesh Goudar <ganeshgr@linux.ibm.com>
[mpe: Fix comment formatting, trim oops in change log for readability]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210909064330.312432-1-ganeshgr@linux.ibm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-22 12:39:22 +02:00
..
boot powerpc updates for 5.14 2021-07-02 12:54:34 -07:00
configs powerpc/config: Renable MTD_PHYSMAP_OF 2021-09-18 13:43:31 +02:00
crypto crypto: powepc/sha1 - remove unneeded semicolon 2021-03-07 15:13:14 +11:00
include KVM: PPC: Book3S HV Nested: Reflect guest PMU in-use to L0 when guest SPRs are live 2021-09-18 13:43:32 +02:00
kernel powerpc/mce: Fix access error in mce handler 2021-09-22 12:39:22 +02:00
kexec powerpc updates for 5.14 2021-07-02 12:54:34 -07:00
kvm KVM: PPC: Book3S HV: Tolerate treclaim. in fake-suspend mode changing registers 2021-09-22 12:39:22 +02:00
lib powerpc: Only build restart_table.c for 64s 2021-07-01 22:50:54 +10:00
math-emu powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
mm powerpc/numa: Consider the max NUMA node for migratable LPAR 2021-09-18 13:43:30 +02:00
net bpf: Introduce BPF nospec instruction for mitigating Spectre v4 2021-07-29 00:20:56 +02:00
perf powerpc/perf: Fix the check for SIAR value 2021-09-18 13:43:32 +02:00
platforms powerpc fixes for 5.14 #7 2021-08-28 10:40:41 -07:00
purgatory powerpc/kexec: Don't use .machine ppc64 in trampoline_64.S 2021-04-08 21:17:43 +10:00
sysdev powerpc/xive: Do not mark xive_request_ipi() as __init 2021-08-18 23:52:13 +10:00
tools
xmon powerpc updates for 5.14 2021-07-02 12:54:34 -07:00
Kbuild
Kconfig arch: Kconfig: clean up obsolete use of HAVE_IDE 2021-07-30 08:19:09 -06:00
Kconfig.debug powerpc: Make PPC_IRQ_SOFT_MASK_DEBUG depend on PPC64 2021-06-25 00:07:09 +10:00
Makefile Kbuild updates for v5.14 2021-07-10 11:01:38 -07:00
Makefile.postlink