Hi Dmitry, I thought about what you are saying - avoiding GPU reset and it would work with normal sleep and restore (s3) but the problem I saw was hibernation scenario (s4). In this case, QEMU process will be terminated after guest hibernation and this actually destroys all the resources anyway. So some sort of recreation seemed to be required from my point of view.
> -----Original Message----- > From: Dmitry Osipenko <dmitry.osipe...@collabora.com> > Sent: Wednesday, July 9, 2025 6:26 AM > To: Kim, Dongwon <dongwon....@intel.com>; dri- > de...@lists.freedesktop.org > Cc: Kasireddy, Vivek <vivek.kasire...@intel.com> > Subject: Re: [PATCH v3 2/2] drm/virtio: Implement save and restore for > virtio_gpu_objects > > On 7/3/25 01:24, dongwon....@intel.com wrote: > > +int virtio_gpu_object_restore_all(struct virtio_gpu_device *vgdev) { > > + struct virtio_gpu_object_restore *curr, *tmp; > > + struct virtio_gpu_mem_entry *ents; > > + unsigned int nents; > > + int ret; > > + > > + list_for_each_entry_safe(curr, tmp, &vgdev->obj_restore, node) { > > + ret = virtio_gpu_object_shmem_init(vgdev, curr->bo, &ents, > &nents); > > + if (ret) > > + break; > > + > > + if (curr->params.blob) { > > + virtio_gpu_cmd_resource_create_blob(vgdev, curr- > >bo, &curr->params, > > + ents, nents); > > + } else if (curr->params.virgl) { > > + virtio_gpu_cmd_resource_create_3d(vgdev, curr->bo, > &curr->params, > > + NULL, NULL); > > + > > + if (curr->bo->attached) { > > + curr->bo->attached = false; > > + virtio_gpu_object_attach(vgdev, curr->bo, > ents, nents); > > + } > > + } else { > > + virtio_gpu_cmd_create_resource(vgdev, curr->bo, > &curr->params, > > + NULL, NULL); > > + if (curr->bo->attached) { > > + curr->bo->attached = false; > > + virtio_gpu_object_attach(vgdev, curr->bo, > ents, nents); > > + } > > + } > > + } > > So, back to the old question I posted on v1 about GPU reset... we need to re- > create BOs after resume because QEMU destroyed these BOs on VirtIO-GPU > reset that happens on suspend. This should be a wrong behaiviour to begin > with. We're suspending machine, hence the host resources shouldn't > disappear on resume. Can we avoid GPU resetting on suspend? > > The VQ freezing part is good to me, it pauses VirtIO-GPU gracefully on > suspend. But resetting GPU shouldn't happen and needs to be fixed, IMO. > Not doing reset should also make QEMU suspend/resume work for 3d > contexts. > > -- > Best regards, > Dmitry