Skip to contentSkip to conversation

Spacemit K3 enable Linux boot

PATCH In review E Shattow 3 participants 10 messages Oct 28 – Oct 29

Subsystems (2)
lore
Share & tools
lore

E Shattow

author
#0 lore raw

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 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. Instructions and supplemental patches for the reduced vendor BSP build are co-dependent on this series; a follow-up will be posted with details after this series is sent.

E Shattow (3):
riscv: dts: spacemit: k3: override reserved status of mimsic and
maplic
riscv: dts: spacemit: k3: adopt override to drop M-level IMSIC guest
props
configs: spacemit: k3: enable CONFIG_BOOTSTD_FULL

 arch/riscv/dts/spacemit-k3-u-boot.dtsi | 12 ++++++++++++
 configs/spacemit_k3_defconfig          |  9 +--------
 include/configs/spacemit-k3.h          |  6 ++++++
 3 files changed, 19 insertions(+), 8 deletions(-)

base-commit: 03e45557e1f38a39a0c80fe30483130ff376cf92

Signature · 1 line
2.53.0
author
#1 lore raw

PATCH 1/3 riscv: dts: spacemit: k3: override reserved status of mimsic and maplic

Linux boot stalls when probing peripherals unless 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
index 352e85e7de87..278b36acc79f 100644
@@ -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
#2 lore raw

Re: [PATCH v1 1/3] riscv: dts: spacemit: k3: override reserved status of mimsic and maplic

Quoted 14 lines · E Shattow

Linux boot stalls when probing peripherals unless 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 +0 -0
index 352e85e7de87..278b36acc79f 100644

arch/riscv/dts/spacemit-k3-u-boot.dtsi line 8

Quoted 6 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +3 -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"; };

This should be fixed in the DT in linux. I guess you could carry this patch till it is fixed in linux.

Quoted 5 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +1 -0
+
 #include "spacemit-k3-binman.dtsi"
Signature · 1 line
2.53.0
author
#3 lore raw

Re: [PATCH v1 1/3] riscv: dts: spacemit: k3: override reserved status of mimsic and maplic

Hi Anirudh, CC: Troy Mitchell, Guodong Xu

Quoted 18 lines · Anirudh Srinivasan
Quoted 17 lines · E Shattow

Linux boot stalls when probing peripherals unless 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 +0 -0
index 352e85e7de87..278b36acc79f 100644
@@ -3,4 +3,8 @@
  * Copyright (C) 2026 Yixun Lan <[email protected]>
  */
 
Quoted 12 lines

arch/riscv/dts/spacemit-k3-u-boot.dtsi line 8

Quoted 3 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +3 -0
+/* Override reserved status of mimsic and maplic for OpenSBI */
+&mimsic { status = "okay"; };
+&maplic { status = "okay"; };

This should be fixed in the DT in linux. I guess you could carry this patch till it is fixed in linux.

Quoted 5 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +1 -0
+
 #include "spacemit-k3-binman.dtsi"
Signature · 1 line
2.53.0

The upstream commit that adds these nodes as reserved status is:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=56f37e391a626

Quote, "...Also add M-mode APLIC (maplic) and IMSIC (mimsic) nodes to represent the hardware topology and ready for potential firmware usage."

When the mainline OpenSBI series lands adding SpacemiT K3 support:

https://lore.kernel.org/opensbi/[email protected]/

...then I think we could send this upstream?

Thanks for the review, -E

reviewer Acked-by
#4 lore raw

Re: [PATCH v1 1/3] riscv: dts: spacemit: k3: override reserved status of mimsic and maplic

Quoted 27 lines · E Shattow

Hi Anirudh, CC: Troy Mitchell, Guodong Xu

Quoted 24 lines · Anirudh Srinivasan
Quoted 14 lines · E Shattow

Linux boot stalls when probing peripherals unless 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 +0 -0
index 352e85e7de87..278b36acc79f 100644

arch/riscv/dts/spacemit-k3-u-boot.dtsi line 8

Quoted 6 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +3 -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"; };

This should be fixed in the DT in linux. I guess you could carry this patch till it is fixed in linux.

I think status = "reserved" in k3.dtsi is correct and should stay. The DT spec defines "reserved" as a device that is operational but should not be used, typically because it is controlled by another software component such as platform firmware.

