mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: Simplify virtio device reset
Rather than having to give and return the ioeventfd used for a device clone them each time. This will make it simpler when we start handling the driver enabling fewer queues than advertised by the device. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -116,7 +116,7 @@ pub trait VirtioDevice: Send {
|
||||
|
||||
/// Optionally deactivates this device and returns ownership of the guest memory map, interrupt
|
||||
/// event, and queue events.
|
||||
fn reset(&mut self) -> Option<(Arc<dyn VirtioInterrupt>, Vec<EventFd>)> {
|
||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ impl VirtioCommon {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) -> Option<(Arc<dyn VirtioInterrupt>, Vec<EventFd>)> {
|
||||
pub fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||
// We first must resume the virtio thread if it was paused.
|
||||
if self.pause_evt.take().is_some() {
|
||||
self.resume().ok()?;
|
||||
@@ -307,11 +307,8 @@ impl VirtioCommon {
|
||||
}
|
||||
}
|
||||
|
||||
// Return the interrupt and queue EventFDs
|
||||
Some((
|
||||
self.interrupt_cb.take().unwrap(),
|
||||
self.queue_evts.take().unwrap(),
|
||||
))
|
||||
// Return the interrupt
|
||||
Some(self.interrupt_cb.take().unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user