summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Kondratiev <[email protected]>2026-02-23 16:54:41 +0200
committerAnup Patel <[email protected]>2026-02-25 18:49:03 +0530
commitea45923765de4145d174b98abc6b945c8407265e (patch)
tree2841457668d35ef32d51105236a1c16be8cdc5c6
parente58d5287020a4a474a6d04c7bcab800825d1a294 (diff)
lib: sbi_hart_pmp: disable unconfigured PMP entries
Disable PMP entries not configured in domain. These entries may contain values configured by the boot loader; disabling it to be certain PMP configuration is exactly as configured by the openSBI Signed-off-by: Vladimir Kondratiev <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
-rw-r--r--lib/sbi/sbi_hart_pmp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sbi/sbi_hart_pmp.c b/lib/sbi/sbi_hart_pmp.c
index be459129..02a3b3c4 100644
--- a/lib/sbi/sbi_hart_pmp.c
+++ b/lib/sbi/sbi_hart_pmp.c
@@ -204,6 +204,9 @@ static int sbi_hart_smepmp_configure(struct sbi_scratch *scratch)
sbi_hart_smepmp_set(scratch, dom, reg, pmp_idx++, pmp_flags,
pmp_log2gran, pmp_addr_max);
}
+ /* Disable remaining PMP entries */
+ for(; pmp_idx < pmp_count; pmp_idx++)
+ pmp_disable(pmp_idx);
/*
* All entries are programmed.
@@ -286,6 +289,9 @@ static int sbi_hart_oldpmp_configure(struct sbi_scratch *scratch)
reg->order);
}
}
+ /* Disable remaining PMP entries */
+ for(; pmp_idx < pmp_count; pmp_idx++)
+ pmp_disable(pmp_idx);
sbi_hart_pmp_fence();
return 0;