public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH v8 0/3] Virtio-GPU S4 (hibernation) support
@ 2026-04-29 20:47 dongwon.kim
  2026-04-29 20:47 ` [PATCH v8 1/3] drm/virtio: Freeze and restore hooks to support suspend and resume dongwon.kim
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: dongwon.kim @ 2026-04-29 20:47 UTC (permalink / raw)
  To: dri-devel, airlied, kraxel, dmitry.osipenko

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-05-05  1:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-29 20:47 [PATCH v8 0/3] Virtio-GPU S4 (hibernation) support dongwon.kim
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox