[PATCH 4/4] um: virtio: allow devices to be configured for wakeup
Johannes Berg
johannes at sipsolutions.net
Mon Dec 14 07:08:26 EST 2020
From: Johannes Berg <johannes.berg at intel.com>
With all the IRQ machinery being in place, we can allow virtio
devices to additionally be configured as wakeup sources, in
which case basically any interrupt from them wakes us up. Note
that this requires a call FD because the VQs are all disabled.
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
arch/um/drivers/virtio_uml.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/um/drivers/virtio_uml.c b/arch/um/drivers/virtio_uml.c
index 781c3943a5bd..0673795fb966 100644
--- a/arch/um/drivers/virtio_uml.c
+++ b/arch/um/drivers/virtio_uml.c
@@ -1131,6 +1131,8 @@ static int virtio_uml_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, vu_dev);
+ device_set_wakeup_capable(&vu_dev->vdev.dev, true);
+
rc = register_virtio_device(&vu_dev->vdev);
if (rc)
put_device(&vu_dev->vdev.dev);
@@ -1304,7 +1306,10 @@ static int virtio_uml_suspend(struct platform_device *pdev, pm_message_t state)
vhost_user_set_vring_enable(vu_dev, vq->index, false);
}
- return 0;
+ if (!device_may_wakeup(&vu_dev->vdev.dev))
+ return 0;
+
+ return irq_set_irq_wake(vu_dev->irq, 1);
}
static int virtio_uml_resume(struct platform_device *pdev)
@@ -1319,7 +1324,10 @@ static int virtio_uml_resume(struct platform_device *pdev)
vhost_user_set_vring_enable(vu_dev, vq->index, true);
}
- return 0;
+ if (!device_may_wakeup(&vu_dev->vdev.dev))
+ return 0;
+
+ return irq_set_irq_wake(vu_dev->irq, 0);
}
static struct platform_driver virtio_uml_driver = {
--
2.26.2
More information about the linux-um
mailing list