From: "Michael S. Tsirkin" <mst@redhat.com>
To: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio_mmio: pm: Add notification handlers for restore and freeze
Date: Mon, 13 Dec 2021 18:55:44 -0500 [thread overview]
Message-ID: <20211213185317-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20211213160002.GA202134@opensynergy.com>
On Mon, Dec 13, 2021 at 05:00:08PM +0100, Mikhail Golubev wrote:
> From: Yurii Danilovskyi <glyd@opensynergy.com>
>
> 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>
> ---
> drivers/virtio/virtio_mmio.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 56128b9c46eb..af79f8c2a2f2 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -762,6 +762,24 @@ static void vm_unregister_cmdline_devices(void)
>
> #endif
>
> +static int __maybe_unused 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 __maybe_unused 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);
> +}
> +
> +static SIMPLE_DEV_PM_OPS(virtio_mmio_pm_ops, virtio_mmio_freeze, virtio_mmio_restore);
> +
> /* Platform driver */
>
> static const struct of_device_id virtio_mmio_match[] = {
> @@ -785,6 +803,7 @@ static struct platform_driver virtio_mmio_driver = {
> .name = "virtio-mmio",
> .of_match_table = virtio_mmio_match,
> .acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match),
> + .pm = &virtio_mmio_pm_ops,
> },
> };
All this code needs to be within ifdef CONFIG_PM_SLEEP. Alternatively,
tweak virtio.h to expose virtio_device_freeze/virtio_device_restore
unconditionally.
>
> --
> 2.34.1
>
>
> --
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
Cc: virtualization@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, Jason Wang <jasowang@redhat.com>
Subject: Re: [PATCH] virtio_mmio: pm: Add notification handlers for restore and freeze
Date: Mon, 13 Dec 2021 18:55:44 -0500 [thread overview]
Message-ID: <20211213185317-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20211213160002.GA202134@opensynergy.com>
On Mon, Dec 13, 2021 at 05:00:08PM +0100, Mikhail Golubev wrote:
> From: Yurii Danilovskyi <glyd@opensynergy.com>
>
> 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>
> ---
> drivers/virtio/virtio_mmio.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 56128b9c46eb..af79f8c2a2f2 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -762,6 +762,24 @@ static void vm_unregister_cmdline_devices(void)
>
> #endif
>
> +static int __maybe_unused 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 __maybe_unused 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);
> +}
> +
> +static SIMPLE_DEV_PM_OPS(virtio_mmio_pm_ops, virtio_mmio_freeze, virtio_mmio_restore);
> +
> /* Platform driver */
>
> static const struct of_device_id virtio_mmio_match[] = {
> @@ -785,6 +803,7 @@ static struct platform_driver virtio_mmio_driver = {
> .name = "virtio-mmio",
> .of_match_table = virtio_mmio_match,
> .acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match),
> + .pm = &virtio_mmio_pm_ops,
> },
> };
All this code needs to be within ifdef CONFIG_PM_SLEEP. Alternatively,
tweak virtio.h to expose virtio_device_freeze/virtio_device_restore
unconditionally.
>
> --
> 2.34.1
>
>
> --
next prev parent reply other threads:[~2021-12-13 23:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 16:00 [PATCH] virtio_mmio: pm: Add notification handlers for restore and freeze Mikhail Golubev
2021-12-13 18:46 ` kernel test robot
2021-12-13 18:46 ` kernel test robot
2021-12-13 18:46 ` kernel test robot
2021-12-13 23:55 ` Michael S. Tsirkin [this message]
2021-12-13 23:55 ` Michael S. Tsirkin
2021-12-14 16:21 ` Mikhail Golubev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211213185317-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=Mikhail.Golubev@opensynergy.com \
--cc=linux-kernel@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.