mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-20 15:01:16 +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 =
|
pub type VirtioIommuRemapping =
|
||||||
Box<dyn Fn(u64) -> std::result::Result<u64, std::io::Error> + Send + Sync>;
|
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)]
|
#[derive(Clone)]
|
||||||
pub struct VirtioSharedMemory {
|
pub struct VirtioSharedMemory {
|
||||||
pub offset: u64,
|
pub offset: u64,
|
||||||
@ -120,6 +129,11 @@ pub trait VirtioDevice: Send {
|
|||||||
fn update_memory(&mut self, _mem: &GuestMemoryMmap) -> std::result::Result<(), Error> {
|
fn update_memory(&mut self, _mem: &GuestMemoryMmap) -> std::result::Result<(), Error> {
|
||||||
Ok(())
|
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
|
/// Trait providing address translation the same way a physical DMA remapping
|
||||||
|
Loading…
Reference in New Issue
Block a user