mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-virtio: Simplify virtio feature handling
Remove duplicated code across the different devices by handling the virtio feature pages in VirtioDevice itself rather than in the backends. This works as no virtio devices use feature bits beyond 64-bits. Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
This commit is contained in:
committed by
Rob Bradford
parent
411e2b43ba
commit
14eddf72b4
@@ -62,14 +62,15 @@ pub trait VirtioDevice: Send {
|
||||
/// The maximum size of each queue that this device supports.
|
||||
fn queue_max_sizes(&self) -> &[u16];
|
||||
|
||||
/// The set of feature bits shifted by `page * 32`.
|
||||
fn features(&self, page: u32) -> u32 {
|
||||
let _ = page;
|
||||
/// The set of feature bits that this device supports.
|
||||
fn features(&self) -> u64 {
|
||||
0
|
||||
}
|
||||
|
||||
/// Acknowledges that this set of features should be enabled.
|
||||
fn ack_features(&mut self, page: u32, value: u32);
|
||||
fn ack_features(&mut self, value: u64) {
|
||||
let _ = value;
|
||||
}
|
||||
|
||||
/// Reads this device configuration space at `offset`.
|
||||
fn read_config(&self, offset: u64, data: &mut [u8]);
|
||||
|
||||
Reference in New Issue
Block a user