summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Chien Peter Lin <[email protected]>2025-10-08 16:44:39 +0800
committerAnup Patel <[email protected]>2025-11-02 16:06:51 +0530
commit90c3b94094d052e8109862a8b05d2885b1c3d879 (patch)
tree1df32b4a9a22c9cfe1dcaa1ec374dbde17260634
parent667eed22661a5c5a7b73654ea3ea81737a6a1188 (diff)
lib: sbi_domain: print unsupported SmePMP permissions
The reg->flag is encoded with 6 bits to specify RWX permissions for M-mode and S-/U-mode. However, only 16 of the possible encodings are valid on SmePMP. Add a warning message when an unsupported permission encoding is detected. Signed-off-by: Yu-Chien Peter Lin <[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_domain.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c
index 89250d4c..f7bd7d5b 100644
--- a/lib/sbi/sbi_domain.c
+++ b/lib/sbi/sbi_domain.c
@@ -125,6 +125,7 @@ void sbi_domain_memregion_init(unsigned long addr,
unsigned int sbi_domain_get_smepmp_flags(struct sbi_domain_memregion *reg)
{
unsigned int pmp_flags = 0;
+ unsigned long rstart, rend;
if ((reg->flags & SBI_DOMAIN_MEMREGION_ACCESS_MASK) == 0) {
/*
@@ -185,6 +186,11 @@ unsigned int sbi_domain_get_smepmp_flags(struct sbi_domain_memregion *reg)
pmp_flags |= PMP_W;
if (reg->flags & SBI_DOMAIN_MEMREGION_SU_EXECUTABLE)
pmp_flags |= PMP_X;
+ } else {
+ rstart = reg->base;
+ rend = (reg->order < __riscv_xlen) ? rstart + ((1UL << reg->order) - 1) : -1UL;
+ sbi_printf("%s: Unsupported Smepmp permissions on region 0x%"PRILX"-0x%"PRILX"\n",
+ __func__, rstart, rend);
}
return pmp_flags;