How was this tested ? Example command+steps would be nice have in this
cover letter.
Nirmoy
On 03.10.25 07:33, [email protected] wrote:
From: Dongwon Kim <[email protected]>
This patch series implements functions for .freeze and .restore hooks for
virtio-gpu driver as well as pm-notifier to handle object restoration in
S4(hiberation) case.
First patch adds `virtgpu_freeze` and `virtgpu_restore` functions.
These functions handle the deletion of virtio queues before suspension and
their recreation during the restoration process.
Second patch implements a mechanism for restoring `virtio_gpu_object` instances.
This is necessary because the host (QEMU) deletes all associated resources
during
the virtio-gpu reset, which occurs as part of hiberation/resume process.
Third patch adds pm-notifier to the driver that handles resubmission of
virtio-gpu
objects to the QEMU once the guest resumes from hibenation.
These changes ensure that the virtio-gpu driver can properly handle hibernation
scenarios without resource loss.
v2: 10ms sleep is added in virtgpu_freeze to avoid the situation
the driver is locked up during resumption.
v3: Plain 10ms delay (v2) is replaced with wait calls which wait until
the virtio queue is empty.
(Dmitry Osipenko)
v4: New version of patchset only covers S4 case because loss of resources in S3
case can be avoided by skipping virtio-gpu-reset in QEMU
(hw/display/virtio-gpu.c).
To skip virtio-gpu-reset (soft-reset), virtio-gpu-pci device should be
attached to
PCIE bus AND a PCIE option, 'x-pcie-pm-no-soft-reset' should added and set
to 'true'.
(e.g. -device virtio-gpu-pci,bus=port,x-pcie-pm-no-soft-reset=true)
v5: Remove virtio_gpu_object from the restore list before freeing the object
to prevent an use-after-free situation.
(Nirmoy Das)
Protect restore list operations with a spinlock
(Nirmoy Das)
Move restore list node into virtio_gpu_bo struct to reduce memory usage
(Dmitry Osipenko)
Remove unused header - drm_atomic_helper.h
(Dmitry Osipenko)
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 | 60 +++++++++++++++++++++++-
drivers/gpu/drm/virtio/virtgpu_drv.h | 12 +++++
drivers/gpu/drm/virtio/virtgpu_kms.c | 51 ++++++++++++++++++---
drivers/gpu/drm/virtio/virtgpu_object.c | 61 +++++++++++++++++++++++++
4 files changed, 177 insertions(+), 7 deletions(-)