Skip to content

Commit e0c2ce8

Browse files
stephan-ghmstsirkin
authored andcommitted
virtio_mmio: Restore guest page size on resume
Virtio devices might lose their state when the VMM is restarted after a suspend to disk (hibernation) cycle. This means that the guest page size register must be restored for the virtio_mmio legacy interface, since otherwise the virtio queues are not functional. This is particularly problematic for QEMU that currently still defaults to using the legacy interface for virtio_mmio. Write the guest page size register again in virtio_mmio_restore() to make legacy virtio_mmio devices work correctly after hibernation. Signed-off-by: Stephan Gerhold <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent ed7ac37 commit e0c2ce8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/virtio/virtio_mmio.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,9 @@ static int virtio_mmio_restore(struct device *dev)
569569
{
570570
struct virtio_mmio_device *vm_dev = dev_get_drvdata(dev);
571571

572+
if (vm_dev->version == 1)
573+
writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE);
574+
572575
return virtio_device_restore(&vm_dev->vdev);
573576
}
574577

0 commit comments

Comments
 (0)