Skip to content

Commit 27c957a

Browse files
guoren83avpatel
authored andcommitted
lib: reset: Move fdt_reset_init into generic_early_init
The fdt_reset_thead driver needs to modify the __reset_thead_csr_stub text region for the secondary harts booting. After that, the sbi_hart_pmp_configure may lock down the text region with M_READABLE & M_EXECUTABLE attributes in the future. Currently, the M_READABLE & M_EXECUtABLE have no effect on m-mode, the L-bit in pmpcfg csr is useless for the current opensbi scenario. See: Priv-isa-spec 3.7.1.2. Locking and Privilege Mode When the L bit is clear, any M-mode access matching the PMP entry will succeed; the R/W/X permissions apply only to S and U modes. That's why current fdt_reset_thead could still work well after commit: 230278d ("lib: sbi: Add separate entries for firmware RX and RW regions"). So this patch fixes up a fake bug for the M-mode permission setting of the future. Fixes: 230278d ("lib: sbi: Add separate entries for firmware RX and RW regions") Link: http://lists.infradead.org/pipermail/opensbi/2023-June/005176.html Reported-by: Jessica Clarke <[email protected]> Signed-off-by: Guo Ren <[email protected]> Signed-off-by: Guo Ren <[email protected]> Reviewed-by: Anup Patel <[email protected]>
1 parent d64942f commit 27c957a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

platform/generic/platform.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ static int generic_nascent_init(void)
143143

144144
static int generic_early_init(bool cold_boot)
145145
{
146+
if (cold_boot)
147+
fdt_reset_init();
148+
146149
if (!generic_plat || !generic_plat->early_init)
147150
return 0;
148151

@@ -154,9 +157,6 @@ static int generic_final_init(bool cold_boot)
154157
void *fdt;
155158
int rc;
156159

157-
if (cold_boot)
158-
fdt_reset_init();
159-
160160
if (generic_plat && generic_plat->final_init) {
161161
rc = generic_plat->final_init(cold_boot, generic_plat_match);
162162
if (rc)

0 commit comments

Comments
 (0)