]> git.baikalelectronics.ru Git - kernel.git/commit
RISC-V: Check clint_time_val before use
authorAnup Patel <anup.patel@wdc.com>
Sun, 27 Sep 2020 05:39:16 +0000 (11:09 +0530)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Wed, 30 Sep 2020 18:05:14 +0000 (11:05 -0700)
commitbe7a29e0983934423142a9e546d50f4985a4d534
tree82f0d59e8e554944c3941d2197f58789e1e71c8c
parente9d8a0e9d5f9a4279883a7168fc1ecd09e7d8dd9
RISC-V: Check clint_time_val before use

The NoMMU kernel is broken for QEMU virt machine from Linux-5.9-rc6
because clint_time_val is used even before CLINT driver is probed
at following places:
1. rand_initialize() calls get_cycles() which in-turn uses
   clint_time_val
2. boot_init_stack_canary() calls get_cycles() which in-turn
   uses clint_time_val

The issue#1 (above) is fixed by providing custom random_get_entropy()
for RISC-V NoMMU kernel. For issue#2 (above), we remove dependency of
boot_init_stack_canary() on get_cycles() and this is aligned with the
boot_init_stack_canary() implementations of ARM, ARM64 and MIPS kernel.

Fixes: 0db46a28e92b ("RISC-V: Resurrect the MMIO timer implementation for M-mode systems")
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Tested-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/stackprotector.h
arch/riscv/include/asm/timex.h