From 2524b015b8cdc4f95b459f3e3b78fc1e2508c97b Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Sun, 10 Aug 2025 23:54:37 +0000 Subject: [PATCH] arch: riscv: Introduce UEFI related constants Set UEFI_START and UEFI_SIZE for riscv64 layout. Signed-off-by: Ruoqing He --- arch/src/riscv64/layout.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/src/riscv64/layout.rs b/arch/src/riscv64/layout.rs index 40583301c..3ef7eddf2 100644 --- a/arch/src/riscv64/layout.rs +++ b/arch/src/riscv64/layout.rs @@ -44,16 +44,23 @@ // | | // | APLICs | // | | +// 4 MB +---------------------------------------------------------------+ +// | UEFI flash | // 0 GB +---------------------------------------------------------------+ // // use vm_memory::GuestAddress; +/// 0x0 ~ 0x40_0000 (4 MiB) is reserved to UEFI +/// UEFI binary size is required less than 3 MiB, reserving 4 MiB is enough. +pub const UEFI_START: GuestAddress = GuestAddress(0); +pub const UEFI_SIZE: u64 = 0x040_0000; + /// AIA related devices /// See https://elixir.bootlin.com/linux/v6.10/source/arch/riscv/include/uapi/asm/kvm.h -/// 0x0 ~ 0x0400_0000 (64 MiB) resides APLICs -pub const APLIC_START: GuestAddress = GuestAddress(0); +/// 0x40_0000 ~ 0x0400_0000 (64 MiB) resides APLICs +pub const APLIC_START: GuestAddress = GuestAddress(0x40_0000); pub const APLIC_SIZE: u64 = 0x4000; /// 0x0400_0000 ~ 0x0800_0000 (64 MiB) resides IMSICs