Skip to contentSkip to conversation

riscv: qemu: spl: Fix booting Linux kernel with OpenSBI 1.0+

PATCH In review Bin Meng 2 participants 2 messages Oct 16, 2022 – Oct 17, 2022 1 message not in the archive RISC-V

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 riscv: qemu: spl: Fix booting Linux kernel with OpenSBI 1.0+

Since OpenSBI commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default"), OpenSBI runs directly at the load address without any code movement. This causes the SPL version of QEMU 'virt' U-Boot does not boot Linux kernel anymore. In that case, OpenSBI is loaded and runs at 0x81000000, and it creates a 512KiB PMP window from that address. When booting the Linux kernel, moving kernel to its linking address 0x80200000 overlaps the PMP window, and a PMP access failure is raised.

Update SPL_OPENSBI_LOAD_ADDR to load OpenSBI to a safe address.

---

 board/emulation/qemu-riscv/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/emulation/qemu-riscv/Kconfig +1 -1
index d8c57e6bb0..f9883f18b0 100644
@@ -23,7 +23,7 @@ config SPL_TEXT_BASE
 
 config SPL_OPENSBI_LOAD_ADDR
 	hex
-	default 0x81000000
+	default 0x80100000
 
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
Signature · 1 line
2.34.1

A message that is not in the archive (sent off-list or not yet received): HK0PR03MB2994E096F48650DA91272147C1299@HK0PR03MB2994.apcprd03.prod.outlook.com

Reviewed-by
#2 lore raw
Quoted 11 lines

From: Bin Meng <[email protected]>
Sent: Monday, October 17, 2022 12:42 AM
To: Rick Jian-Zhi Chen(陳建志) <[email protected]>; Leo Yu-Chi Liang(梁育齊) <[email protected]>; [email protected]
Cc: [email protected]; Yangjie Zhang <[email protected]>
Subject: [PATCH] riscv: qemu: spl: Fix booting Linux kernel with OpenSBI 1.0+

Since OpenSBI commit bf3ef53bb7f5 ("firmware: Enable FW_PIC by default"), OpenSBI runs directly at the load address without any code movement.
This causes the SPL version of QEMU 'virt' U-Boot does not boot Linux kernel anymore. In that case, OpenSBI is loaded and runs at 0x81000000, and it creates a 512KiB PMP window from that address. When booting the Linux kernel, moving kernel to its linking address 0x80200000 overlaps the PMP window, and a PMP access failure is raised.

Update SPL_OPENSBI_LOAD_ADDR to load OpenSBI to a safe address.

Quoted 8 lines

---

 board/emulation/qemu-riscv/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)