RISC-V: Cache SBI vendor values
From: Heiko Stuebner <heiko@...> Date: Tue, 4 Oct 2022 21:18:54 +0200
Commit-Message
sbi_get_mvendorid(), sbi_get_marchid() and sbi_get_mimpid() might get called multiple times, though the values of these CSRs should not change during the runtime of a specific machine. So cache the values in the functions and prevent multiple ecalls to read these values. As Andrew Jones noted, at least marchid and mimpid may be negative values when viewed as a long, so we use a separate static bool to indiciate the cached status. Suggested-by: Atish Patra <atishp@...> Signed-off-by: Heiko Stuebner <heiko@...>
Patch-Comment
arch/riscv/kernel/sbi.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
Statistics
- 27 lines added
- 3 lines removed