linux-stable/arch/riscv
Conor Dooley ed309ce522
RISC-V: mark hibernation as nonportable
Hibernation support depends on firmware marking its reserved/PMP
protected regions as not accessible from Linux.
The latest versions of the de-facto SBI implementation (OpenSBI) do
not do this, having dropped the no-map property to enable 1 GiB huge
page mappings by the kernel.
This was exposed by commit 3335068f87 ("riscv: Use PUD/P4D/PGD pages
for the linear mapping"), which made the first 2 MiB of DRAM (where SBI
typically resides) accessible by the kernel.
Attempting to hibernate with either OpenSBI, or other implementations
following its lead, will lead to a kernel panic ([1], [2]) as the
hibernation process will attempt to save/restore any mapped regions,
including the PMP protected regions in use by the SBI implementation.

Mark hibernation as depending on "NONPORTABLE", as only a small subset
of systems are capable of supporting it, until such time that an SBI
implementation independent way to communicate what regions are in use
has been agreed on.

As hibernation support landed in v6.4-rc1, disabling it for most
platforms does not constitute a regression. The alternative would have
been reverting commit 3335068f87 ("riscv: Use PUD/P4D/PGD pages for
the linear mapping").
Doing so would permit hibernation on platforms with these SBI
implementations, but would limit the options we have to solve the
protection of the region without causing a regression in hibernation
support.

Reported-by: Song Shuai <suagrfillet@gmail.com>
Link: https://lore.kernel.org/all/CAAYs2=gQvkhTeioMmqRDVGjdtNF_vhB+vm_1dHJxPNi75YDQ_Q@mail.gmail.com/ [1]
Reported-by: JeeHeng Sia <jeeheng.sia@starfivetech.com>
Link: https://groups.google.com/a/groups.riscv.org/g/sw-dev/c/ITXwaKfA6z8 [2]
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230526-astride-detonator-9ae120051159@wendy
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-05-29 06:38:04 -07:00
..
boot RISC-V Patches for the 6.4 Merge Window, Part 1 2023-04-28 16:55:39 -07:00
configs Remove orphaned CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT 2023-03-27 13:12:09 +02:00
errata RISC-V: fix sifive and thead section mismatches in errata 2023-04-29 13:18:19 -07:00
include Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
kernel riscv: Fix orphan section warnings caused by kernel/pi 2023-05-09 18:20:23 -07:00
kvm RISC-V Patches for the 6.4 Merge Window, Part 2 2023-05-05 12:23:33 -07:00
lib riscv: Allow to downgrade paging mode from the command line 2023-04-26 07:30:52 -07:00
mm riscv: Fix unused variable warning when BUILTIN_DTB is set 2023-05-24 06:59:35 -07:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2023-03-09 22:22:11 -08:00
purgatory purgatory: fix disabling debug info 2023-04-08 19:36:53 +09:00
tools riscv: Check relocations at compile time 2023-04-19 07:46:32 -07:00
Kbuild riscv: move errata/ and kvm/ builds to arch/riscv/Kbuild 2022-06-01 22:26:32 -07:00
Kconfig RISC-V: mark hibernation as nonportable 2023-05-29 06:38:04 -07:00
Kconfig.debug
Kconfig.errata Merge patch series "RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency" 2023-03-29 12:26:38 -07:00
Kconfig.socs RISC-V Patches for the 6.3 Merge Window, Part 1 2023-02-25 11:14:08 -08:00
Makefile RISC-V Patches for the 6.4 Merge Window, Part 1 2023-04-28 16:55:39 -07:00
Makefile.postlink riscv: Use --emit-relocs in order to move .rela.dyn in init 2023-04-19 07:46:33 -07:00