mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-17 21:50:44 -05:00
Some RISC-V implementations may hang when attempting to write an unsupported SATP mode, even though the latest RISC-V specification states such writes should have no effect. To avoid this issue, the logic for selecting SATP mode has been refined: The kernel now determines the SATP mode limit by taking the minimum of the value specified by the kernel command line (noXlvl) and the "mmu-type" property in the device tree (FDT). If only one is specified, use that. - If the resulting limit is sv48 or higher, the kernel will probe SATP modes from this limit downward until a supported mode is found. - If the limit is sv39, the kernel will directly use sv39 without probing. This ensures SATP mode selection is safe and compatible with both hardware and user configuration, minimizing the risk of hangs. Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech> Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Reviewed-by: Nutty Liu <liujingqi@lanxincomputing.com> Link: https://lore.kernel.org/r/20250722-satp-from-fdt-v1-2-5ba22218fa5f@pigmoral.tech Signed-off-by: Paul Walmsley <pjw@kernel.org>
22 lines
662 B
C
22 lines
662 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _RISCV_PI_H_
|
|
#define _RISCV_PI_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
/*
|
|
* The following functions are exported (but prefixed). Declare them here so
|
|
* that LLVM does not complain it lacks the 'static' keyword (which, if
|
|
* added, makes LLVM complain because the function is unused).
|
|
*/
|
|
|
|
u64 get_kaslr_seed(uintptr_t dtb_pa);
|
|
u64 get_kaslr_seed_zkr(const uintptr_t dtb_pa);
|
|
bool set_nokaslr_from_cmdline(uintptr_t dtb_pa);
|
|
u64 set_satp_mode_from_cmdline(uintptr_t dtb_pa);
|
|
u64 set_satp_mode_from_fdt(uintptr_t dtb_pa);
|
|
|
|
bool fdt_early_match_extension_isa(const void *fdt, const char *ext_name);
|
|
|
|
#endif /* _RISCV_PI_H_ */
|