[RFC PATCH 16/23] platform: generic: eswin: verify PMP programming in final_init
Yu-Chien Peter Lin
peter.lin at sifive.com
Mon Nov 30 02:11:40 PST 2026
Check Eswin PMP programming in final_init and report failures rather
than silently accepting an incomplete map.
Signed-off-by: Yu-Chien Peter Lin <peter.lin at sifive.com>
---
platform/generic/eswin/eic770x.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/platform/generic/eswin/eic770x.c b/platform/generic/eswin/eic770x.c
index c71198a8..e69ead38 100644
--- a/platform/generic/eswin/eic770x.c
+++ b/platform/generic/eswin/eic770x.c
@@ -353,21 +353,32 @@ static int eswin_eic7700_final_init(bool cold_boot)
__func__);
return SBI_EFAIL;
}
- sbi_hart_pmp_set(pmp_idx++, sbi_domain_get_oldpmp_flags(reg),
- reg->base, reg->order);
+ rc = sbi_hart_pmp_set_verified(pmp_idx++,
+ sbi_domain_get_oldpmp_flags(reg),
+ reg->base, reg->order);
+ if (rc)
+ return rc;
}
- sbi_hart_pmp_set(PMP_RESERVED_A, PMP_L, EIC770X_L3_ZERO_REMOTE,
- log2roundup(EIC770X_L3_ZERO_SIZE));
+ rc = sbi_hart_pmp_set_verified(PMP_RESERVED_A, PMP_L,
+ EIC770X_L3_ZERO_REMOTE,
+ log2roundup(EIC770X_L3_ZERO_SIZE));
+ if (rc)
+ return rc;
/**
* Enable P550 internal + System Port, so OpenSBI can access
* CLINT/PLIC/UART. Might be overwritten in pmp_configure.
*/
- sbi_hart_pmp_set(PMP_FREE_A_START + PMP_FREE_A_COUNT - 1, 0, 0,
- log2roundup(EIC770X_MEMPORT_BASE));
+ rc = sbi_hart_pmp_set_verified(PMP_FREE_A_START + PMP_FREE_A_COUNT - 1,
+ 0, 0, log2roundup(EIC770X_MEMPORT_BASE));
+ if (rc)
+ return rc;
+
+ rc = sbi_hart_pmp_set_verified(PMP_RESERVED_B, PMP_L, 0,
+ log2roundup(EIC770X_MEMPORT_LIMIT));
+ if (rc)
+ return rc;
- sbi_hart_pmp_set(PMP_RESERVED_B, PMP_L, 0,
- log2roundup(EIC770X_MEMPORT_LIMIT));
/**
* These must come after the setup of PMP, as we are about to
* enable speculation and HW prefetcher bits
--
2.43.7
More information about the opensbi
mailing list