mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
vm-virtio: Get userspace mappings from VirtioDevice
Introduce new getter function to the VirtioDevice trait, as it will allow the caller to retrieve the list of userspace mappings associated with the device. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
8b823e5e34
commit
3fb0a02fa2
@ -34,6 +34,15 @@ pub trait VirtioInterrupt: Send + Sync {
|
||||
pub type VirtioIommuRemapping =
|
||||
Box<dyn Fn(u64) -> std::result::Result<u64, std::io::Error> + Send + Sync>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct UserspaceMapping {
|
||||
pub host_addr: u64,
|
||||
pub mem_slot: u32,
|
||||
pub addr: GuestAddress,
|
||||
pub len: GuestUsize,
|
||||
pub mergeable: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct VirtioSharedMemory {
|
||||
pub offset: u64,
|
||||
@ -120,6 +129,11 @@ pub trait VirtioDevice: Send {
|
||||
fn update_memory(&mut self, _mem: &GuestMemoryMmap) -> std::result::Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Returns the list of userspace mappings associated with this device.
|
||||
fn userspace_mappings(&self) -> Vec<UserspaceMapping> {
|
||||
Vec::new()
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait providing address translation the same way a physical DMA remapping
|
||||
|
Loading…
x
Reference in New Issue
Block a user