From: dongwon.kim@intel.com
To: dri-devel@lists.freedesktop.org, airlied@redhat.com,
kraxel@redhat.com, dmitry.osipenko@collabora.com
Subject: [PATCH v8 0/3] Virtio-GPU S4 (hibernation) support
Date: Wed, 29 Apr 2026 13:47:26 -0700 [thread overview]
Message-ID: <20260429204729.993669-1-dongwon.kim@intel.com> (raw)
From: Dongwon Kim <dongwon.kim@intel.com>
This patch series implements the .freeze and .restore hooks for the virtio-gpu
driver, alongside a PM notifier to manage object restoration during S4
(hibernation) cycles.
The series is structured as follows:
1. The first patch introduces `virtgpu_freeze` and `virtgpu_restore`. These
functions handle the teardown of virtio queues before suspension and their
subsequent recreation during the resume process.
2. The second patch implements a tracking and restoration mechanism for
`virtio_gpu_object` instances. This is essential because the host (e.g., QEMU)
destroys all associated graphics resources during the virtio-gpu reset
triggered by the hibernation/resume cycle.
3. The third patch adds a PM notifier to handle the resubmission of these
tracked virtio-gpu objects to the host once the guest restores its
virtqueues.
Together, these changes ensure that the virtio-gpu driver can survive
hibernation without resource loss or invalid resource errors.
v2: - Added 10ms sleep in virtgpu_freeze to prevent lockups during resumption.
v3: - Replaced the fixed 10ms delay with wait calls that trigger once the
virtio queue is empty.
(Dmitry Osipenko)
v4: - Limited the scope to S4 (hibernation). S3 resource loss can be avoided
via QEMU configurations (e.g., x-pcie-pm-no-soft-reset=true).
v5: - Implemented removal of objects from the restore list before freeing to
prevent a use-after-free situation.
(Nirmoy Das)
- Protected restore list operations with a spinlock.
(Nirmoy Das)
- Moved the restore list node into the virtio_gpu_bo struct to optimize
memory usage.
(Dmitry Osipenko)
- Removed unused header: drm_atomic_helper.h.
(Dmitry Osipenko)
v6: - Added support for objects backed by imported dma-bufs.
(Dmitry Osipenko)
- Excluded virgl 3D objects from the restore list as they are currently
non-recoverable.
(Dmitry Osipenko)
- Renamed the list node to 'restore_node'.
(Nirmoy Das)
- Switched from spinlock to mutex for restore list updates.
(Nirmoy Das)
- Initialized restore_node at creation to allow safe 'list_empty' checks.
- Introduced a 'hibernation' flag in the PM notifier to trigger restoration
at the correct stage in `virtgpu_restore`.
v7: - Added helper: virtio_gpu_add_object_to_restore_list.
(Dmitry Osipenko)
- Implemented unreferencing of all host-side objects before hibernation
to ensure a clean state upon resume.
(Dmitry Osipenko)
v8: - Introduced virtio_gpu_remove_from_restore_list helper and ensured it is
called across all object destruction paths (General, Prime, and VRAM)
to prevent use-after-free.
(Dmitry Osipenko)
- Relocated restore list removal logic from the final cleanup stage to
the initial free stage for improved synchronization.
(Dmitry Osipenko)
- Added missing drm_print.h header.
Dongwon Kim (3):
drm/virtio: Freeze and restore hooks to support suspend and resume
drm/virtio: Add support for saving and restoring virtio_gpu_objects
drm/virtio: Add PM notifier to restore objects after hibernation
drivers/gpu/drm/virtio/virtgpu_drv.c | 74 ++++++++++++++++++++-
drivers/gpu/drm/virtio/virtgpu_drv.h | 24 ++++++-
drivers/gpu/drm/virtio/virtgpu_kms.c | 54 +++++++++++++--
drivers/gpu/drm/virtio/virtgpu_object.c | 88 ++++++++++++++++++++++++-
drivers/gpu/drm/virtio/virtgpu_prime.c | 45 ++++++++++++-
drivers/gpu/drm/virtio/virtgpu_vq.c | 13 +++-
drivers/gpu/drm/virtio/virtgpu_vram.c | 5 +-
7 files changed, 289 insertions(+), 14 deletions(-)
--
2.34.1
next reply other threads:[~2026-04-29 20:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 20:47 dongwon.kim [this message]
2026-04-29 20:47 ` [PATCH v8 1/3] drm/virtio: Freeze and restore hooks to support suspend and resume dongwon.kim
2026-05-05 1:00 ` Claude review: " Claude Code Review Bot
2026-04-29 20:47 ` [PATCH v8 2/3] drm/virtio: Add support for saving and restoring virtio_gpu_objects dongwon.kim
2026-05-05 1:00 ` Claude review: " Claude Code Review Bot
2026-04-29 20:47 ` [PATCH v8 3/3] drm/virtio: Add PM notifier to restore objects after hibernation dongwon.kim
2026-05-05 1:00 ` Claude review: " Claude Code Review Bot
2026-05-05 1:00 ` Claude review: Virtio-GPU S4 (hibernation) support Claude Code Review Bot
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=20260429204729.993669-1-dongwon.kim@intel.com \
--to=dongwon.kim@intel.com \
--cc=airlied@redhat.com \
--cc=dmitry.osipenko@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox