mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: Make Bus::write() return an Option<Arc<Barrier>>
This can be uses to indicate to the caller that it should wait on the barrier before returning as there is some asynchronous activity triggered by the write which requires the KVM exit to block until it's completed. This is useful for having vCPU thread wait for the VMM thread to proceed to activate the virtio devices. See #1863 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -26,7 +26,7 @@ use std::ops::Deref;
|
||||
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||
use std::path::PathBuf;
|
||||
use std::result;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::{Arc, Barrier, Mutex};
|
||||
use url::Url;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use vm_allocator::GsiApic;
|
||||
@@ -314,7 +314,7 @@ impl BusDevice for MemoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
fn write(&mut self, _base: u64, offset: u64, data: &[u8]) {
|
||||
fn write(&mut self, _base: u64, offset: u64, data: &[u8]) -> Option<Arc<Barrier>> {
|
||||
match offset {
|
||||
SELECTION_OFFSET => {
|
||||
self.selected_slot = usize::from(data[0]);
|
||||
@@ -340,7 +340,8 @@ impl BusDevice for MemoryManager {
|
||||
offset
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user