mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
The new crate vm-device is created here to host the definitions of traits not meant to be tied to virtio of VFIO specifically. We need to add a new trait to update external DMA mappings for devices, which is why the vm-device crate is the right fit for this. We can expect this crate to be extended later once the design gets approved from a rust-vmm perspective. In this specific use case, we can have some devices like VFIO or vhost-user ones requiring to be notified about mapping updates. This new trait ExternalDmaMapping will allow such devices to implement their own way to handle such event. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
12 lines
527 B
Rust
12 lines
527 B
Rust
/// Trait meant for triggering the DMA mapping update related to an external
|
|
/// device not managed fully through virtio. It is dedicated to virtio-iommu
|
|
/// in order to trigger the map update anytime the mapping is updated from the
|
|
/// guest.
|
|
pub trait ExternalDmaMapping: Send + Sync {
|
|
/// Map a memory range
|
|
fn map(&self, iova: u64, gpa: u64, size: u64) -> std::result::Result<(), std::io::Error>;
|
|
|
|
/// Unmap a memory range
|
|
fn unmap(&self, iova: u64, size: u64) -> std::result::Result<(), std::io::Error>;
|
|
}
|