FROMLIST: virtio_mmio: pm: Add notification handlers for restore and freeze

Handle restore and freeze notifications from the PM core. Expose
these to individual virtio drivers that can quiesce and resume vq
operations.

Signed-off-by: Yurii Danilovskyi <glyd@opensynergy.com>
Signed-off-by: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>

Bug: 141626390
Link: https://lore.kernel.org/all/20211214161124.GA202691@opensynergy.com/
Change-Id: Ie53a16991b10c02ac125a55c4bbf04d89f0a365e
Signed-off-by: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
This commit is contained in:
Yurii Danilovskyi
2021-12-14 17:11:31 +01:00
committed by Todd Kjos
parent 9180348b91
commit f3f87608d8

View File

@@ -763,6 +763,26 @@ static void vm_unregister_cmdline_devices(void)
#endif #endif
#ifdef CONFIG_PM_SLEEP
static int virtio_mmio_freeze(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev);
return virtio_device_freeze(&vm_dev->vdev);
}
static int virtio_mmio_restore(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct virtio_mmio_device *vm_dev = platform_get_drvdata(pdev);
return virtio_device_restore(&vm_dev->vdev);
}
#endif
static SIMPLE_DEV_PM_OPS(virtio_mmio_pm_ops, virtio_mmio_freeze, virtio_mmio_restore);
/* Platform driver */ /* Platform driver */
static const struct of_device_id virtio_mmio_match[] = { static const struct of_device_id virtio_mmio_match[] = {
@@ -786,6 +806,7 @@ static struct platform_driver virtio_mmio_driver = {
.name = "virtio-mmio", .name = "virtio-mmio",
.of_match_table = virtio_mmio_match, .of_match_table = virtio_mmio_match,
.acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match), .acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match),
.pm = &virtio_mmio_pm_ops,
}, },
}; };