pub struct GuestMemoryBuilder { /* private fields */ }
Expand description
A builder for GuestMemoryManager
.
Implementations§
Source§impl GuestMemoryBuilder
impl GuestMemoryBuilder
Sourcepub fn existing_backing(self, mapping: Option<SharedMemoryBacking>) -> Self
pub fn existing_backing(self, mapping: Option<SharedMemoryBacking>) -> Self
Specifies an existing memory backing to use.
Sourcepub fn vtl0_alias_map(self, offset: Option<u64>) -> Self
pub fn vtl0_alias_map(self, offset: Option<u64>) -> Self
Specifies the offset of the VTL0 alias map, if enabled for VTL2. This is a mirror of VTL0 memory into a high portion of the VM’s physical address space.
Sourcepub fn pin_mappings(self, enable: bool) -> Self
pub fn pin_mappings(self, enable: bool) -> Self
Specify whether to pin mappings in memory. This is used to support device assignment for devices that require the IOMMU to be programmed for all addresses.
Sourcepub fn prefetch_ram(self, enable: bool) -> Self
pub fn prefetch_ram(self, enable: bool) -> Self
Specify whether to prefetch RAM mappings. This improves boot performance by reducing memory intercepts at the cost of pre-allocating all of RAM.
Sourcepub fn x86_legacy_support(self, enable: bool) -> Self
pub fn x86_legacy_support(self, enable: bool) -> Self
Enables legacy x86 support.
When set, create separate RAM regions for the various low memory ranges that are special on x86 platforms. Specifically:
- Create a separate RAM region for the VGA VRAM window: 0xa0000-0xbffff.
- Create separate RAM regions within 0xc0000-0xfffff for control by PAM registers.
The caller can use RamVisibilityControl
to adjust the visibility of
these ranges.
Sourcepub async fn build(
self,
mem_layout: &MemoryLayout,
) -> Result<GuestMemoryManager, MemoryBuildError>
pub async fn build( self, mem_layout: &MemoryLayout, ) -> Result<GuestMemoryManager, MemoryBuildError>
Builds the memory backing, allocating memory if existing memory was not
provided by existing_backing
.