Spacemit K3 enable Linux boot
Subsystems (2)
v2 cover Spacemit K3 enable Linux boot
Adopt some fixes needed for Linux v7.2.10+ boot and enable BOOTSTD_FULL together with minimal env addr variable defaults.
Build and test only with vendor BSP k3-br-v1.0.10 having reduced [1] configuration to avoid a memory resource conflict. The vendor BSP SPL in its default configuration attempts to load opensbi separately from u-boot main app, and also attempts to load an embedded controller OS image, neither of which is useful for mainline opensbi, mainline Linux, and mainline U-Boot.
Changes since v1:
- Patch 1/3 apply tags; discussion continues upstream [2] about whether this should be enabled in S-mode Linux or only enabled by M-mode firmware (e.g. U-Boot SPL and OpenSBI).
- Patch 2/3 replaced by corresponding cherry-pick from Linux v7.4-rc1
1: https://lore.kernel.org/u-boot/[email protected]/
2: https://lore.kernel.org/lkml/[email protected]/
E Shattow (2):
riscv: dts: spacemit: k3: override reserved status of mimsic and
maplic
configs: spacemit: k3: enable CONFIG_BOOTSTD_FULL
Junhui Liu (1):
riscv: dts: spacemit: k3: Drop guest properties from M-level IMSIC
arch/riscv/dts/spacemit-k3-u-boot.dtsi | 4 ++++ configs/spacemit_k3_defconfig | 9 +-------- dts/upstream/src/riscv/spacemit/k3.dtsi | 2 -- include/configs/spacemit-k3.h | 6 ++++++ 4 files changed, 11 insertions(+), 10 deletions(-)
base-commit: e43c38e00218eae1a7b4a683c0fef8973d838fa3
Signature · 1 line
2.53.0
PATCH v2 1/3 riscv: dts: spacemit: k3: override reserved status of mimsic and maplic
S-Mode Linux boot stalls when probing peripherals unless M-Mode OpenSBI has the enabled mimsic and maplic nodes. Override these nodes so Linux can boot.
--- arch/riscv/dts/spacemit-k3-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/riscv/dts/spacemit-k3-u-boot.dtsi +4 -0
@@ -3,4 +3,8 @@ * Copyright (C) 2026 Yixun Lan <[email protected]> */ +/* Override reserved status of mimsic and maplic for OpenSBI */ +&mimsic { status = "okay"; }; +&maplic { status = "okay"; }; + #include "spacemit-k3-binman.dtsi"
Signature · 1 line
2.53.0
PATCH v2 2/3 riscv: dts: spacemit: k3: Drop guest properties from M-level IMSIC
In reply to E ShattowFrom: Junhui Liu <[email protected]>
The mimsic node describes the machine-level IMSIC, whose MMIO region is 0x10000 (64 KiB) for all 8 harts. However, the node also specifies riscv,guest-index-bits = <6>, and per the AIA specification the per-hart stride is 2^(guest-index-bits + 12) bytes when guest interrupt files exist, i.e. 2^(6 + 12) = 256 KiB per hart and 2 MiB for all 8 harts. The described region cannot hold even a single hart's files, so the node contradicts itself. OpenSBI enforces exactly this constraint in imsic_data_check() and rejects the node with -EINVAL, preventing the M-level IMSIC from initializing:
fdt_driver_init_by_offset: interrupt-controller@f1000000 (riscv,imsics) init failed: -3
init_coldboot: irqchip init failed (error -3)
Moreover, guest interrupt files exist to act as the supervisor-level interrupt files of virtual harts; there is no machine-level counterpart. riscv,num-guest-ids is equally meaningless for the machine-level IMSIC.
Drop both "riscv,guest-index-bits" and "riscv,num-guest-ids" properties from the mimsic node so the node matches the actual hardware layout.
[ upstream commit: 01e2f07c44fc46180bdb10e70506f8acf44a53dd ]
(cherry picked from commit d44cd4bcf93bb5c99a4762ed5f11656b93f9e5cc)
--- dts/upstream/src/riscv/spacemit/k3.dtsi | 2 -- 1 file changed, 2 deletions(-)
dts/upstream/src/riscv/spacemit/k3.dtsi +0 -2
@@ -1287,9 +1287,7 @@ <&cpu4_intc 11>, <&cpu5_intc 11>, <&cpu6_intc 11>, <&cpu7_intc 11>; msi-controller; - riscv,guest-index-bits = <6>; riscv,hart-index-bits = <4>; - riscv,num-guest-ids = <511>; riscv,num-ids = <511>; status = "reserved"; };
Signature · 1 line
2.53.0
PATCH v2 3/3 configs: spacemit: k3: enable CONFIG_BOOTSTD_FULL
In reply to E ShattowDefine minimal env variables for boot in spacemit-k3.h with fdtfile as the CFG_EXTRA_ENV_SETTINGS sentinel, and enable CONFIG_BOOTSTD_FULL
--- configs/spacemit_k3_defconfig | 9 +-------- include/configs/spacemit-k3.h | 6 ++++++ 2 files changed, 7 insertions(+), 8 deletions(-)
configs/spacemit_k3_defconfig +1 -8
@@ -19,25 +19,18 @@ CONFIG_RISCV_SMODE=y CONFIG_RISCV_ISA_ZICBOM=y CONFIG_STACK_SIZE=0x100000 CONFIG_FIT=y -CONFIG_SUPPORT_RAW_INITRD=y +CONFIG_BOOTSTD_FULL=y CONFIG_SYS_CBSIZE=256 CONFIG_SYS_PBSIZE=276 # CONFIG_BOARD_INIT is not set -CONFIG_HUSH_PARSER=y CONFIG_CMD_TLV_EEPROM=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MTD=y -CONFIG_CMD_DHCP=y CONFIG_CMD_DNS=y -CONFIG_CMD_MII=y -CONFIG_CMD_PING=y CONFIG_CMD_WGET=y -CONFIG_CMD_PXE=y CONFIG_CMD_PMIC=y CONFIG_CMD_REGULATOR=y -CONFIG_CMD_FAT=y -CONFIG_CMD_FS_GENERIC=y CONFIG_CMD_MTDPARTS=y CONFIG_MTDIDS_DEFAULT="nor0=d420c000.spi" CONFIG_MTDPARTS_DEFAULT="d420c000.spi:128k(bootinfo),512k(fsbl),64k(env),1024k(esos),384k(opensbi),-(uboot)"
include/configs/spacemit-k3.h +6 -0
@@ -6,6 +6,12 @@#ifndef __SPACEMIT_K3_H#define __SPACEMIT_K3_H +#define CFG_EXTRA_ENV_SETTINGS \ + "ramdisk_addr_r=0x130000000\0" \ + "fdt_addr_r=0x138000000\0" \ + "kernel_addr_r=0x140000000\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" +#define CFG_SYS_NS16550_IER 0x40#define RISCV_SMODE_TIMER_FREQ 24000000
Signature · 1 line
2.53.0