mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-11-20 10:32:19 +00:00
platform: generic: spacemit: k1: move hart init to nascent hook
cold_boot_allowed() is a policy query and should not modify per-hart
state. The K1 callback currently programs ML2SETUP as a side effect.
Move the ML2SETUP programming to nascent_init(), which runs on every
hart before common initialization. Chain generic_nascent_init() to keep
the generic per-hart setup intact.
Fixes: 1f84ec2ac2 ("platform: generic: spacemit: add K1")
Reported-by: Bo Gan <ganboing@gmail.com>
Link: https://lore.kernel.org/r/56220293-88e3-451f-833e-8251656a83d9@gmail.com
Reviewed-by: Bo Gan <ganboing@gmail.com>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Tested-by: E Shattow <e@freeshell.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20261028-spacemit-k3-v6-3-01d984f60941@linux.spacemit.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
1 parent
2c4172cd3c
commit
acc2508c47
1 file changed
+10
-2
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <platform_override.h>
|
#include <platform_override.h>
|
||||||
|
#include <sbi/riscv_asm.h>
|
||||||
#include <sbi/riscv_io.h>
|
#include <sbi/riscv_io.h>
|
||||||
#include <sbi/sbi_hsm.h>
|
#include <sbi/sbi_hsm.h>
|
||||||
#include <spacemit/k1.h>
|
#include <spacemit/k1.h>
|
||||||
@@ -86,16 +87,23 @@ static int spacemit_k1_early_init(bool cold_boot)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int spacemit_k1_nascent_init(void)
|
||||||
|
{
|
||||||
|
csr_set(CSR_ML2SETUP,
|
||||||
|
BIT(current_hartid() % PLATFORM_MAX_CPUS_PER_CLUSTER));
|
||||||
|
|
||||||
|
return generic_nascent_init();
|
||||||
|
}
|
||||||
|
|
||||||
static bool spacemit_cold_boot_allowed(u32 hartid)
|
static bool spacemit_cold_boot_allowed(u32 hartid)
|
||||||
{
|
{
|
||||||
csr_set(CSR_ML2SETUP, 1 << (hartid % PLATFORM_MAX_CPUS_PER_CLUSTER));
|
|
||||||
|
|
||||||
return !hartid;
|
return !hartid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int spacemit_k1_platform_init(const void *fdt, int nodeoff,
|
static int spacemit_k1_platform_init(const void *fdt, int nodeoff,
|
||||||
const struct fdt_match *match)
|
const struct fdt_match *match)
|
||||||
{
|
{
|
||||||
|
generic_platform_ops.nascent_init = spacemit_k1_nascent_init;
|
||||||
generic_platform_ops.early_init = spacemit_k1_early_init;
|
generic_platform_ops.early_init = spacemit_k1_early_init;
|
||||||
generic_platform_ops.cold_boot_allowed = spacemit_cold_boot_allowed;
|
generic_platform_ops.cold_boot_allowed = spacemit_cold_boot_allowed;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user