File Index
Files and directories
Sign in
FILE

archrandom_early.c

File preview with syntax highlighting.

linux-6.19.14/arch/riscv/kernel/pi/archrandom_early.c C
 1// SPDX-License-Identifier: GPL-2.0-only
 2
 3#include <asm/csr.h>
 4#include <linux/processor.h>
 5
 6#include "pi.h"
 7
 8/*
 9 * To avoid rewriting code include asm/archrandom.h and create macros
10 * for the functions that won't be included.
11 */
12#undef riscv_has_extension_unlikely
13#define riscv_has_extension_likely(...) false
14#undef pr_err_once
15#define pr_err_once(...)
16
17#include <asm/archrandom.h>
18
19u64 get_kaslr_seed_zkr(const uintptr_t dtb_pa)
20{
21	unsigned long seed = 0;
22
23	if (!fdt_early_match_extension_isa((const void *)dtb_pa, "zkr"))
24		return 0;
25
26	if (!csr_seed_long(&seed))
27		return 0;
28
29	return seed;
30}
~/ Read-only file preview.