mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-virtio: Add the ability to serialize a Queue
This commit relies on serde to serialize and deserialize the content of a Queue structure. This will be useful information to store when implementing snapshot/restore feature for virtio devices. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
This commit is contained in:
committed by
Sebastien Boeuf
parent
b7faf4fdc1
commit
fd45e94510
@@ -383,11 +383,15 @@ impl<'a, 'b> Iterator for AvailIter<'a, 'b> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(remote = "GuestAddress")]
|
||||
struct GuestAddressDef(pub u64);
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
/// A virtio queue's parameters.
|
||||
pub struct Queue {
|
||||
/// The maximal size in elements offered by the device
|
||||
max_size: u16,
|
||||
pub max_size: u16,
|
||||
|
||||
/// The queue size in elements the driver selected
|
||||
pub size: u16,
|
||||
@@ -398,18 +402,22 @@ 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>>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user