RISC-V: Use Zkr to seed KASLR base address
authorJesse Taube <jesse@rivosinc.com>
Tue, 9 Jul 2024 17:39:37 +0000 (13:39 -0400)
committerPalmer Dabbelt <palmer@rivosinc.com>
Mon, 5 Aug 2024 19:06:41 +0000 (12:06 -0700)
commit945302df3de156fc367d3b537cec76d4aea0b0d1
treec04368392031c8ed89fffbad0d54ef80342d7e72
parentb3311827155aca72498b8a0dfd0f2499b70d39b8
RISC-V: Use Zkr to seed KASLR base address

Parse the device tree for Zkr in the isa string.
If Zkr is present, use it to seed the kernel base address.

On an ACPI system, as of this commit, there is no easy way to check if
Zkr is present. Blindly running the instruction isn't an option as;
we have to be able to trust the firmware.

Signed-off-by: Jesse Taube <jesse@rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Tested-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240709173937.510084-5-jesse@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/pi/Makefile
arch/riscv/kernel/pi/archrandom_early.c [new file with mode: 0644]
arch/riscv/kernel/pi/fdt_early.c
arch/riscv/kernel/pi/pi.h
arch/riscv/mm/init.c