riscv: libstub: Implement KASLR by using generic functions
authorAlexandre Ghiti <alexghiti@rivosinc.com>
Sat, 22 Jul 2023 12:38:50 +0000 (14:38 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 6 Sep 2023 02:49:31 +0000 (19:49 -0700)
commitb7ac4b8ee73d4fec0998664c9dd61f089d481044
tree2cac0600d5be537d83ded5db31188abdf46f0f2e
parent3c35d1a03c8b864f08088d51e121aa7c0067b146
riscv: libstub: Implement KASLR by using generic functions

We can now use arm64 functions to handle the move of the kernel physical
mapping: if KASLR is enabled, we will try to get a random seed from the
firmware, if not possible, the kernel will be moved to a location that
suits its alignment constraints.

Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Tested-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Song Shuai <songshuaishuai@tinylab.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Tested-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20230722123850.634544-6-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/efi.h
arch/riscv/kernel/image-vars.h
drivers/firmware/efi/libstub/Makefile
drivers/firmware/efi/libstub/riscv-stub.c