riscv: set pmp configuration if kernel is running in M-mode
authorGreentime Hu <greentime.hu@sifive.com>
Thu, 9 Jan 2020 03:17:40 +0000 (11:17 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Tue, 18 Feb 2020 17:41:24 +0000 (09:41 -0800)
commitc68a9032299e837b56d356de9250c93094f7e0e3
treec5bc94625a84d1d6f3568c344ab300a9b996f837
parent11a48a5a18c63fd7621bb050228cebf13566e4d8
riscv: set pmp configuration if kernel is running in M-mode

When the kernel is running in S-mode, the expectation is that the
bootloader or SBI layer will configure the PMP to allow the kernel to
access physical memory.  But, when the kernel is running in M-mode and is
started with the ELF "loader", there's probably no bootloader or SBI layer
involved to configure the PMP.  Thus, we need to configure the PMP
ourselves to enable the kernel to access all regions.

Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/csr.h
arch/riscv/kernel/head.S