Hi Dmitry, > Subject: Re: [PATCH v4 0/3] Virtio-GPU S4 support > > On 9/24/25 22:47, [email protected] wrote: > > From: Dongwon Kim <[email protected]> > > > > This patch series introduces support for handling hibernation (S4) in > > the virtio-gpu driver by implementing .freeze and .restore hooks, > > along with a PM notifier to restore GPU resources upon resume. > > > > Patch 1 adds virtgpu_freeze and virtgpu_restore functions, which > > manage virtio queue teardown before suspend/hibernation and > > reinitialization during resume. > > > > Patch 2 implements a mechanism to track and restore virtio_gpu_object > > instances, addressing the issue where QEMU discards resources during > > virtio-gpu-reset triggered by hibernation. > > > > Patch 3 adds a PM notifier that triggers resubmission of GPU objects > > to QEMU when the guest resumes from hibernation. > > > > These changes ensure that the virtio-gpu driver can reliably restore > > virtio-gpu resources after hibernation, preventing resource loss that > > leads to system's instability. > > > > 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). For this, virtio-gpu-pci device should be > > attached to PCIE bus AND a PCIE option, 'x-pcie-pm-no-soft-reset' needs > > to be enabled when launching QEMU > > (e.g. -device > > virtio-gpu-pci,bus=port,x-pcie-pm-no-soft-reset=true) > > > > 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: Restore Virt-GPU res on hibernation resume via PM > > notifier > > > > drivers/gpu/drm/virtio/virtgpu_drv.c | 60 ++++++++++++++++++++- > > drivers/gpu/drm/virtio/virtgpu_drv.h | 13 +++++ > > drivers/gpu/drm/virtio/virtgpu_kms.c | 49 ++++++++++++++--- > > drivers/gpu/drm/virtio/virtgpu_object.c | 71 > > +++++++++++++++++++++++++ > > 4 files changed, 186 insertions(+), 7 deletions(-) > > > > Hi, > > Hibernation works well for me with v4, going to apply patches soon. > > Re `x-pcie-pm-no-soft-reset=true`, apparently it's not enough to have it for > S3. > I'm still seeing virtio-gpu being reset with S3 and this reset comes from a > guest kernel writing PCI reg, resetting PCI device on kernel resume. Will look > further into it.
[Kim, Dongwon] That option only works when you set up virtio-gpu as a PCIE device. I am wondering if you set up your PCIE bus. This are params I added for it. -device pcie-root-port,id=root_port1,bus=pcie.0 \ -device virtio-vga,bus=root_port1,x-pcie-pm-no-soft-reset=true \ > > -- > Best regards, > Dmitry
