[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230919104607.2282248-1-Jiqian.Chen@amd.com>
Date: Tue, 19 Sep 2023 18:46:05 +0800
From: Jiqian Chen <Jiqian.Chen@....com>
To: Gerd Hoffmann <kraxel@...hat.com>,
Jason Wang <jasowang@...hat.com>,
"Michael S . Tsirkin" <mst@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
David Airlie <airlied@...hat.com>,
"Gurchetan Singh" <gurchetansingh@...omium.org>,
Chia-I Wu <olvaffe@...il.com>,
Marc-André Lureau <marcandre.lureau@...il.com>,
"Robert Beckett" <bob.beckett@...labora.com>,
<virtualization@...ts.linux-foundation.org>,
<linux-kernel@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>
CC: <qemu-devel@...gnu.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
Juergen Gross <jgross@...e.com>,
"Boris Ostrovsky" <boris.ostrovsky@...cle.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Roger Pau Monné <roger.pau@...rix.com>,
Alex Deucher <Alexander.Deucher@....com>,
"Christian Koenig" <Christian.Koenig@....com>,
Stewart Hildebrand <Stewart.Hildebrand@....com>,
Xenia Ragiadakou <burzalodowa@...il.com>,
Honglei Huang <Honglei1.Huang@....com>,
Julia Zhang <Julia.Zhang@....com>,
Huang Rui <Ray.Huang@....com>,
Jiqian Chen <Jiqian.Chen@....com>
Subject: [LINUX KERNEL PATCH v5 0/1] add freeze_mode for virtio_pci and add S3 support for virtgpu
Hi all,
This is the v5 of kernel patches and v5 makes below changes:
* Since this series patches add a new mechanism that let virtgpu and Qemu can negotiate
their reset behavior, and other guys hope me can improve this mechanism to virtio pci
level, so that other virtio devices can also benefit from it. So instead of adding
new feature flag VIRTIO_GPU_F_FREEZE_S3 only serves for virtgpu, v5 add a new parameter
named freeze_mode to virtio_pci_common_cfg, when guest begin suspending, set freeze_mode
to FREEZE_S3, and then all virtio devices can get this status, and change their reset
behavior according freeze_mode. See the new commit "virtio_pci: Add freeze_mode for
virtio_pci_common_cfg"
* The second commit "virtgpu: Add freeze and restore func to reinit vqs" is the same as
before, it delete virtqueus in freeze() and re-initialize virtqueus in restore().
The link to trace this issue:
https://gitlab.com/qemu-project/qemu/-/issues/1860
Best regards,
Jiqian Chen
v4:
Link:
no v4 of kernel patch.
V4 of Qemu patch:
https://lore.kernel.org/qemu-devel/20230720120816.8751-1-Jiqian.Chen@amd.com/
v3:
makes below changes:
* Use enum for freeze mode, so this can be extended with more
modes in the future.
* Rename functions and paratemers with "_S3" postfix.
And no functional changes.
Link:
https://lore.kernel.org/lkml/20230720115805.8206-1-Jiqian.Chen@amd.com/T/#t
V3 of Qemu patch:
https://lore.kernel.org/qemu-devel/20230719074726.1613088-1-Jiqian.Chen@amd.com/T/#t
v2:
makes below changes:
* Change VIRTIO_CPU_CMD_STATUS_FREEZING to 0x0400 (<0x1000)
* Add a new feature flag VIRTIO_GPU_F_FREEZING, so that guest and
host can negotiate whenever freezing is supported or not.
Link:
https://lore.kernel.org/lkml/20230630073448.842767-1-Jiqian.Chen@amd.com/T/#t
V2 of Qemu patch:
https://lore.kernel.org/qemu-devel/20230630070016.841459-1-Jiqian.Chen@amd.com/T/#t
v1:
Hi all,
I am working to implement virtgpu S3 function on Xen.
Currently on Xen, if we start a guest who enables virtgpu, and then run "echo mem >
/sys/power/state" to suspend guest. And run "sudo xl trigger <guest id> s3resume"
to resume guest. We can find that the guest kernel comes back, but the display doesn't.
It just shows a black screen.
In response to the above phenomenon, I have found two problems.
First, if we move mouse on the black screen, guest kernel still sends a cursor request
to Qemu, but Qemu doesn't response. Because when guest is suspending, it calls
device_suspend, and then call into Qemu to call virtio_reset->__virtio_queue_reset. In
__virtio_queue_reset, it clears all virtqueue information on Qemu end. So, after guest
resumes, Qemu can't get message from virtqueue.
Second, the reason why display can't come back is that when guest is suspending, it calls
into Qemu to call virtio_reset->virtio_gpu_gl_reset. In virtio_gpu_gl_reset, it destroys
all resources and resets renderer, which are used for display. So after guest resumes,
the display can't come back to the status when guest is suspended.
This patch initializes virtqueue when guest is resuming to solve first problem. And it
notifies Qemu that guest is suspending to prevent Qemu destroying resources, this is to
solve second problem. And then, I can bring the display back, and everything continues
their actions after guest resumes.
Link:
https://lore.kernel.org/lkml/20230608063857.1677973-1-Jiqian.Chen@amd.com/
V1 of Qemu patch:
https://lore.kernel.org/qemu-devel/20230608025655.1674357-2-Jiqian.Chen@amd.com/
Jiqian Chen (2):
virtio_pci: Add freeze_mode for virtio_pci_common_cfg
virtgpu: Add freeze and restore func to reinit vqs
drivers/gpu/drm/virtio/virtgpu_drv.c | 23 ++++++++++++++++++++
drivers/gpu/drm/virtio/virtgpu_drv.h | 1 +
drivers/gpu/drm/virtio/virtgpu_kms.c | 30 ++++++++++++++++++--------
drivers/virtio/virtio.c | 13 +++++++++++
drivers/virtio/virtio_pci_modern.c | 9 ++++++++
drivers/virtio/virtio_pci_modern_dev.c | 16 ++++++++++++++
include/linux/virtio_config.h | 1 +
include/linux/virtio_pci_modern.h | 2 ++
include/uapi/linux/virtio_pci.h | 16 ++++++++++++--
9 files changed, 100 insertions(+), 11 deletions(-)
--
2.34.1
Powered by blists - more mailing lists