[PATCH] lib: sbi: fix pmp_set: clear A befor setting

Xiang W wxjstz at 126.com
Mon Nov 8 01:43:03 PST 2021


Signed-off-by: Xiang W <wxjstz at 126.com>
---
 lib/sbi/riscv_asm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/sbi/riscv_asm.c b/lib/sbi/riscv_asm.c
index f6b8c8e..845039c 100644
--- a/lib/sbi/riscv_asm.c
+++ b/lib/sbi/riscv_asm.c
@@ -255,6 +255,7 @@ int pmp_set(unsigned int n, unsigned long prot, unsigned long addr,
 		return SBI_ENOTSUPP;
 
 	/* encode PMP config */
+	prot &= ~PMP_A;
 	prot |= (log2len == PMP_SHIFT) ? PMP_A_NA4 : PMP_A_NAPOT;
 	cfgmask = ~(0xffUL << pmpcfg_shift);
 	pmpcfg	= (csr_read_num(pmpcfg_csr) & cfgmask);
-- 
2.30.2




More information about the opensbi mailing list