[PATCH v2 5/5] platform: generic: spacemit: k3: add platform support
Troy Mitchell
troy.mitchell at linux.spacemit.com
Wed Aug 26 19:53:47 PDT 2026
On Fri Aug 21, 2026 at 9:28 PM +08, Heinrich Schuchardt wrote:
> On 8/18/26 03:14, Troy Mitchell wrote:
>> From: Xianbin Zhu <xianbin.zhu at linux.spacemit.com>
>>
>> Add initial OpenSBI platform support for the SpacemiT K3 SoC, which has
>> 16 harts: eight X100 harts in clusters C0/C1 and eight A100 harts in
>> C2/C3.
>>
>> During cold boot, the boot hart sets warm-boot entry vectors for all
>> four clusters, enables CCI snooping, clears PMU power-down vote bits for
>> all harts so WFI does not trigger power-down, and wakes all non-boot
>> harts (1-15). Wait up to 100 ms for each secondary hart to enter WFI,
>> then warn and continue so one failed hart cannot stall boot indefinitely.
>>
>> Run per-hart initialization from the nascent hook on both cold- and
>> warm-boot paths. Program PMA attributes, enable the D-cache and I-cache
>> through MSETUP, set smpen[x] in ML2SETUP to enable L1 D-cache snooping
>> and prefetch, and enable the H extension in MISA for X100 harts. MISA.H
>> is writable on K3 X100 cores, and M-mode must set it explicitly to
>> activate hypervisor support.
>>
>> Start secondary harts through an assembly stub that enables caches and
>> sets smpen[x] before entering common warm-boot code. This lets them
>> observe shared-data writes made by the boot hart during cold-boot
>> initialization. Enable global CCI-550 snoop and DVM requests on the boot
>> hart before waking the secondary harts.
>>
>> Signed-off-by: Xianbin Zhu <xianbin.zhu at linux.spacemit.com>
>> Co-developed-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>
>> Signed-off-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>
>> ---
>> platform/generic/Kconfig | 5 +
>> platform/generic/configs/defconfig | 1 +
>> platform/generic/include/spacemit/common.h | 4 +-
>> platform/generic/include/spacemit/k3.h | 144 ++++++++++++++++
>> platform/generic/include/spacemit/k3_asm.h | 16 ++
>> platform/generic/spacemit/k3.c | 266 +++++++++++++++++++++++++++++
>> platform/generic/spacemit/k3_asm.S | 33 ++++
>> platform/generic/spacemit/objects.mk | 2 +
>> 8 files changed, 470 insertions(+), 1 deletion(-)
>>
>> diff --git a/platform/generic/spacemit/objects.mk b/platform/generic/spacemit/objects.mk
>> index 8309ad1f..282543b5 100644
>> --- a/platform/generic/spacemit/objects.mk
>> +++ b/platform/generic/spacemit/objects.mk
>> @@ -5,3 +5,5 @@
>
> With this patch applied
>
> CROSS_COMPILE=riscv64-linux-gnu- \
> make PLATFORM_RISCV_XLEN=32 PLATFORM=generic
>
> fails with errors like
>
> platform/generic/spacemit/k3.c:134:19: error: left shift count >= width
> of type [-Werror=shift-count-overflow]
> 134 | << PMACFG0_AUDIO_BUF_FIELD_SHIFT);
>
> Please, ensure that the SpacemiT K3 and K1 platforms are not built in
> the 32bit case. Unfortunately PLATFORM_RISCV_XLEN is not a configuration
> variable.
>
> Other platforms use
>
> ifeq ($(PLATFORM_RISCV_XLEN), 64)
>
> at the start of the *.mk file.
Confirmed. K1 and K3 are RV64-only. I will add the XLEN guard to
platform/generic/spacemit/objects.mk as suggested.
--
Troy Mitchell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 248 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/opensbi/attachments/20260827/73b79234/attachment.sig>
More information about the opensbi
mailing list