From 17a7a7bd7653e30b50b3782190a233578fa828e0 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Tue, 10 Oct 2023 10:36:39 +0300 Subject: [PATCH] mpfs_opensbi: Remove mpfs_opensbi_pmp_setup The PMP setup should be done in the board specific code, at a much earlier stage. Granting all access is a security risk anyway. --- arch/risc-v/src/mpfs/mpfs_opensbi.c | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/arch/risc-v/src/mpfs/mpfs_opensbi.c b/arch/risc-v/src/mpfs/mpfs_opensbi.c index 769e9075a0d..37bdc8c052d 100644 --- a/arch/risc-v/src/mpfs/mpfs_opensbi.c +++ b/arch/risc-v/src/mpfs/mpfs_opensbi.c @@ -56,9 +56,6 @@ #define MPFS_ACLINT_MSWI_ADDR MPFS_CLINT_MSIP0 #define MPFS_ACLINT_MTIMER_ADDR MPFS_CLINT_MTIMECMP0 -#define MPFS_PMP_DEFAULT_ADDR 0xfffffffff -#define MPFS_PMP_DEFAULT_PERM 0x000000009f - #define MPFS_SYSREG_SOFT_RESET_CR (MPFS_SYSREG_BASE + \ MPFS_SYSREG_SOFT_RESET_CR_OFFSET) #define MPFS_SYSREG_SUBBLK_CLOCK_CR (MPFS_SYSREG_BASE + \ @@ -485,30 +482,6 @@ static void mpfs_opensbi_scratch_setup(uint32_t hartid) (unsigned long)__mpfs_nuttx_start; } -/**************************************************************************** - * Name: mpfs_opensbi_pmp_setup - * - * Description: - * Initializes the PMP registers in a known default state. All harts need - * to set these registers. - * - * Input Parameters: - * None - * - * Returned Value: - * None - * - ****************************************************************************/ - -static void mpfs_opensbi_pmp_setup(void) -{ - /* All access granted */ - - csr_write(pmpaddr0, MPFS_PMP_DEFAULT_ADDR); - csr_write(pmpcfg0, MPFS_PMP_DEFAULT_PERM); - csr_write(pmpcfg2, 0); -} - /**************************************************************************** * Name: mpfs_opensbi_vendor_ext_check * @@ -603,8 +576,6 @@ void __attribute__((noreturn)) mpfs_opensbi_setup(void) { uint32_t hartid = current_hartid(); - mpfs_opensbi_pmp_setup(); - sbi_console_set_device(&mpfs_console); mpfs_opensbi_scratch_setup(hartid);