mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 07:21:15 +00:00
vm-virtio: Set queue fields explicitely during restore
For both virtio-mmio and virtio-pci transport layers, we were setting every field from the saved snapshot during a restore. This is a problem when we don't want to override specific fields such as iommu_mapping_cb because the saved snapshot doesn't contain the appropriate information. That's why this commit sets only the appropriate field from the saved snapshot during a restore. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
02cbea546d
commit
646d33fea3
@ -170,12 +170,18 @@ impl MmioDevice {
|
|||||||
self.interrupt_status
|
self.interrupt_status
|
||||||
.store(state.interrupt_status, Ordering::SeqCst);
|
.store(state.interrupt_status, Ordering::SeqCst);
|
||||||
self.driver_status = state.driver_status;
|
self.driver_status = state.driver_status;
|
||||||
self.queues = state.queues.clone();
|
|
||||||
|
|
||||||
// Update virtqueues indexes for both available and used rings.
|
// Update virtqueues indexes for both available and used rings.
|
||||||
if let Some(mem) = self.mem.as_ref() {
|
if let Some(mem) = self.mem.as_ref() {
|
||||||
let mem = mem.memory();
|
let mem = mem.memory();
|
||||||
for queue in self.queues.iter_mut() {
|
for (i, queue) in self.queues.iter_mut().enumerate() {
|
||||||
|
queue.max_size = state.queues[i].max_size;
|
||||||
|
queue.size = state.queues[i].size;
|
||||||
|
queue.ready = state.queues[i].ready;
|
||||||
|
queue.vector = state.queues[i].vector;
|
||||||
|
queue.desc_table = state.queues[i].desc_table;
|
||||||
|
queue.avail_ring = state.queues[i].avail_ring;
|
||||||
|
queue.used_ring = state.queues[i].used_ring;
|
||||||
queue.next_avail = Wrapping(
|
queue.next_avail = Wrapping(
|
||||||
queue
|
queue
|
||||||
.used_index_from_memory(&mem)
|
.used_index_from_memory(&mem)
|
||||||
|
@ -456,12 +456,18 @@ impl VirtioPciDevice {
|
|||||||
self.device_activated = state.device_activated;
|
self.device_activated = state.device_activated;
|
||||||
self.interrupt_status
|
self.interrupt_status
|
||||||
.store(state.interrupt_status, Ordering::SeqCst);
|
.store(state.interrupt_status, Ordering::SeqCst);
|
||||||
self.queues = state.queues.clone();
|
|
||||||
|
|
||||||
// Update virtqueues indexes for both available and used rings.
|
// Update virtqueues indexes for both available and used rings.
|
||||||
if let Some(mem) = self.memory.as_ref() {
|
if let Some(mem) = self.memory.as_ref() {
|
||||||
let mem = mem.memory();
|
let mem = mem.memory();
|
||||||
for queue in self.queues.iter_mut() {
|
for (i, queue) in self.queues.iter_mut().enumerate() {
|
||||||
|
queue.max_size = state.queues[i].max_size;
|
||||||
|
queue.size = state.queues[i].size;
|
||||||
|
queue.ready = state.queues[i].ready;
|
||||||
|
queue.vector = state.queues[i].vector;
|
||||||
|
queue.desc_table = state.queues[i].desc_table;
|
||||||
|
queue.avail_ring = state.queues[i].avail_ring;
|
||||||
|
queue.used_ring = state.queues[i].used_ring;
|
||||||
queue.next_avail = Wrapping(
|
queue.next_avail = Wrapping(
|
||||||
queue
|
queue
|
||||||
.used_index_from_memory(&mem)
|
.used_index_from_memory(&mem)
|
||||||
|
Loading…
Reference in New Issue
Block a user