You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2023/10/30 15:26:46 UTC

(nuttx) 01/03: mpfs_opensbi: Remove mpfs_opensbi_pmp_setup

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 17a7a7bd7653e30b50b3782190a233578fa828e0
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Tue Oct 10 10:36:39 2023 +0300

    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 769e9075a0..37bdc8c052 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);