From nobody Wed May 15 13:34:30 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1694426777; cv=pass; d=zohomail.com; s=zohoarc; b=U42S9hSL1DQeThM4/sK0Yg+FCvtMU64Qp90zeuSORJNV0pFPYGHpYILuOclLCZmpxTZIiZ0Cf6fgoK9RICqeulg76/gApBXOk2fmOyo2KnaPMxqvCsW9bWbE6u4ra0+8bsYzre/XgaVkJAkCklib8ViHPE0xn8kMgkE2T6a907Y= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694426777; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mRtNism9eieq55WiXAgXLdUcKsXmXh8icFK+EOB15YY=; b=gSCD4pVFFsewZ0DJipYDyzCGH5GufbswV7PrOI5ojLD+NdwiWir1Xl8ZH7JLchReRbGB+cZBMCJm5upvnlqN1uQsQMwDbNi77/V5QMTL2N+ZKFZZbpzd+mkM2zbjCWUEwH/0DAjfD3s7cO3ecG9CyXaMtvT7baSvunAsYGbjfbU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1694426777578918.1833123510398; Mon, 11 Sep 2023 03:06:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfdnV-00013u-JN; Mon, 11 Sep 2023 06:05:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfdnM-0000yo-SN for qemu-devel@nongnu.org; Mon, 11 Sep 2023 06:05:32 -0400 Received: from mail-bn8nam11on20600.outbound.protection.outlook.com ([2a01:111:f400:7eae::600] helo=NAM11-BN8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfdnF-0008Ck-Rk for qemu-devel@nongnu.org; Mon, 11 Sep 2023 06:05:28 -0400 Received: from CY5PR15CA0049.namprd15.prod.outlook.com (2603:10b6:930:1b::17) by DM4PR12MB6447.namprd12.prod.outlook.com (2603:10b6:8:bf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Mon, 11 Sep 2023 10:05:17 +0000 Received: from CY4PEPF0000E9D9.namprd05.prod.outlook.com (2603:10b6:930:1b:cafe::96) by CY5PR15CA0049.outlook.office365.com (2603:10b6:930:1b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.41 via Frontend Transport; Mon, 11 Sep 2023 10:05:17 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D9.mail.protection.outlook.com (10.167.241.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.17 via Frontend Transport; Mon, 11 Sep 2023 10:05:17 +0000 Received: from cjq-desktop.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 11 Sep 2023 05:05:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TXW0lS/4L7NDmIAuOQeIiK49c2spV9NPWO7A9puxvWKldp8O/XS5eBJAqdabL2dTVgNsopXFQJkgosKiTMkvjAM+wo23k5JK7S6fR36darckSpIFvXAwTQTgtTZCWGYlxhEckZuSlIiGi7OgBc2mv2/IVaMjAtqwrIvUbdlM61fVkes6p5qcwaZ+GGjciy7jVjCcrHH4E2YkN1po2Qc4e6rbpDFmRXG0759ENKohQ6wwO1YF0N8ZAf3CSyS4QyxJKfuODFJ4+QcWHrdOpJh+phgG20Wu0oV7jBnrvpIaIYWtYXpB9sRTJwTTYgoSHak4l1EqT+LqwB3WvCTdxPqR2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mRtNism9eieq55WiXAgXLdUcKsXmXh8icFK+EOB15YY=; b=TG4arZIclyHDMFCNYu3orSkn/wlnrC+vZ66k9y7emnnLvayKDD92fiA81r1ZFYbUWm+TMIi4UdjSfG4rKNum+O4aFmJ/KqJKEVYT0eTa52FxPZmsXb08VRENjzDpxMkLJwN57ltifGNnjFYPR8N3rhMAjT94AyofGv0h8Y3VeC8xW1Hzax4eXI5w9av5JczANI+kFgPvZJreYkFGbXILYUZ4VcWh+yPdPbg+PhFm6CodPf491UeZ05AKttvYuui79nIXWAv7oZ8C0K7nFQYc3wuQ9ygwi2XaxkHUoFDCFeFhjG5oWmsBPAuYu8ctZYO+FLt159VSR5E0eGELj5OpZg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mRtNism9eieq55WiXAgXLdUcKsXmXh8icFK+EOB15YY=; b=UDLQ3H9zdYktwPzPpKhtfrKmT8sN2HuIDTEV/A/VbmMBiWtXD57OCwyo6IBrFW9k+RX8CT7feXnAJcmG2lYugMHCDJ0Dg3bZKHJ3rb2cHxYgcQpx5ACFzecVzSwh74Ew582cnwbnvkLqlPXy0l3azAL0kMvlQKXHRLVhspf6e3w= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Jiqian Chen To: Gerd Hoffmann , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Robert Beckett , , CC: , , "Stefano Stabellini" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alex Deucher , "Christian Koenig" , Stewart Hildebrand , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Huang Rui , Jiqian Chen Subject: [RESEND VIRTIO GPU PATCH v3 1/1] virtio-gpu: Add new feature flag VIRTIO_GPU_F_FREEZE_S3 Date: Mon, 11 Sep 2023 18:04:30 +0800 Message-ID: <20230911100430.1408168-2-Jiqian.Chen@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230911100430.1408168-1-Jiqian.Chen@amd.com> References: <20230911100430.1408168-1-Jiqian.Chen@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D9:EE_|DM4PR12MB6447:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d3d4206-778a-432c-50a8-08dbb2ae9986 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a5dsaDV8AYpfBAvoP/plHZZTCQqGHUb1NlXcMvkOGuxw+kzLuaM2qzO5B5Qw6fjB17q44sTh8vPWjEPds89g6WS8I1IpCwTd8LjZ8OP6BmpA0Azc8EhVjBg1sJBcfTL54PPzfJTuk2/pDVsV/LZhmgELj14V9MdID+L/Q26NtvjA6rvPzvJcE0nfJ1JtvtlLONZ7UnmMDf8abwqijSRwjM4NsjnvbcPFqYBNJEpWkwtIO5dgGKsCg4xM/XCwQsb6U3cJ5ah4ZZSyIOoZaK4t+wi1Ivpo3hEEDRxxV9JKOeXKUxzRjQG8b4VaC6PnxAFnSP1gOcDzxUxpPXH2OLg2415K0vqqz2t1fIwqNTl/7fafpWeufEmbYvNcMAwjt9FTupquYGVeSFZkR6TdqXUbWEzzzIhi/z9kPNcyxnfAW1A8fDfJ4OI+JXV1PDPqS7hOWkcN0JdK84Z3i+A17zTk3phk6Fx6Uvt5eiY8P+ZwKQe2+KxJYegJPcGWkovXH2uhA8pRphI3xcX5xEJst2j13PhQ8ENXGtsVqhSXHfAIOWShaAPD78IoyDXPNzKA47BrJfre3P+ScE5h9dRuNX+mo463IgmRbedtJBZEng3wlgDk613KwBnp3XCsDTvdKe/lHQOv8gU6SX5zvkCJs3qYyZPKkRZgZz5HeGpWHj2tec0SkmBEeY0Tzck40zyX55IEAzD1/hEOVBfawqGH98tdNEzyFnYwZ0x10jYi5SJzWfdmUvBsfQ6axlBdb3hLOECqqz41sqYCZvbTktLP+WLdWg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(376002)(136003)(346002)(39860400002)(186009)(82310400011)(1800799009)(451199024)(46966006)(40470700004)(36840700001)(41300700001)(40480700001)(36756003)(4326008)(8676002)(8936002)(40460700003)(5660300002)(26005)(16526019)(1076003)(70586007)(70206006)(110136005)(54906003)(316002)(86362001)(356005)(82740400003)(81166007)(36860700001)(47076005)(2906002)(426003)(336012)(478600001)(2616005)(83380400001)(7696005)(6666004)(7416002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 10:05:17.1733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d3d4206-778a-432c-50a8-08dbb2ae9986 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6447 Received-SPF: softfail client-ip=2a01:111:f400:7eae::600; envelope-from=Jiqian.Chen@amd.com; helo=NAM11-BN8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1694426779838100004 Content-Type: text/plain; charset="utf-8" When we suspend/resume guest on Xen, the display can't come back. This is because when guest suspended, it called into Qemu. Then Qemu destroyed all resources which is used for display. So that guest's display can't come back to the time when it was suspended. To solve above problem, I added a new mechanism that when guest is suspending, it will notify Qemu, and then Qemu will not destroy resourcesi which are created by using commands VIRTIO_GPU_CMD_RESOURCE_CREATE_*. Due to that mechanism needs cooperation between guest and host, I need to add a new feature flag, so that guest and host can negotiate whenever freeze_S3 is supported or not. Signed-off-by: Jiqian Chen --- device-types/gpu/description.tex | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/device-types/gpu/description.tex b/device-types/gpu/descriptio= n.tex index 4435248..1a137e7 100644 --- a/device-types/gpu/description.tex +++ b/device-types/gpu/description.tex @@ -37,6 +37,8 @@ \subsection{Feature bits}\label{sec:Device Types / GPU De= vice / Feature bits} resources is supported. \item[VIRTIO_GPU_F_CONTEXT_INIT (4)] multiple context types and synchronization timelines supported. Requires VIRTIO_GPU_F_VIRGL. +\item[VIRTIO_GPU_F_FREEZE_S3 (5)] freezing virtio-gpu and keeping resources + alive is supported. \end{description} =20 \subsection{Device configuration layout}\label{sec:Device Types / GPU Devi= ce / Device configuration layout} @@ -228,6 +230,9 @@ \subsubsection{Device Operation: Request header}\label{= sec:Device Types / GPU De VIRTIO_GPU_CMD_UPDATE_CURSOR =3D 0x0300, VIRTIO_GPU_CMD_MOVE_CURSOR, =20 + /* freeze mode */ + VIRTIO_GPU_CMD_SET_FREEZE_MODE =3D 0x0400, + /* success responses */ VIRTIO_GPU_RESP_OK_NODATA =3D 0x1100, VIRTIO_GPU_RESP_OK_DISPLAY_INFO, @@ -838,6 +843,43 @@ \subsubsection{Device Operation: cursorq}\label{sec:De= vice Types / GPU Device / =20 \end{description} =20 +\subsubsection{Device Operation: freeze_mode}\label{sec:Device Types / GPU= Device / Device Operation / Device Operation: freeze_mode} + +\begin{lstlisting} +typedef enum { + VIRTIO_GPU_FREEZE_MODE_UNFREEZE =3D 0, + VIRTIO_GPU_FREEZE_MODE_FREEZE_S3 =3D 3, +} virtio_gpu_freeze_mode_t; + +struct virtio_gpu_set_freeze_mode { + struct virtio_gpu_ctrl_hdr hdr; + virtio_gpu_freeze_mode_t freeze_mode; +}; +\end{lstlisting} + +\begin{description} + +\item[VIRTIO_GPU_CMD_SET_FREEZE_MODE] +Notify freeze mode through controlq. +Request data is \field{struct virtio_gpu_set_freeze_mode}. +Response type is VIRTIO_GPU_RESP_OK_NODATA. + +This is added for S3 function in guest with virtio-gpu. When guest does +S3, let it notify QEMU that virtio-gpu is in what freeze mode in +\field{freeze_mode}. VIRTIO_GPU_FREEZE_MODE_FREEZE_S3 means guest is +doing S3 and virtio-gpu will be freezed, VIRTIO_GPU_FREEZE_MODE_UNFREEZE +means virtio-gpu can be used as usual. When virtio-gpu is freezed, QEMU +will not destroy resources which are created by using commands +VIRTIO_GPU_CMD_RESOURCE_CREATE_*, so that guest can use those resources +to resume display. + +Note: this change is not enough to solve the problems of S4 function. +QEMU may lose resources after hibernation. It needs more research and +development. If S4 is supported in the future, it may need another +feature flag here. + +\end{description} + \subsection{VGA Compatibility}\label{sec:Device Types / GPU Device / VGA C= ompatibility} =20 Applies to Virtio Over PCI only. The GPU device can come with and --=20 2.34.1