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,
},
DynamicallyFreeMemoryRange {
guest_address: GuestAddress,
size: u64,
},
DynamicallyReclaimMemoryRange {
guest_address: GuestAddress,
size: u64,
},
BalloonTargetReached {
size: u64,
},
UnregisterMemory(VmMemoryRegionId),
IoEventWithAlloc {
evt: Event,
allocation: Alloc,
offset: u64,
datamatch: Datamatch,
register: bool,
},
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
Fields
source: VmMemorySource
Source of the memory to register (mapped file descriptor, shared memory region, etc.)
dest: VmMemoryDestination
Where to map the memory in the guest.
prot: Protection
Whether to map the memory read only (true) or read-write (false).
cache: MemCacheType
Cache attribute for guest memory setting
Register a memory to be mapped to the guest.
MmapAndRegisterMemory
Fields
shm: SharedMemory
Source of the memory to register (mapped file descriptor, shared memory region, etc.)
dest: VmMemoryDestination
Where to map the memory in the guest.
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
DynamicallyFreeMemoryRange
Call hypervisor to free the given memory range.
DynamicallyReclaimMemoryRange
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
.
IoEventWithAlloc
Register an ioeventfd by looking up using Alloc info.
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
- TheVm
to 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 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.