That is exactly the case for the M-level IMSIC and APLIC.

Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +1 -0
+
 #include "spacemit-k3-binman.dtsi"
Signature · 1 line
2.53.0

The upstream commit that adds these nodes as reserved status is:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=56f37e391a626

Quoted 8 lines

Quote, "...Also add M-mode APLIC (maplic) and IMSIC (mimsic) nodes to represent the hardware topology and ready for potential firmware usage."

When the mainline OpenSBI series lands adding SpacemiT K3 support:

https://lore.kernel.org/opensbi/[email protected]/

...then I think we could send this upstream?

Quoted 2 lines

Thanks for the review, -E

Signature · 1 line
Troy Mitchell
reviewer
#5 lore raw

Re: [PATCH v1 1/3] riscv: dts: spacemit: k3: override reserved status of mimsic and maplic

Quoted 2 lines · Troy Mitchell
Quoted 1 line · E Shattow

Hi Anirudh, CC: Troy Mitchell, Guodong Xu

I realized after sending that you CC'd the wrong Guodong email. I've corrected it here.

Quoted 54 lines
Quoted 20 lines · Anirudh Srinivasan
Quoted 18 lines · E Shattow
Quoted 17 lines

Linux boot stalls when probing peripherals unless 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 +0 -0
index 352e85e7de87..278b36acc79f 100644
@@ -3,4 +3,8 @@
  * Copyright (C) 2026 Yixun Lan <[email protected]>
  */
 
Quoted 6 lines
Quoted 6 lines

arch/riscv/dts/spacemit-k3-u-boot.dtsi line 8

Quoted 3 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +3 -0
+/* Override reserved status of mimsic and maplic for OpenSBI */
+&mimsic { status = "okay"; };
+&maplic { status = "okay"; };

This should be fixed in the DT in linux. I guess you could carry this patch till it is fixed in linux.

I think status = "reserved" in k3.dtsi is correct and should stay. The DT spec defines "reserved" as a device that is operational but should not be used, typically because it is controlled by another software component such as platform firmware.

That is exactly the case for the M-level IMSIC and APLIC.

Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +1 -0
+
 #include "spacemit-k3-binman.dtsi"
Signature · 1 line
2.53.0

The upstream commit that adds these nodes as reserved status is:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=56f37e391a626

Quoted 8 lines

Quote, "...Also add M-mode APLIC (maplic) and IMSIC (mimsic) nodes to represent the hardware topology and ready for potential firmware usage."

When the mainline OpenSBI series lands adding SpacemiT K3 support:

https://lore.kernel.org/opensbi/[email protected]/

...then I think we could send this upstream?

Quoted 2 lines

Thanks for the review, -E

Signature · 1 line
Troy Mitchell
#6 lore raw

Re: [PATCH v1 1/3] riscv: dts: spacemit: k3: override reserved status of mimsic and maplic

In reply to Troy Mitchell

Hi Troy,

Quoted 29 lines · Troy Mitchell
Quoted 27 lines · E Shattow

Hi Anirudh, CC: Troy Mitchell, Guodong Xu

Quoted 24 lines · Anirudh Srinivasan
Quoted 14 lines · E Shattow

Linux boot stalls when probing peripherals unless 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 +0 -0
index 352e85e7de87..278b36acc79f 100644

arch/riscv/dts/spacemit-k3-u-boot.dtsi line 8

Quoted 6 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +3 -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"; };

This should be fixed in the DT in linux. I guess you could carry this patch till it is fixed in linux.

Quoted 6 lines

I think status = "reserved" in k3.dtsi is correct and should stay. The DT spec defines "reserved" as a device that is operational but should not be used, typically because it is controlled by another software component such as platform firmware.

That is exactly the case for the M-level IMSIC and APLIC.

The DT should be a description of the hw, not just the bits that linux cares about. This is why I'm asking for this to be in the linux DT. The changes that E is proposing here will have effect in the DT that u-boot passes to linux anyway.

Quoted 27 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +1 -1
+
 #include "spacemit-k3-binman.dtsi"
--

2.53.0

The upstream commit that adds these nodes as reserved status is:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=56f37e391a626

Quoted 8 lines

Quote, "...Also add M-mode APLIC (maplic) and IMSIC (mimsic) nodes to represent the hardware topology and ready for potential firmware usage."

When the mainline OpenSBI series lands adding SpacemiT K3 support:

