diff --git a/arch/src/aarch64/layout.rs b/arch/src/aarch64/layout.rs index da029cbda..02792b7fc 100644 --- a/arch/src/aarch64/layout.rs +++ b/arch/src/aarch64/layout.rs @@ -46,10 +46,11 @@ use vm_memory::GuestAddress; -/// 0x0 ~ 0x400_0000 is reserved to uefi +/// 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: u64 = 0x0; pub const MEM_UEFI_START: GuestAddress = GuestAddress(0); -pub const UEFI_SIZE: u64 = 0x0400_0000; +pub const UEFI_SIZE: u64 = 0x040_0000; /// Below this address will reside the GIC, above this address will reside the MMIO devices. pub const MAPPED_IO_START: u64 = 0x0900_0000; diff --git a/arch/src/aarch64/mod.rs b/arch/src/aarch64/mod.rs index 01fe78ced..52a326194 100644 --- a/arch/src/aarch64/mod.rs +++ b/arch/src/aarch64/mod.rs @@ -88,7 +88,7 @@ pub fn configure_vcpu( pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, RegionType)> { // Normally UEFI should be loaded to a flash area at the beginning of memory. // But now flash memory type is not supported. - // As a workaround, we take 64 MiB memory from the main RAM for UEFI. + // As a workaround, we take 4 MiB memory from the main RAM for UEFI. // As a result, the RAM that the guest can see is less than what has been // assigned in command line, when ACPI and UEFI is enabled. let ram_deduction = if cfg!(feature = "acpi") { @@ -98,7 +98,7 @@ pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, Region }; vec![ - // 0 ~ 64 MiB: Reserved for UEFI space + // 0 ~ 4 MiB: Reserved for UEFI space #[cfg(feature = "acpi")] (GuestAddress(0), layout::UEFI_SIZE as usize, RegionType::Ram), #[cfg(not(feature = "acpi"))] @@ -107,7 +107,7 @@ pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, Region layout::UEFI_SIZE as usize, RegionType::Reserved, ), - // 64 MiB ~ 256 MiB: Gic and legacy devices + // 4 MiB ~ 256 MiB: Gic and legacy devices ( GuestAddress(layout::UEFI_SIZE), (layout::MEM_32BIT_DEVICES_START.0 - layout::UEFI_SIZE) as usize,