diff mbox series

[2/3] platform: generic: spacemit: k3: override cold_boot_allowed for hart 0 only

Message ID 20260831200832.404000-3-valentin.haudiquet@canonical.com
State New
Headers show
Series [1/3] platform: generic: spacemit: k3: de-vote cluster power-downs and ungate DMASYS before CCI enable | expand

Commit Message

Valentin Haudiquet Aug. 31, 2026, 8:07 p.m. UTC
Only hart 0 is powered at reset on K3.  Without overriding
cold_boot_allowed, the generic default checks a DTB hart mask which may
allow non-hart-0 harts to attempt cold boot, breaking the coldboot
lottery on a platform where only one hart is running.

Add spacemit_k3_cold_boot_allowed() returning true only for hart 0,
matching K1's pattern.

Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
---
 platform/generic/spacemit/k3.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Troy Mitchell Sept. 1, 2026, 5:45 a.m. UTC | #1
On Mon, Aug 31, 2026 at 10:07 PM +0200, Valentin Haudiquet wrote:
> Only hart 0 is powered at reset on K3.  Without overriding
> cold_boot_allowed, the generic default checks a DTB hart mask which may
> allow non-hart-0 harts to attempt cold boot, breaking the coldboot
> lottery on a platform where only one hart is running.
>
> Add spacemit_k3_cold_boot_allowed() returning true only for hart 0,
> matching K1's pattern.
>
> +static bool spacemit_k3_cold_boot_allowed(u32 hartid)
> +{
> +	return !hartid;
> +}

This matches the K3 boot contract and the vendor OpenSBI behavior. Only
hart 0 should participate in the cold-boot lottery; this does not affect
starting secondary harts later through HSM.

As you mentioned in the cover letter that I could take these patches, I
will include this patch in the next revision of my series, retaining your
authorship and Signed-off-by.

                                            - Troy
diff mbox series

Patch

diff --git a/platform/generic/spacemit/k3.c b/platform/generic/spacemit/k3.c
index 12c991b6..f134427d 100644
--- a/platform/generic/spacemit/k3.c
+++ b/platform/generic/spacemit/k3.c
@@ -138,11 +138,17 @@  static int spacemit_k3_early_init(bool cold_boot)
 	return generic_early_init(cold_boot);
 }
 
+static bool spacemit_k3_cold_boot_allowed(u32 hartid)
+{
+	return !hartid;
+}
+
 static int spacemit_k3_platform_init(const void *fdt, int nodeoff,
 				     const struct fdt_match *match)
 {
 	spacemit_k3_hart_init(current_hartid());
 	generic_platform_ops.early_init = spacemit_k3_early_init;
+	generic_platform_ops.cold_boot_allowed = spacemit_k3_cold_boot_allowed;
 
 	return 0;
 }