https://lore.kernel.org/opensbi/[email protected]/

...then I think we could send this upstream?

Quoted 2 lines

Thanks for the review, -E

--
Troy Mitchell

author
#7 lore raw

Re: [PATCH v1 1/3] riscv: dts: spacemit: k3: override reserved status of mimsic and maplic

Hi Anirudh, Troy, et. al.

Quoted 38 lines · Anirudh Srinivasan

Hi Troy,

Quoted 34 lines · Troy Mitchell
Quoted 27 lines · E Shattow

Hi Anirudh, CC: Troy Mitchell, Guodong Xu

Quoted 24 lines · Anirudh Srinivasan
Quoted 14 lines · E Shattow

Linux boot stalls when probing peripherals unless 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 +0 -0
index 352e85e7de87..278b36acc79f 100644

arch/riscv/dts/spacemit-k3-u-boot.dtsi line 8

Quoted 6 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +3 -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"; };

This should be fixed in the DT in linux. I guess you could carry this patch till it is fixed in linux.

I think status = "reserved" in k3.dtsi is correct and should stay. The DT spec defines "reserved" as a device that is operational but should not be used, typically because it is controlled by another software component such as platform firmware.

Quoted 7 lines
Quoted 1 line

That is exactly the case for the M-level IMSIC and APLIC.

The DT should be a description of the hw, not just the bits that linux cares about. This is why I'm asking for this to be in the linux DT. The changes that E is proposing here will have effect in the DT that u-boot passes to linux anyway.

The mainline OpenSBI series supporting K3 has now landed. As promised I've sent a patch upstream to Linux so that we may continue discussion about the required mimsic and maplic status there:

https://lore.kernel.org/lkml/[email protected]/

Quoted 21 lines
Quoted 21 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
arch/riscv/dts/spacemit-k3-u-boot.dtsi +1 -1
+
 #include "spacemit-k3-binman.dtsi"
--

2.53.0

The upstream commit that adds these nodes as reserved status is:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=56f37e391a626

Quoted 8 lines

Quote, "...Also add M-mode APLIC (maplic) and IMSIC (mimsic) nodes to represent the hardware topology and ready for potential firmware usage."

When the mainline OpenSBI series lands adding SpacemiT K3 support:

https://lore.kernel.org/opensbi/[email protected]/

...then I think we could send this upstream?

Quoted 1 line
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Thanks for the review, -E

--
Troy Mitchell

Thanks everyone for advice about this, I think it will be okay in any decision about whether to change this in devicetree-rebasing upstream, to carry these changes here as-needed in U-Boot for passing to OpenSBI. Let's get consensus with discussion on LKML and then if there is something more narrow in scope needed that can be done from U-Boot for changing these nodes to pass to OpenSBI, I am open to that possibility too

-E

author
#8 lore raw

PATCH 2/3 riscv: dts: spacemit: k3: adopt override to drop M-level IMSIC guest props

In reply to E Shattow

Adopt Linux next-for-v7.4 01e2f07c44fc ("riscv: dts: spacemit: k3: Drop guest properties from M-level IMSIC"). Resolves OpenSBI failure:

fdt_driver_init_by_offset: interrupt-controller@f1000000 (riscv,imsics)
init failed: -3
init_coldboot: irqchip init failed (error -3)

---
 arch/riscv/dts/spacemit-k3-u-boot.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/riscv/dts/spacemit-k3-u-boot.dtsi +8 -0
index 278b36acc79f..721e2d3cbb61 100644
@@ -7,4 +7,12 @@
 &mimsic { status = "okay"; };
 &maplic { status = "okay"; };
 
+/* Linux next-for-v7.4 01e2f07c44fc
+ * ("riscv: dts: spacemit: k3: Drop guest properties from M-level IMSIC")
+ */
+&mimsic {
+	/delete-property/ riscv,guest-index-bits;
+	/delete-property/ riscv,num-guest-ids;
+};
+
 #include "spacemit-k3-binman.dtsi"
Signature · 1 line
2.53.0
author
#9 lore raw

PATCH 3/3 configs: spacemit: k3: enable CONFIG_BOOTSTD_FULL

In reply to E Shattow

Define 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
index f49442951c8f..9bf582564d07 100644
@@ -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
index 9dd545e2a3b2..39d10059926e 100644
@@ -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