vm-virtio: Add shutdown method to VirtioDevice trait

This allows the VMM to explicitly shutdown devices as part of the VM
shutdown ahead of what Drop::drop() would do.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-02-14 10:07:00 +00:00
parent ebd83699dc
commit 545ea9ea33

View File

@ -101,6 +101,12 @@ pub trait VirtioDevice: Send {
fn iommu_translate(&self, addr: u64) -> u64 {
addr
}
/// Some devices may need to do some explicit shutdown work. This method
/// may be implemented to do this. The VMM should call shutdown() on
/// every device as part of shutting down the VM. Acting on the device
/// after a shutdown() can lead to unpredictable results.
fn shutdown(&mut self) {}
}
/// Trait providing address translation the same way a physical DMA remapping