mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-02 11:35:46 +00:00
aarch64: Reduce UEFI space size to 4 MiB
UEFI need to be loaded to a flash area at the beginning of guest memory address space. To simulate the flash, we take a piece of RAM and hide it to the guest. As this is a temporary solution, the hiden RAM for UEFI should be as little as possible. The size was 64 MiB, that's too much, 4 MiB is enough. The down side of such simulation is that there is a gap (4 MiB) between the memory size in VMM's view and that in guest's view. This is to be fixed by implementing a flash device in future. Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
parent
d4d62fc9dc
commit
45c4d1a06e
@ -46,10 +46,11 @@
|
|||||||
|
|
||||||
use vm_memory::GuestAddress;
|
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 UEFI_START: u64 = 0x0;
|
||||||
pub const MEM_UEFI_START: GuestAddress = GuestAddress(0);
|
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.
|
/// Below this address will reside the GIC, above this address will reside the MMIO devices.
|
||||||
pub const MAPPED_IO_START: u64 = 0x0900_0000;
|
pub const MAPPED_IO_START: u64 = 0x0900_0000;
|
||||||
|
@ -88,7 +88,7 @@ pub fn configure_vcpu(
|
|||||||
pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, RegionType)> {
|
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.
|
// Normally UEFI should be loaded to a flash area at the beginning of memory.
|
||||||
// But now flash memory type is not supported.
|
// 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
|
// 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.
|
// assigned in command line, when ACPI and UEFI is enabled.
|
||||||
let ram_deduction = if cfg!(feature = "acpi") {
|
let ram_deduction = if cfg!(feature = "acpi") {
|
||||||
@ -98,7 +98,7 @@ pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, Region
|
|||||||
};
|
};
|
||||||
|
|
||||||
vec![
|
vec![
|
||||||
// 0 ~ 64 MiB: Reserved for UEFI space
|
// 0 ~ 4 MiB: Reserved for UEFI space
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
(GuestAddress(0), layout::UEFI_SIZE as usize, RegionType::Ram),
|
(GuestAddress(0), layout::UEFI_SIZE as usize, RegionType::Ram),
|
||||||
#[cfg(not(feature = "acpi"))]
|
#[cfg(not(feature = "acpi"))]
|
||||||
@ -107,7 +107,7 @@ pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, Region
|
|||||||
layout::UEFI_SIZE as usize,
|
layout::UEFI_SIZE as usize,
|
||||||
RegionType::Reserved,
|
RegionType::Reserved,
|
||||||
),
|
),
|
||||||
// 64 MiB ~ 256 MiB: Gic and legacy devices
|
// 4 MiB ~ 256 MiB: Gic and legacy devices
|
||||||
(
|
(
|
||||||
GuestAddress(layout::UEFI_SIZE),
|
GuestAddress(layout::UEFI_SIZE),
|
||||||
(layout::MEM_32BIT_DEVICES_START.0 - layout::UEFI_SIZE) as usize,
|
(layout::MEM_32BIT_DEVICES_START.0 - layout::UEFI_SIZE) as usize,
|
||||||
|
Loading…
Reference in New Issue
Block a user