pub struct GuestMemoryBuilder { /* private fields */ }Expand description
A builder for GuestMemoryManager.
Implementations§
Source§impl GuestMemoryBuilder
impl GuestMemoryBuilder
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 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 fn add_backing(self, request: RamBackingRequest) -> Self
pub fn add_backing(self, request: RamBackingRequest) -> Self
Adds a RAM backing request. Call once per backing (one per NUMA node, or once for a non-NUMA VM).
Sourcepub async fn build(
self,
max_addr: u64,
) -> Result<GuestMemoryManager, MemoryBuildError>
pub async fn build( self, max_addr: u64, ) -> Result<GuestMemoryManager, MemoryBuildError>
Builds the memory backing, allocating one memfd or anonymous region per backing request.
Each RamBackingRequest produces one RAM backing. File-backed
requests allocate a memfd (or reuse existing_mappable if set);
private requests use anonymous pages.