mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-11-19 02:21:38 +00:00
SpacemiT K3 has 16 harts split across four clusters, with eight X100 harts in C0/C1 and eight A100 harts in C2/C3. Only hart 0 is powered at reset, so secondary harts cannot reach the OpenSBI warm-boot path until the platform removes their PMU power-down votes and wakes them. Add a start-only HSM backend which performs those operations for the requested hart. This lets the common HSM state machine start secondary harts on demand instead of waking every hart during cold boot. Select the HSM backend from the root compatible, preserving K1's existing start and stop behavior. The Boot ROM maps the audio buffer region as I/O although later firmware uses it as normal memory. Restore its cacheable PMA attribute and mark the XIP region as I/O before enabling caches. The boot hart performs the per-hart setup during early platform discovery, while secondary harts do the same in their assembly entry before reaching common warm-boot code. This also enables MISA.H on X100 before common code selects its trap entry; A100 does not implement H. Fence the PMA and guest translation changes before continuing. Use assembler-safe constants shared by the C and warm-entry assembly paths. Since K1 and K3 are RV64-only, omit the SpacemiT platform objects from RV32 generic builds. Program the four cluster warm-boot vectors once and enable CCI-550 snoop and DVM requests before any secondary hart is started. Signed-off-by: Xianbin Zhu <xianbin.zhu@linux.spacemit.com> Tested-by: E Shattow <e@freeshell.de> Co-developed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20261028-spacemit-k3-v6-5-01d984f60941@linux.spacemit.com Signed-off-by: Anup Patel <anup@brainfault.org>
53 lines
1.3 KiB
ArmAsm
53 lines
1.3 KiB
ArmAsm
/* SPDX-License-Identifier: BSD-2-Clause */
|
|
/*
|
|
* Copyright (c) 2026 SpacemiT
|
|
* Authors:
|
|
* Xianbin Zhu <xianbin.zhu@linux.spacemit.com>
|
|
* Troy Mitchell <troy.mitchell@linux.spacemit.com>
|
|
*/
|
|
|
|
#define __ASSEMBLY__
|
|
#include <spacemit/common.h>
|
|
#include <spacemit/k3.h>
|
|
|
|
.section .entry, "ax", %progbits
|
|
.align 3
|
|
.globl _spacemit_k3_warm_start
|
|
_spacemit_k3_warm_start:
|
|
/* Program PMA attributes before enabling the caches. */
|
|
li t0, (PMACFG0_AUDIO_BUF_FIELD_MASK << \
|
|
PMACFG0_AUDIO_BUF_FIELD_SHIFT)
|
|
csrc CSR_PMACFG0, t0
|
|
li t0, (PMACFG0_AUDIO_BUF_ATTR_CACHEABLE << \
|
|
PMACFG0_AUDIO_BUF_FIELD_SHIFT)
|
|
csrs CSR_PMACFG0, t0
|
|
li t0, PMACFG0_XIP_FIELD_CLEAR
|
|
csrc CSR_PMACFG0, t0
|
|
li t0, PMACFG0_XIP_ATTR_IO
|
|
csrs CSR_PMACFG0, t0
|
|
sfence.vma
|
|
|
|
/* Enable L1 snooping and L2 prefetch for this hart. */
|
|
csrr t0, mhartid
|
|
andi t0, t0, (PLATFORM_MAX_CPUS_PER_CLUSTER - 1)
|
|
li t1, 1
|
|
sll t1, t1, t0
|
|
li t2, (ML2SETUP_IPRF | ML2SETUP_TPRF)
|
|
or t1, t1, t2
|
|
csrs CSR_ML2SETUP, t1
|
|
li t0, ML2HINT_TRACE_TOP_ICGEN
|
|
csrs CSR_ML2HINT, t0
|
|
|
|
li t0, MSETUP_BOOT_FLAGS
|
|
csrs CSR_MSETUP, t0
|
|
|
|
/* Enable H before common code selects the per-hart trap entry. */
|
|
csrr t0, mhartid
|
|
li t1, PLATFORM_A100_FIRST_ID
|
|
bgeu t0, t1, 1f
|
|
li t0, MISA_EXT_H
|
|
csrs misa, t0
|
|
.word 0x62000073 /* hfence.gvma */
|
|
1:
|
|
j _start_warm
|