Enum vm_control::VmMemoryRequest 
source · pub enum VmMemoryRequest {
    PrepareSharedMemoryRegion {
        alloc: Alloc,
        cache: MemCacheType,
    },
    RegisterMemory {
        source: VmMemorySource,
        dest: VmMemoryDestination,
        prot: Protection,
        cache: MemCacheType,
    },
    MmapAndRegisterMemory {
        shm: SharedMemory,
        dest: VmMemoryDestination,
        num_file_mappings: usize,
    },
    DynamicallyFreeMemoryRanges {
        ranges: Vec<(GuestAddress, u64)>,
    },
    DynamicallyReclaimMemoryRanges {
        ranges: Vec<(GuestAddress, u64)>,
    },
    BalloonTargetReached {
        size: u64,
    },
    UnregisterMemory(VmMemoryRegionId),
    IoEventRaw(IoEventUpdateRequest),
}Variants§
Prepare a shared memory region to make later operations more efficient. This may be a no-op depending on underlying platform support.
RegisterMemory
Register a memory to be mapped to the guest.
Fields
source: VmMemorySourceSource of the memory to register (mapped file descriptor, shared memory region, etc.)
dest: VmMemoryDestinationWhere to map the memory in the guest.
prot: ProtectionWhether to map the memory read only (true) or read-write (false).
cache: MemCacheTypeCache attribute for guest memory setting
MmapAndRegisterMemory
Call mmap to shm and register the memory region as a read-only guest memory.
This request is followed by an array of VmMemoryFileMapping with length
num_file_mappings
Fields
shm: SharedMemorySource of the memory to register (mapped file descriptor, shared memory region, etc.)
dest: VmMemoryDestinationWhere to map the memory in the guest.
DynamicallyFreeMemoryRanges
Call hypervisor to free the given memory range.
DynamicallyReclaimMemoryRanges
Call hypervisor to reclaim a priorly freed memory range.
BalloonTargetReached
Balloon allocation/deallocation target reached.
UnregisterMemory(VmMemoryRegionId)
Unregister the given memory slot that was previously registered with RegisterMemory.
IoEventRaw(IoEventUpdateRequest)
Register an eventfd with raw guest memory address.
Implementations§
source§impl VmMemoryRequest
 
impl VmMemoryRequest
sourcepub fn execute(
    self,
    tube: &Tube,
    vm: &mut impl Vm,
    sys_allocator: &mut SystemAllocator,
    gralloc: &mut RutabagaGralloc,
    iommu_client: Option<&mut VmMemoryRequestIommuClient>,
    region_state: &mut VmMemoryRegionState,
) -> VmMemoryResponse
 
pub fn execute( self, tube: &Tube, vm: &mut impl Vm, sys_allocator: &mut SystemAllocator, gralloc: &mut RutabagaGralloc, iommu_client: Option<&mut VmMemoryRequestIommuClient>, region_state: &mut VmMemoryRegionState, ) -> VmMemoryResponse
Executes this request on the given Vm.
§Arguments
vm- TheVmto perform the request on.allocator- Used to allocate addresses.
This does not return a result, instead encapsulating the success or failure in a
VmMemoryResponse with the intended purpose of sending the response back over the socket
that received this VmMemoryResponse.
Trait Implementations§
source§impl<'de> Deserialize<'de> for VmMemoryRequest
 
impl<'de> Deserialize<'de> for VmMemoryRequest
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for VmMemoryRequest
impl RefUnwindSafe for VmMemoryRequest
impl Send for VmMemoryRequest
impl Sync for VmMemoryRequest
impl Unpin for VmMemoryRequest
impl UnwindSafe for VmMemoryRequest
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
§impl<T> Downcast for Twhere
    T: Any,
 
impl<T> Downcast for Twhere
    T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
 
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
 
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
 
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
 
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.