From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from ws5-mx01.kavi.com (ws5-mx01.kavi.com [34.193.7.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DA945CD5BA7 for ; Tue, 19 Sep 2023 12:31:21 +0000 (UTC) Received: from lists.oasis-open.org (oasis.ws5.connectedcommunity.org [10.110.1.242]) by ws5-mx01.kavi.com (Postfix) with ESMTP id 44C8D26A2E for ; Tue, 19 Sep 2023 12:31:21 +0000 (UTC) Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id 31946986533 for ; Tue, 19 Sep 2023 12:31:21 +0000 (UTC) Received: from host09.ws5.connectedcommunity.org (host09.ws5.connectedcommunity.org [10.110.1.97]) by lists.oasis-open.org (Postfix) with QMQP id 1DC079864C2; Tue, 19 Sep 2023 12:31:21 +0000 (UTC) Mailing-List: contact virtio-comment-help@lists.oasis-open.org; run by ezmlm List-ID: Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id 0D66C9864D1 for ; Tue, 19 Sep 2023 12:31:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at kavi.com X-MC-Unique: xRj9NcooP4OmB-kyakr_nQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695126677; x=1695731477; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=foEuGHpN02cZZRHgVG6c0QInXgm/KQsAjoIQJjUhPEM=; b=i327Fh8M+UBvy5jenXS62Q86wdc94L0SP42P1RYUwUdLML4YnXzypSt4FlcZlPirb2 jBUpTep2zgQTaBz+N4NMkdlP6a37oZPlp2tVNAIL561/g12pES/RLhO4lii8gSicRsI2 D1PGPIz57WZrjcMRSjU1eBC9oPA/kbE+OTrlHc9BfK+oJUSeig6RkX+H3srfEn363DP8 9YXQMb8VTayxz51YwpoLI4f6nE/PQelwbsQT4+Uw0rhDrD2Li78OGK5/+kb7jwbi1H3f 9JUaIvTM0piyPn+lYWqjnLwIU6ZOEPKFkIvuVLP+wtnvJLYWJ6RrWKpv5iGs13emR7ia hAuA== X-Gm-Message-State: AOJu0YyULETBhPBehL7cJmPOF9cN4AJBW18emSXQp8CD/ZtpmhINSFgH GHWUW/ZcxJrjngTvYGi90UTduIZfT2MHLBSdq5CrSDYbeTLOernqD7y+T+vJt2L29DvyHwCSX8a 7noCpn8fnfSfRrf+g/HpoployXglEpoF8Gg== X-Received: by 2002:a17:907:7622:b0:9a1:e994:3444 with SMTP id jy2-20020a170907762200b009a1e9943444mr9781236ejc.3.1695126677426; Tue, 19 Sep 2023 05:31:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEb3B61aTdbbapBWgqBDzul7TRECZ9JfP3c02/1NZo6uc1VdIFZ3t0h1Xm1oeTneoLXE2/ODQ== X-Received: by 2002:a17:907:7622:b0:9a1:e994:3444 with SMTP id jy2-20020a170907762200b009a1e9943444mr9781216ejc.3.1695126677126; Tue, 19 Sep 2023 05:31:17 -0700 (PDT) Date: Tue, 19 Sep 2023 08:31:11 -0400 From: "Michael S. Tsirkin" To: Jiqian Chen Cc: Gerd Hoffmann , Jason Wang , Xuan Zhuo , David Airlie , Gurchetan Singh , Chia-I Wu , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , Robert Beckett , Mikhail Golubev-Ciuchea , Parav Pandit , virtio-comment@lists.oasis-open.org, virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, Stefano Stabellini , Roger Pau =?iso-8859-1?Q?Monn=E9?= , Alex Deucher , Christian Koenig , Stewart Hildebrand , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Huang Rui Message-ID: <20230919082802-mutt-send-email-mst@kernel.org> References: <20230919114242.2283646-1-Jiqian.Chen@amd.com> <20230919114242.2283646-2-Jiqian.Chen@amd.com> MIME-Version: 1.0 In-Reply-To: <20230919114242.2283646-2-Jiqian.Chen@amd.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [virtio-comment] Re: [VIRTIO PCI PATCH v5 1/1] transport-pci: Add freeze_mode to virtio_pci_common_cfg On Tue, Sep 19, 2023 at 07:42:42PM +0800, Jiqian Chen wrote: > When guest vm does S3, Qemu will reset and clear some things of virtio > devices, but guest can't aware that, so that may cause some problems. > For excample, Qemu calls virtio_reset->virtio_gpu_gl_reset when guest > resume, that function will destroy render resources of virtio-gpu. As > a result, after guest resume, the display can't come back and we only > saw a black screen. Due to guest can't re-create all the resources, so > we need to let Qemu not to destroy them when S3. > > For above purpose, we need a mechanism that allows guests and QEMU to > negotiate their reset behavior. So this patch add a new parameter > named freeze_mode to struct virtio_pci_common_cfg. And when guest > suspends, it can write freeze_mode to be FREEZE_S3, and then virtio > devices can change their reset behavior on Qemu side according to > freeze_mode. What's more, freeze_mode can be used for all virtio > devices to affect the behavior of Qemu, not just virtio gpu device. > > Signed-off-by: Jiqian Chen > --- > transport-pci.tex | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/transport-pci.tex b/transport-pci.tex > index a5c6719..2543536 100644 > --- a/transport-pci.tex > +++ b/transport-pci.tex > @@ -319,6 +319,7 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport > le64 queue_desc; /* read-write */ > le64 queue_driver; /* read-write */ > le64 queue_device; /* read-write */ > + le16 freeze_mode; /* read-write */ > le16 queue_notif_config_data; /* read-only for driver */ > le16 queue_reset; /* read-write */ > we can't add fields in the middle of the structure like this - offset of queue_notif_config_data and queue_reset changes. > @@ -393,6 +394,12 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport > \item[\field{queue_device}] > The driver writes the physical address of Device Area here. See section \ref{sec:Basic Facilities of a Virtio Device / Virtqueues}. > > +\item[\field{freeze_mode}] > + The driver writes this to set the freeze mode of virtio pci. > + VIRTIO_PCI_FREEZE_MODE_UNFREEZE - virtio-pci is running; > + VIRTIO_PCI_FREEZE_MODE_FREEZE_S3 - guest vm is doing S3, and virtio-pci enters S3 suspension; > + Other values are reserved for future use, like S4, etc. > + we need to specify these values then. we also need - feature bit to detect support for S3 - conformance statements documenting behavious under S3 > \item[\field{queue_notif_config_data}] > This field exists only if VIRTIO_F_NOTIF_CONFIG_DATA has been negotiated. > The driver will use this value when driver sends available buffer > -- > 2.34.1 This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC. In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting. Subscribe: virtio-comment-subscribe@lists.oasis-open.org Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org List help: virtio-comment-help@lists.oasis-open.org List archive: https://lists.oasis-open.org/archives/virtio-comment/ Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists Committee: https://www.oasis-open.org/committees/virtio/ Join OASIS: https://www.oasis-open.org/join/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from ws5-mx01.kavi.com (ws5-mx01.kavi.com [34.193.7.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B6BBCD5BA9 for ; Tue, 19 Sep 2023 12:31:24 +0000 (UTC) Received: from lists.oasis-open.org (oasis.ws5.connectedcommunity.org [10.110.1.242]) by ws5-mx01.kavi.com (Postfix) with ESMTP id C13DE2236E for ; Tue, 19 Sep 2023 12:31:23 +0000 (UTC) Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id B5942986560 for ; Tue, 19 Sep 2023 12:31:23 +0000 (UTC) Received: from host09.ws5.connectedcommunity.org (host09.ws5.connectedcommunity.org [10.110.1.97]) by lists.oasis-open.org (Postfix) with QMQP id AB0349864C2; Tue, 19 Sep 2023 12:31:23 +0000 (UTC) Mailing-List: contact virtio-dev-help@lists.oasis-open.org; run by ezmlm List-ID: Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [10.110.1.242]) by lists.oasis-open.org (Postfix) with ESMTP id 9DA79986503 for ; Tue, 19 Sep 2023 12:31:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at kavi.com X-MC-Unique: c7rwQiSVN8OQkhk3Hfsg5Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695126677; x=1695731477; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=foEuGHpN02cZZRHgVG6c0QInXgm/KQsAjoIQJjUhPEM=; b=mc7KUT2M4O45SpbsV2mtPLgAAUAZ/waPEUaAs9JwqUtLS88vG657e2vUHE78DH13S3 4RcOtCrQSAIEXGJWa8HDWeK17m7gyu8Cn2QQcVs6qLodjDlRhRLA5YnapIJmux/EOnjw s2AZB+ynGeeMkcQe6KmJ41rXa44pavYNI3fbEovA55KHzYnCmJZ48/6bBlc1RXbQL3yU MxgM5HGKifFiacf7+59j+micsdLxb120HiLEwS6GoTn8E0ry9YDcS9x+6nwm28cDObGX SSSdKVxNH1X5eMuT6Ph6JISClywK8KTt+ZwDoD9qdOiWS9p8ij7tm3x48LfH3+/29lFS YvSw== X-Gm-Message-State: AOJu0Ywt1DHNkZiyZ5AIqduOdiXutpajuahgQ4Gc2EATmdIfdtf+fbs7 Xn/BK6YBMQu/N1X0264MirPBGqHGrDEuFYPNQlNjIrqewibla6BdJUeFtoVuiaE6sxg4iFTC9sm e8j3vymhh0Ilk7eaf4VnDBS6aA/zg X-Received: by 2002:a17:907:7622:b0:9a1:e994:3444 with SMTP id jy2-20020a170907762200b009a1e9943444mr9781235ejc.3.1695126677426; Tue, 19 Sep 2023 05:31:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEb3B61aTdbbapBWgqBDzul7TRECZ9JfP3c02/1NZo6uc1VdIFZ3t0h1Xm1oeTneoLXE2/ODQ== X-Received: by 2002:a17:907:7622:b0:9a1:e994:3444 with SMTP id jy2-20020a170907762200b009a1e9943444mr9781216ejc.3.1695126677126; Tue, 19 Sep 2023 05:31:17 -0700 (PDT) Date: Tue, 19 Sep 2023 08:31:11 -0400 From: "Michael S. Tsirkin" To: Jiqian Chen Cc: Gerd Hoffmann , Jason Wang , Xuan Zhuo , David Airlie , Gurchetan Singh , Chia-I Wu , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , Robert Beckett , Mikhail Golubev-Ciuchea , Parav Pandit , virtio-comment@lists.oasis-open.org, virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, Stefano Stabellini , Roger Pau =?iso-8859-1?Q?Monn=E9?= , Alex Deucher , Christian Koenig , Stewart Hildebrand , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Huang Rui Message-ID: <20230919082802-mutt-send-email-mst@kernel.org> References: <20230919114242.2283646-1-Jiqian.Chen@amd.com> <20230919114242.2283646-2-Jiqian.Chen@amd.com> MIME-Version: 1.0 In-Reply-To: <20230919114242.2283646-2-Jiqian.Chen@amd.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [virtio-dev] Re: [VIRTIO PCI PATCH v5 1/1] transport-pci: Add freeze_mode to virtio_pci_common_cfg On Tue, Sep 19, 2023 at 07:42:42PM +0800, Jiqian Chen wrote: > When guest vm does S3, Qemu will reset and clear some things of virtio > devices, but guest can't aware that, so that may cause some problems. > For excample, Qemu calls virtio_reset->virtio_gpu_gl_reset when guest > resume, that function will destroy render resources of virtio-gpu. As > a result, after guest resume, the display can't come back and we only > saw a black screen. Due to guest can't re-create all the resources, so > we need to let Qemu not to destroy them when S3. > > For above purpose, we need a mechanism that allows guests and QEMU to > negotiate their reset behavior. So this patch add a new parameter > named freeze_mode to struct virtio_pci_common_cfg. And when guest > suspends, it can write freeze_mode to be FREEZE_S3, and then virtio > devices can change their reset behavior on Qemu side according to > freeze_mode. What's more, freeze_mode can be used for all virtio > devices to affect the behavior of Qemu, not just virtio gpu device. > > Signed-off-by: Jiqian Chen > --- > transport-pci.tex | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/transport-pci.tex b/transport-pci.tex > index a5c6719..2543536 100644 > --- a/transport-pci.tex > +++ b/transport-pci.tex > @@ -319,6 +319,7 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport > le64 queue_desc; /* read-write */ > le64 queue_driver; /* read-write */ > le64 queue_device; /* read-write */ > + le16 freeze_mode; /* read-write */ > le16 queue_notif_config_data; /* read-only for driver */ > le16 queue_reset; /* read-write */ > we can't add fields in the middle of the structure like this - offset of queue_notif_config_data and queue_reset changes. > @@ -393,6 +394,12 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport > \item[\field{queue_device}] > The driver writes the physical address of Device Area here. See section \ref{sec:Basic Facilities of a Virtio Device / Virtqueues}. > > +\item[\field{freeze_mode}] > + The driver writes this to set the freeze mode of virtio pci. > + VIRTIO_PCI_FREEZE_MODE_UNFREEZE - virtio-pci is running; > + VIRTIO_PCI_FREEZE_MODE_FREEZE_S3 - guest vm is doing S3, and virtio-pci enters S3 suspension; > + Other values are reserved for future use, like S4, etc. > + we need to specify these values then. we also need - feature bit to detect support for S3 - conformance statements documenting behavious under S3 > \item[\field{queue_notif_config_data}] > This field exists only if VIRTIO_F_NOTIF_CONFIG_DATA has been negotiated. > The driver will use this value when driver sends available buffer > -- > 2.34.1 --------------------------------------------------------------------- To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E997FCD5BA7 for ; Tue, 19 Sep 2023 12:32:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232078AbjISMcK (ORCPT ); Tue, 19 Sep 2023 08:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232068AbjISMcH (ORCPT ); Tue, 19 Sep 2023 08:32:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99F62118 for ; Tue, 19 Sep 2023 05:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695126679; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=foEuGHpN02cZZRHgVG6c0QInXgm/KQsAjoIQJjUhPEM=; b=QDHQIaWsLEkA72StMWFfVv9M9F9esSpISeNexSjFq3zaczK6vWajsTXUsTEsElM5jEafFG a9KZv7It4Yzt1+hYoSF1zFQ3JbRHacdOn2gK8mdndpj7B5zHytNPMvgdDz2oOiibxD1C+v C7BZyqzIfBJl1RjTyHWyaaTEXt5hNPg= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-t2GtUS2kPNy29sG7ufwi8g-1; Tue, 19 Sep 2023 08:31:18 -0400 X-MC-Unique: t2GtUS2kPNy29sG7ufwi8g-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9a9e3f703dfso410298866b.1 for ; Tue, 19 Sep 2023 05:31:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695126677; x=1695731477; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=foEuGHpN02cZZRHgVG6c0QInXgm/KQsAjoIQJjUhPEM=; b=orfQ5sryyZ1yjO2LiW20sym49qwuzVt6MxYa6vpEqb1iNjKcvURB44sgLUgA/cbKVB ELq1qRmU0RxnzNnSjyQiBIgHFlroi9TSsZn12uvjWvzB4XhumpK8szz8wqS3fEBPMNBB U5TGuw/xS/2s/9WhygZErynvLFSPHSNmuxyOdkhtp0tEHBL1JCn35EfryIGPNSN5eDL6 R8EUEdQsPoFZTwxxiWjhRMmd7cDJuRj41YMf9H4HQsiLShJyRcF8i2d9CHWD26f/FqTc /d47jM5HTnnQcYVe36Vlh6+qThuHIUW4070FZxe7i4EmlxDVE5GGZbJfDMmfWo9zzXPF dxSA== X-Gm-Message-State: AOJu0Yy2SULhpTjhKuBE02fcTYIoJVZ93yq1fpkpeGS5B4kRrwX0HA7L koOjxgEj9+6kgQQeBglPRHis22HxHvBaMPVZ4GAsF2s/Y4YJarQkhTdSHt+x5MKjn1L4xuk3EvY aox6DuJnWH8aLyjaIvCupQiMH X-Received: by 2002:a17:907:7622:b0:9a1:e994:3444 with SMTP id jy2-20020a170907762200b009a1e9943444mr9781247ejc.3.1695126677427; Tue, 19 Sep 2023 05:31:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEb3B61aTdbbapBWgqBDzul7TRECZ9JfP3c02/1NZo6uc1VdIFZ3t0h1Xm1oeTneoLXE2/ODQ== X-Received: by 2002:a17:907:7622:b0:9a1:e994:3444 with SMTP id jy2-20020a170907762200b009a1e9943444mr9781216ejc.3.1695126677126; Tue, 19 Sep 2023 05:31:17 -0700 (PDT) Received: from redhat.com ([2.52.26.122]) by smtp.gmail.com with ESMTPSA id e7-20020a1709067e0700b0099bd0b5a2bcsm7759563ejr.101.2023.09.19.05.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 05:31:16 -0700 (PDT) Date: Tue, 19 Sep 2023 08:31:11 -0400 From: "Michael S. Tsirkin" To: Jiqian Chen Cc: Gerd Hoffmann , Jason Wang , Xuan Zhuo , David Airlie , Gurchetan Singh , Chia-I Wu , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , Robert Beckett , Mikhail Golubev-Ciuchea , Parav Pandit , virtio-comment@lists.oasis-open.org, virtio-dev@lists.oasis-open.org, qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, Stefano Stabellini , Roger Pau =?iso-8859-1?Q?Monn=E9?= , Alex Deucher , Christian Koenig , Stewart Hildebrand , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Huang Rui Subject: Re: [VIRTIO PCI PATCH v5 1/1] transport-pci: Add freeze_mode to virtio_pci_common_cfg Message-ID: <20230919082802-mutt-send-email-mst@kernel.org> References: <20230919114242.2283646-1-Jiqian.Chen@amd.com> <20230919114242.2283646-2-Jiqian.Chen@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230919114242.2283646-2-Jiqian.Chen@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 19, 2023 at 07:42:42PM +0800, Jiqian Chen wrote: > When guest vm does S3, Qemu will reset and clear some things of virtio > devices, but guest can't aware that, so that may cause some problems. > For excample, Qemu calls virtio_reset->virtio_gpu_gl_reset when guest > resume, that function will destroy render resources of virtio-gpu. As > a result, after guest resume, the display can't come back and we only > saw a black screen. Due to guest can't re-create all the resources, so > we need to let Qemu not to destroy them when S3. > > For above purpose, we need a mechanism that allows guests and QEMU to > negotiate their reset behavior. So this patch add a new parameter > named freeze_mode to struct virtio_pci_common_cfg. And when guest > suspends, it can write freeze_mode to be FREEZE_S3, and then virtio > devices can change their reset behavior on Qemu side according to > freeze_mode. What's more, freeze_mode can be used for all virtio > devices to affect the behavior of Qemu, not just virtio gpu device. > > Signed-off-by: Jiqian Chen > --- > transport-pci.tex | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/transport-pci.tex b/transport-pci.tex > index a5c6719..2543536 100644 > --- a/transport-pci.tex > +++ b/transport-pci.tex > @@ -319,6 +319,7 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport > le64 queue_desc; /* read-write */ > le64 queue_driver; /* read-write */ > le64 queue_device; /* read-write */ > + le16 freeze_mode; /* read-write */ > le16 queue_notif_config_data; /* read-only for driver */ > le16 queue_reset; /* read-write */ > we can't add fields in the middle of the structure like this - offset of queue_notif_config_data and queue_reset changes. > @@ -393,6 +394,12 @@ \subsubsection{Common configuration structure layout}\label{sec:Virtio Transport > \item[\field{queue_device}] > The driver writes the physical address of Device Area here. See section \ref{sec:Basic Facilities of a Virtio Device / Virtqueues}. > > +\item[\field{freeze_mode}] > + The driver writes this to set the freeze mode of virtio pci. > + VIRTIO_PCI_FREEZE_MODE_UNFREEZE - virtio-pci is running; > + VIRTIO_PCI_FREEZE_MODE_FREEZE_S3 - guest vm is doing S3, and virtio-pci enters S3 suspension; > + Other values are reserved for future use, like S4, etc. > + we need to specify these values then. we also need - feature bit to detect support for S3 - conformance statements documenting behavious under S3 > \item[\field{queue_notif_config_data}] > This field exists only if VIRTIO_F_NOTIF_CONFIG_DATA has been negotiated. > The driver will use this value when driver sends available buffer > -- > 2.34.1