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:
@@ -274,7 +274,7 @@ impl VirtioDevice for Blk {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset(&mut self) -> Option<(Arc<dyn VirtioInterrupt>, Vec<EventFd>)> {
|
||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||
// We first must resume the virtio thread if it was paused.
|
||||
if self.common.pause_evt.take().is_some() {
|
||||
self.common.resume().ok()?;
|
||||
@@ -290,11 +290,8 @@ impl VirtioDevice for Blk {
|
||||
let _ = kill_evt.write(1);
|
||||
}
|
||||
|
||||
// Return the interrupt and queue EventFDs
|
||||
Some((
|
||||
self.common.interrupt_cb.take().unwrap(),
|
||||
self.common.queue_evts.take().unwrap(),
|
||||
))
|
||||
// Return the interrupt
|
||||
Some(self.common.interrupt_cb.take().unwrap())
|
||||
}
|
||||
|
||||
fn shutdown(&mut self) {
|
||||
|
||||
@@ -494,7 +494,7 @@ impl VirtioDevice for Fs {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset(&mut self) -> Option<(Arc<dyn VirtioInterrupt>, Vec<EventFd>)> {
|
||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||
// We first must resume the virtio thread if it was paused.
|
||||
if self.common.pause_evt.take().is_some() {
|
||||
self.common.resume().ok()?;
|
||||
@@ -510,11 +510,8 @@ impl VirtioDevice for Fs {
|
||||
let _ = kill_evt.write(1);
|
||||
}
|
||||
|
||||
// Return the interrupt and queue EventFDs
|
||||
Some((
|
||||
self.common.interrupt_cb.take().unwrap(),
|
||||
self.common.queue_evts.take().unwrap(),
|
||||
))
|
||||
// Return the interrupt
|
||||
Some(self.common.interrupt_cb.take().unwrap())
|
||||
}
|
||||
|
||||
fn shutdown(&mut self) {
|
||||
|
||||
@@ -330,7 +330,7 @@ impl VirtioDevice for Net {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn reset(&mut self) -> Option<(Arc<dyn VirtioInterrupt>, Vec<EventFd>)> {
|
||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||
// We first must resume the virtio thread if it was paused.
|
||||
if self.common.pause_evt.take().is_some() {
|
||||
self.common.resume().ok()?;
|
||||
@@ -346,11 +346,8 @@ impl VirtioDevice for Net {
|
||||
let _ = kill_evt.write(1);
|
||||
}
|
||||
|
||||
// Return the interrupt and queue EventFDs
|
||||
Some((
|
||||
self.common.interrupt_cb.take().unwrap(),
|
||||
self.common.queue_evts.take().unwrap(),
|
||||
))
|
||||
// Return the interrupt
|
||||
Some(self.common.interrupt_cb.take().unwrap())
|
||||
}
|
||||
|
||||
fn shutdown(&mut self) {
|
||||
|
||||
Reference in New Issue
Block a user