From 1f29491ece6af457fd58f2a3b2acd7b027056323 Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Fri, 28 Jun 2024 05:42:39 +0800 Subject: [PATCH] riscv/pmp: add all region in NAPOT This allows using 0 base and size to depict the whole region. Signed-off-by: Yanfeng Liu --- arch/risc-v/src/common/riscv_pmp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/risc-v/src/common/riscv_pmp.c b/arch/risc-v/src/common/riscv_pmp.c index 97b39b8fe8c0a..718cb4e693dd8 100644 --- a/arch/risc-v/src/common/riscv_pmp.c +++ b/arch/risc-v/src/common/riscv_pmp.c @@ -134,6 +134,13 @@ static bool pmp_check_region_attrs(uintptr_t base, uintptr_t size, case PMPCFG_A_NAPOT: { + /* Special range for the whole range */ + + if (base == 0 && size == 0) + { + return true; + } + /* For NAPOT, Naturally aligned power-of-two region, >= 8 bytes */ if ((base & 0x07) != 0 || size < 8 || (size & (size - 1)) != 0)