Struct vm_topology::memory::MemoryLayout
source · pub struct MemoryLayout { /* private fields */ }
Expand description
Describes the memory layout of a guest.
Implementations§
source§impl MemoryLayout
impl MemoryLayout
sourcepub fn new(
physical_address_size: u8,
ram_size: u64,
gaps: &[MemoryRange],
vtl2_range: Option<MemoryRange>,
) -> Result<Self, Error>
pub fn new( physical_address_size: u8, ram_size: u64, gaps: &[MemoryRange], vtl2_range: Option<MemoryRange>, ) -> Result<Self, Error>
Makes a new memory layout for a guest with ram_size
bytes of memory
and MMIO gaps at the locations specified by gaps
.
ram_size
must be a multiple of the page size. Each gap must be
non-empty, and the gaps must be in order and non-overlapping.
vtl2_range
describes a range of memory reserved for VTL2.
It is not reported in ram.
All RAM is assigned to NUMA node 0.
sourcepub fn new_from_ranges(
physical_address_size: u8,
memory: &[MemoryRangeWithNode],
gaps: &[MemoryRange],
) -> Result<Self, Error>
pub fn new_from_ranges( physical_address_size: u8, memory: &[MemoryRangeWithNode], gaps: &[MemoryRange], ) -> Result<Self, Error>
Makes a new memory layout for a guest with the given mmio gaps and memory ranges.
memory
and gaps
ranges must be in sorted order and non-overlapping,
and describe page aligned ranges.
sourcepub fn ram(&self) -> &[MemoryRangeWithNode]
pub fn ram(&self) -> &[MemoryRangeWithNode]
The populated RAM ranges. This does not include the vtl2_range.
sourcepub fn vtl2_range(&self) -> Option<MemoryRange>
pub fn vtl2_range(&self) -> Option<MemoryRange>
A special memory range for VTL2, if any. This memory range is treated like RAM, but is only used to hold VTL2 and is located above ram and mmio.
sourcepub fn physical_address_size(&self) -> u8
pub fn physical_address_size(&self) -> u8
The bit width of a physical address for the VM.
sourcepub fn end_of_ram(&self) -> u64
pub fn end_of_ram(&self) -> u64
One past the last byte of RAM.
sourcepub fn ram_below_4gb(&self) -> u64
pub fn ram_below_4gb(&self) -> u64
The bytes of RAM below 4GB.
sourcepub fn ram_above_4gb(&self) -> u64
pub fn ram_above_4gb(&self) -> u64
The bytes of RAM at or above 4GB.
sourcepub fn ram_above_high_mmio(&self) -> Option<u64>
pub fn ram_above_high_mmio(&self) -> Option<u64>
The bytes of RAM above the high MMIO gap.
Returns None if there aren’t exactly 2 MMIO gaps.
sourcepub fn max_ram_below_4gb(&self) -> Option<u64>
pub fn max_ram_below_4gb(&self) -> Option<u64>
The ending RAM address below 4GB.
Returns None if there is no RAM mapped below 4GB.
sourcepub fn end_of_ram_or_mmio(&self) -> u64
pub fn end_of_ram_or_mmio(&self) -> u64
One past the last byte of RAM, or the highest mmio range.
Trait Implementations§
source§impl Clone for MemoryLayout
impl Clone for MemoryLayout
source§fn clone(&self) -> MemoryLayout
fn clone(&self) -> MemoryLayout
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MemoryLayout
impl Debug for MemoryLayout
Auto Trait Implementations§
impl Freeze for MemoryLayout
impl RefUnwindSafe for MemoryLayout
impl Send for MemoryLayout
impl Sync for MemoryLayout
impl Unpin for MemoryLayout
impl UnwindSafe for MemoryLayout
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)