linux_dsm_epyc7002/arch/powerpc/platforms/pseries
Mahesh Salgaonkar cd813e1cd7 powerpc/pseries: Fix endianness while restoring of r3 in MCE handler.
During Machine Check interrupt on pseries platform, register r3 points
RTAS extended event log passed by hypervisor. Since hypervisor uses r3
to pass pointer to rtas log, it stores the original r3 value at the
start of the memory (first 8 bytes) pointed by r3. Since hypervisor
stores this info and rtas log is in BE format, linux should make
sure to restore r3 value in correct endian format.

Without this patch when MCE handler, after recovery, returns to code that
that caused the MCE may end up with Data SLB access interrupt for invalid
address followed by kernel panic or hang.

  Severe Machine check interrupt [Recovered]
    NIP [d00000000ca301b8]: init_module+0x1b8/0x338 [bork_kernel]
    Initiator: CPU
    Error type: SLB [Multihit]
      Effective address: d00000000ca70000
  cpu 0xa: Vector: 380 (Data SLB Access) at [c0000000fc7775b0]
      pc: c0000000009694c0: vsnprintf+0x80/0x480
      lr: c0000000009698e0: vscnprintf+0x20/0x60
      sp: c0000000fc777830
     msr: 8000000002009033
     dar: a803a30c000000d0
    current = 0xc00000000bc9ef00
    paca    = 0xc00000001eca5c00	 softe: 3	 irq_happened: 0x01
      pid   = 8860, comm = insmod
  vscnprintf+0x20/0x60
  vprintk_emit+0xb4/0x4b0
  vprintk_func+0x5c/0xd0
  printk+0x38/0x4c
  init_module+0x1c0/0x338 [bork_kernel]
  do_one_initcall+0x54/0x230
  do_init_module+0x8c/0x248
  load_module+0x12b8/0x15b0
  sys_finit_module+0xa8/0x110
  system_call+0x58/0x6c
  --- Exception: c00 (System Call) at 00007fff8bda0644
  SP (7fffdfbfe980) is in userspace

This patch fixes this issue.

Fixes: a08a53ea4c ("powerpc/le: Enable RTAS events support")
Cc: stable@vger.kernel.org # v3.15+
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2018-08-10 22:12:34 +10:00
..
cmm.c powerpc: Use octal numbers for file permissions 2018-01-22 05:48:33 +11:00
dlpar.c powerpc/pseries: Make RAS IRQ explicitly dependent on DLPAR WQ 2018-01-08 14:54:32 +11:00
dtl.c powerpc: Create asm/debugfs.h and move powerpc_debugfs_root there 2017-04-11 07:46:03 +10:00
eeh_pseries.c powerpc/eeh: Add EEH operations to notify resume 2018-01-27 20:02:52 +11:00
event_sources.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
firmware.c powerpc/firmware: Add definitions for new drc-info firmware feature 2018-01-21 16:21:40 +11:00
hotplug-cpu.c Merge branch 'topic/paca' into next 2018-03-31 09:09:36 +11:00
hotplug-memory.c powerpc: Move of_drconf_cell struct to asm/drmem.h 2018-01-16 23:26:29 +11:00
hvCall_inst.c powerpc/pseries: hcall_exit tracepoint retval should be signed 2018-05-10 23:17:43 +10:00
hvCall.S powerpc: clean inclusions of asm/feature-fixups.h 2018-07-30 22:48:17 +10:00
hvconsole.c powerpc: Fix misspellings in comments. 2016-03-01 19:27:20 +11:00
hvcserver.c powerpc/pseries/hvcserver: don't memset pi_buff if it is null 2015-10-09 08:03:03 +11:00
ibmebus.c powerpc: Use octal numbers for file permissions 2018-01-22 05:48:33 +11:00
io_event_irq.c powerpc: Various typo fixes 2016-06-14 13:58:26 +10:00
iommu.c powerpc updates for 4.16 2018-02-02 10:01:04 -08:00
Kconfig License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kexec.c powerpc/xive: Remove xive_kexec_teardown_cpu() 2018-08-07 21:49:28 +10:00
lpar.c powerpc: remove unnecessary inclusion of asm/tlbflush.h 2018-07-30 22:48:20 +10:00
lparcfg.c powerpc/pseries: lparcfg calculate PURR on demand 2018-06-03 20:40:27 +10:00
Makefile powerpc/Makefiles: Convert ifeq to ifdef where possible 2018-08-08 00:32:36 +10:00
mobility.c powerpc: clean the inclusion of stringify.h 2018-07-30 22:48:17 +10:00
msi.c powerpc/pci: Remove OF node back pointer from pci_dn 2017-08-31 14:26:12 +10:00
nvram.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
of_helpers.c pseries/drc-info: Search DRC properties for CPU indexes 2018-01-21 16:21:46 +11:00
of_helpers.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
offline_states.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
pci_dlpar.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
pci.c powerpc/pseries/pci: Associate PEs to VFs in configure SR-IOV 2018-01-27 20:02:53 +11:00
power.c powerpc/sparse: Include headers containing prototypes 2016-06-16 22:40:19 +10:00
pseries_energy.c pseries/drc-info: Search DRC properties for CPU indexes 2018-01-21 16:21:46 +11:00
pseries.h powerpc/rfi-flush: Call setup_rfi_flush() after LPM migration 2018-03-27 19:25:14 +11:00
ras.c powerpc/pseries: Fix endianness while restoring of r3 in MCE handler. 2018-08-10 22:12:34 +10:00
reconfig.c powerpc: Use octal numbers for file permissions 2018-01-22 05:48:33 +11:00
rng.c powerpc: Use hardware RNG for arch_get_random_seed_* not arch_get_random_* 2015-07-23 19:52:03 +10:00
scanlog.c powerpc: Use octal numbers for file permissions 2018-01-22 05:48:33 +11:00
setup.c powerpc/pseries: Query hypervisor for count cache flush settings 2018-08-08 00:32:26 +10:00
smp.c Merge branch 'topic/paca' into next 2018-03-31 09:09:36 +11:00
suspend.c powerpc: Use octal numbers for file permissions 2018-01-22 05:48:33 +11:00
vio.c powerpc: rename dma_direct_ to dma_nommu_ 2018-01-10 16:41:14 +01:00