platform: rzfive: Call andes_pma_setup_regions() only during cold boot

This function accesses the FDT blob, which means it is only valid to
call during cold boot, before a lower privilege level has an opportunity
to clobber that memory.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20250325234342.711447-3-samuel.holland@sifive.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2025-03-25 16:43:25 -07:00
committed by Anup Patel
parent 2a6f7ddf87
commit ac2e428c4b

View File

@@ -27,8 +27,16 @@ static const struct andes_pma_region renesas_rzfive_pma_regions[] = {
static int renesas_rzfive_final_init(bool cold_boot, void *fdt,
const struct fdt_match *match)
{
return andes_pma_setup_regions(fdt, renesas_rzfive_pma_regions,
array_size(renesas_rzfive_pma_regions));
int rc;
if (cold_boot) {
rc = andes_pma_setup_regions(fdt, renesas_rzfive_pma_regions,
array_size(renesas_rzfive_pma_regions));
if (rc)
return rc;
}
return 0;
}
static int renesas_rzfive_early_init(bool cold_boot, const void *fdt,