[PATCH 0/3] platform: generic: spacemit: add K3 platform support

Bo Gan ganboing at gmail.com
Sat Jul 25 18:14:33 PDT 2026


Hi Troy, Xianbin,

On 7/24/26 02:27, Troy Mitchell wrote:
> Add initial OpenSBI platform support for the SpacemiT K3 SoC. K3 has
> 16 harts split across four clusters: eight X100 harts in C0/C1 and
> eight A100 harts in C2/C3.
> 

One thing to watch out for is the lack of 'H' in A100. This can cause
issues where the code assumed all cores to have the same extensions:
https://github.com/riscv-software-src/opensbi/blob/c0f87f10d1bfb9e72a84ddfafb5604ee1bfe9d04/lib/sbi/sbi_hart.c#L704

	if (cold_boot) {
		if (misa_extension('H'))
			sbi_hart_expected_trap = &__sbi_expected_trap_hext;
	...

At least this `sbi_hart_expected_trap` needs to be enhanced to account for
heterogeneous cores. Perhaps wrap it as a function, such as
ulong sbi_hart_expected_trap_addr(void), and fix up all users:

- register ulong mtvec = (ulong)sbi_hart_expected_trap;
+ register ulong mtvec = sbi_hart_expected_trap_addr();

Please also check other places where it's assuming homogeneous cores. Can
you also describe in detail the different extensions between X100/A100?
Apart from H/no-H, and different vlen's, anything else?


> The first patch corrects a misleading K1 cache-operation name without
> changing its encoded value or behavior.
> 
> The second patch refactors the existing K1 support by moving the
> definitions and CCI-550 programming helper needed by both SoCs into
> common SpacemiT files. The K1 CCI topology, boot flow, and HSM
> implementation remain K1-specific.
> 
> The third patch adds the K3 platform implementation. During cold boot,
> the boot hart configures the cluster warm-boot vectors, enables CCI
> snoop and DVM requests, disables core and cluster power-down on WFI,
> and wakes the secondary harts. Per-hart initialization configures PMA
> attributes, caches, L1 D-cache snooping, prefetch, and the H extension
> on X100 harts.
> 
> The series has been build-tested with:
>   - the generic default configuration
>   - a K1-only configuration with the SpacemiT HSM driver
>   - a K3-only configuration without the K1 HSM driver
> 
> Signed-off-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>
> ---
> Xianbin Zhu (3):
>        platform: generic: spacemit: k1: rename cache flush operation
>        platform: generic: spacemit: k1: refactor platform support
>        platform: generic: spacemit: k3: add platform support
> 
>   lib/utils/hsm/fdt_hsm_spacemit.c             |   7 +-
>   platform/generic/Kconfig                     |   9 +
>   platform/generic/configs/defconfig           |   1 +
>   platform/generic/include/spacemit/common.h   |  88 +++++++++
>   platform/generic/include/spacemit/k1.h       |  96 ++--------
>   platform/generic/include/spacemit/k3.h       | 144 +++++++++++++++
>   platform/generic/include/spacemit/k3_asm.h   |  16 ++
>   platform/generic/include/spacemit/spacemit.h |  14 ++
>   platform/generic/spacemit/k1.c               |  33 +---
>   platform/generic/spacemit/k3.c               | 264 +++++++++++++++++++++++++++
>   platform/generic/spacemit/k3_asm.S           |  33 ++++
>   platform/generic/spacemit/objects.mk         |   3 +
>   platform/generic/spacemit/spacemit.c         |  36 ++++
>   13 files changed, 636 insertions(+), 108 deletions(-)
> ---
> base-commit: c0f87f10d1bfb9e72a84ddfafb5604ee1bfe9d04
> change-id: 20260723-spacemit-k3-84720a7be53d
> 
> Best regards,
> --
> Troy Mitchell <troy.mitchell at linux.spacemit.com>
> 
> 

Bo




More information about the opensbi mailing list