WSL2-Linux-Kernel/arch/powerpc/platforms/pseries
Vasant Hegde 90a9b102ed powerpc/pseries: Do not initiate shutdown when system is running on UPS
As per PAPR we have to look for both EPOW sensor value and event
modifier to identify the type of event and take appropriate action.

In LoPAPR v1.1 section 10.2.2 includes table 136 "EPOW Action Codes":

  SYSTEM_SHUTDOWN 3

  The system must be shut down. An EPOW-aware OS logs the EPOW error
  log information, then schedules the system to be shut down to begin
  after an OS defined delay internal (default is 10 minutes.)

Then in section 10.3.2.2.8 there is table 146 "Platform Event Log
Format, Version 6, EPOW Section", which includes the "EPOW Event
Modifier":

  For EPOW sensor value = 3
  0x01 = Normal system shutdown with no additional delay
  0x02 = Loss of utility power, system is running on UPS/Battery
  0x03 = Loss of system critical functions, system should be shutdown
  0x04 = Ambient temperature too high
  All other values = reserved

We have a user space tool (rtas_errd) on LPAR to monitor for
EPOW_SHUTDOWN_ON_UPS. Once it gets an event it initiates shutdown
after predefined time. It also starts monitoring for any new EPOW
events. If it receives "Power restored" event before predefined time
it will cancel the shutdown. Otherwise after predefined time it will
shutdown the system.

Commit 79872e3546 ("powerpc/pseries: All events of
EPOW_SYSTEM_SHUTDOWN must initiate shutdown") changed our handling of
the "on UPS/Battery" case, to immediately shutdown the system. This
breaks existing setups that rely on the userspace tool to delay
shutdown and let the system run on the UPS.

Fixes: 79872e3546 ("powerpc/pseries: All events of EPOW_SYSTEM_SHUTDOWN must initiate shutdown")
Cc: stable@vger.kernel.org # v4.0+
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
[mpe: Massage change log and add PAPR references]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200820061844.306460-1-hegdevasant@linux.vnet.ibm.com
2020-08-20 22:55:54 +10:00
..
Kconfig powerpc/pseries: Implement paravirt qspinlocks for SPLPAR 2020-07-27 00:01:29 +10:00
Makefile powerpc/pseries/Makefile: Remove CONFIG_PPC_PSERIES check 2020-02-19 21:07:08 +11:00
cmm.c mm: remove unneeded includes of <asm/pgalloc.h> 2020-08-07 11:33:26 -07:00
dlpar.c powerpc updates for 5.3 2019-07-13 16:08:36 -07:00
dtl.c powerpc64: Break asm/percpu.h vs spinlock_types.h dependency 2020-07-10 12:00:01 +02:00
eeh_pseries.c powerpc/eeh: Move PE tree setup into the platform 2020-07-26 23:34:21 +10:00
event_sources.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
firmware.c powerpc/book3s64/radix: Add kernel command line option to disable radix GTSE 2020-07-29 21:09:37 +10:00
hotplug-cpu.c powerpc/pseries/hotplug-cpu: wait indefinitely for vCPU death 2020-08-18 17:09:52 +10:00
hotplug-memory.c pseries: Fix 64 bit logical memory block panic 2020-07-16 13:12:45 +10:00
hvCall.S treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
hvCall_inst.c powerpc: pseries: no need to check return value of debugfs_create functions 2019-11-02 18:09:10 +01:00
hvconsole.c powerpc updates for 5.3 2019-07-13 16:08:36 -07:00
hvcserver.c powerpc: Use fallthrough pseudo-keyword 2020-07-29 21:09:37 +10:00
ibmebus.c powerpc/pseries: Make vio and ibmebus initcalls pseries specific 2020-06-02 22:21:31 +10:00
io_event_irq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
iommu.c powerpc/pseries/ddw: Extend upper limit for huge DMA window for persistent memory 2020-04-03 12:22:47 +11:00
kexec.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
lpar.c powerpc updates for 5.9 2020-08-07 10:33:50 -07:00
lparcfg.c powerpc updates for 5.6 2020-02-04 13:06:46 +00:00
mobility.c powerpc/pseries/mobility: Add pr_debug() for device tree changes 2020-07-30 22:53:49 +10:00
msi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441 2019-06-05 17:37:17 +02:00
nvram.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
of_helpers.c powerpc/pseries: Fix of_read_drc_info_cell() to point at next record 2020-03-25 12:06:43 +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
papr_scm.c powerpc/papr_scm: Add support for fetching nvdimm 'fuel-gauge' metric 2020-07-31 22:55:28 +10:00
pci.c powerpc/pcidn: Make VF pci_dn management CONFIG_PCI_IOV specific 2020-01-23 21:31:19 +11:00
pci_dlpar.c powerpc/eeh: Remove eeh_dev_phb_init_dynamic() 2020-07-26 23:34:19 +10:00
pmem.c powerpc/pseries: remove cede offline state for CPUs 2020-07-16 13:12:34 +10:00
power.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 167 2019-05-30 11:26:39 -07:00
pseries.h powerpc/pseries: Read TLB Block Invalidate Characteristics 2019-09-24 19:58:42 +10:00
pseries_energy.c powerpc/pseries: Fix drc-info mappings of logical cpus to drc-index 2019-11-13 16:57:57 +11:00
ras.c powerpc/pseries: Do not initiate shutdown when system is running on UPS 2020-08-20 22:55:54 +10:00
reconfig.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
rng.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
rtas-fadump.c powerpc: Replace _ALIGN_DOWN() by ALIGN_DOWN() 2020-05-11 23:15:15 +10:00
rtas-fadump.h powerpc/fadump: support holes in kernel boot memory area 2019-09-14 00:04:46 +10:00
scanlog.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
setup.c powerpc updates for 5.9 2020-08-07 10:33:50 -07:00
smp.c powerpc/pseries: Add KVM guest doorbell restrictions 2020-07-29 21:02:10 +10:00
suspend.c powerpc/numa: remove start/stop_topology_update() 2020-07-16 13:12:38 +10:00
svm.c powerpc64: Break asm/percpu.h vs spinlock_types.h dependency 2020-07-10 12:00:01 +02:00
vio.c powerpc/pseries: Make vio and ibmebus initcalls pseries specific 2020-06-02 22:21:31 +10:00
vphn.c powerpc/vphn: Check for error from hcall_vphn 2020-03-04 22:44:30 +11:00