mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices, vm-virtio: Refactor queue state saving/restoring
Use a separate QueueState structure which can be versioned. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
831dff8b4e
commit
57f532a760
@@ -9,8 +9,5 @@ default = []
|
||||
|
||||
[dependencies]
|
||||
log = "0.4.14"
|
||||
serde = ">=1.0.27"
|
||||
serde_derive = ">=1.0.27"
|
||||
serde_json = ">=1.0.9"
|
||||
virtio-bindings = { version = "0.1", features = ["virtio-v5_0_0"]}
|
||||
vm-memory = { version = "0.5.0", features = ["backend-mmap", "backend-atomic"] }
|
||||
@@ -12,8 +12,6 @@
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
|
||||
@@ -384,11 +384,7 @@ impl<'a, 'b> Iterator for AvailIter<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(remote = "GuestAddress")]
|
||||
struct GuestAddressDef(pub u64);
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
#[derive(Clone)]
|
||||
/// A virtio queue's parameters.
|
||||
pub struct Queue {
|
||||
/// The maximal size in elements offered by the device
|
||||
@@ -403,22 +399,18 @@ pub struct Queue {
|
||||
/// Interrupt vector index of the queue
|
||||
pub vector: u16,
|
||||
|
||||
#[serde(with = "GuestAddressDef")]
|
||||
/// Guest physical address of the descriptor table
|
||||
pub desc_table: GuestAddress,
|
||||
|
||||
#[serde(with = "GuestAddressDef")]
|
||||
/// Guest physical address of the available ring
|
||||
pub avail_ring: GuestAddress,
|
||||
|
||||
#[serde(with = "GuestAddressDef")]
|
||||
/// Guest physical address of the used ring
|
||||
pub used_ring: GuestAddress,
|
||||
|
||||
pub next_avail: Wrapping<u16>,
|
||||
pub next_used: Wrapping<u16>,
|
||||
|
||||
#[serde(skip)]
|
||||
pub iommu_mapping_cb: Option<Arc<VirtioIommuRemapping>>,
|
||||
|
||||
/// VIRTIO_F_RING_EVENT_IDX negotiated
|
||||
|
||||
Reference in New Issue
Block a user