From nobody Sun May 12 17:20:21 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=1688108593; cv=pass; d=zohomail.com; s=zohoarc; b=T9KAZWpNfOKU3nGTJJNi0AFXj7oF+zY12NS0Br3Nm6IEx9O44DTuUBiQmL6Y4f9SVUFXXxi1K50C4S+MEdquPtHdu795v95oIMaFPmF/h+0GT5FJFnRP7GLV11xycoNskXK+gKGU2jtomK5YINNHuTvLwCKhzcajcIjsQ5G44m8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688108593; 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=+9xtnTPzNg+1sjBtnZIyS3R8k/6IZY1YdO4CzpygVqM=; b=lfimNd0Yy4iHq6ILUG3OTUdq9yuYyeQ/5Jb5FHCV1xbZnK7bP9SIQN/o6yAto6mlrbictlC1TjEYDs4Sciqxy3tL+gj0COXhaco8EZ8DUh2FlV/4Cij3RIowmr+MYDJLOPPWHYKvPpPwRcur+kKbjOoodLGnKeINzoWagohy298= 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 168810859326364.33340910714071; Fri, 30 Jun 2023 00:03:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qF89Z-0005iK-GF; Fri, 30 Jun 2023 03:02:49 -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 1qF89Y-0005hw-AV for qemu-devel@nongnu.org; Fri, 30 Jun 2023 03:02:48 -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 1qF89V-0004Ot-8A for qemu-devel@nongnu.org; Fri, 30 Jun 2023 03:02:48 -0400 Received: from DM6PR10CA0023.namprd10.prod.outlook.com (2603:10b6:5:60::36) by PH7PR12MB6634.namprd12.prod.outlook.com (2603:10b6:510:211::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Fri, 30 Jun 2023 07:02:39 +0000 Received: from DM6NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:5:60:cafe::91) by DM6PR10CA0023.outlook.office365.com (2603:10b6:5:60::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 07:02:39 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT009.mail.protection.outlook.com (10.13.173.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.47 via Frontend Transport; Fri, 30 Jun 2023 07:02:39 +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.23; Fri, 30 Jun 2023 02:02:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=frBpKD4EAQOlS0aXK8ifUhZUzbzRZrYIbPf0BzrEc1GsaHTh1uAUcDfX2TtxwiHi7p1oKGdCsuGWjr5Jvm9s08M//fDmRBm0UZxr8SAmwCs+rn0VDHawhlvXdJi5ft3ukEFZuJECCq92r0rnN8QGP3O7+2f4jKlbh8eplLRRTjJaLFdWw2CBc0nZe8NIABMpbH4irn+bUl2Mj3uQQKUEvV1aULG6kFUedlKWoXwfbBK7C0QDwOo9k0VTMF+Qx1PkP/sn2XqAKDOojBTyMSnPX49yIgCTRzUm2hoOqtPhhsjPi9v445dzHPd7hAkmXcwqeukJLexHaiNheqF7nmVAqw== 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=+9xtnTPzNg+1sjBtnZIyS3R8k/6IZY1YdO4CzpygVqM=; b=J/8KnlMYSS81W5e8u+kYQMNiGMVeGC6vg1vkejkDV+XNZGKoJ8uR0YIm2lQR1GABKodd3sniaP+RCPSyOSDK1VjB3Mh4RH1d/jkB2SXbkjJWcuAC6LKMCgr9ZWQ3QKhtI/xEA69ex8ixsU07PYsEfZp370d+QxLM5Y50bYULZGR817fcER7KTTbSg2KYYT1cg10rXNcU07iUPU2WjSbQ9Xb+jCMqRkAxFYf8ML8z/vl+J1LmLdnYmq8vxVoDWmudjgNK2Cw9MKpfXdsiVwOFVWuD7FKwqSyCe+6mao5V8nlCZzjx5GBSMCBqAKzefM/SNM17CtDU++CXwFz3s4xAEQ== 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=+9xtnTPzNg+1sjBtnZIyS3R8k/6IZY1YdO4CzpygVqM=; b=CSk1ojbQivDMlAAesCqq1wFa0uY9Xlr+Q7tKWSfKSpb4T3zEe8/t3F95FTHGheMdTr9OAAIrqz2LbvAJd3jHxXF77wOiNCKkKswhQWKGD6s8Ts89BCDpohMNZDyegU2nXMD284pVpUq1zCcHAmDpf7qnMm2C8gP4+LN0WePxD1M= 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?= , "Michael S . Tsirkin" , "Stefano Stabellini" , Anthony PERARD , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Jan Beulich , "Dr . David Alan Gilbert" , Robert Beckett , , CC: Alex Deucher , Christian Koenig , Stewart Hildebrand , Xenia Ragiadakou , Honglei Huang , Julia Zhang , Huang Rui , Jiqian Chen Subject: [QEMU PATCH v2 1/1] virtgpu: do not destroy resources when guest suspend Date: Fri, 30 Jun 2023 15:00:16 +0800 Message-ID: <20230630070016.841459-2-Jiqian.Chen@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230630070016.841459-1-Jiqian.Chen@amd.com> References: <20230630070016.841459-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: DM6NAM11FT009:EE_|PH7PR12MB6634:EE_ X-MS-Office365-Filtering-Correlation-Id: e5e14652-c0c0-40fc-f16b-08db7937fe30 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mV7GwA/X1h2GY/65cPnxkFpuJri9JTuUJeeL28SGnr6uYXRsm+mRsf3aHwfZTFlNHZYi0zN7wsYGJL3Lka2t9UFiJOQ2Bu91ezF1MxjVL+TCq8mO3sth646iJrz7JlYdHP7Aj9hQWNq55F8JyQyY/YNA34Von6PQKyBAqFugEBTbUB3gBfeDr3opRWqQkkpkMa75J0xzS23QiZuvzRQEUS8KRMNpEYiqqtV1gpGHccVc09yhNITJothrvV6Us0wZCjY9BHNz1+7OTQpkKZ6WjuhdD19yXzw5Ty38p2wAnR/G59/JgT8IWzlkbOCSmwS+Qi5BXRDNlv3+uBhPoCmzrYnvEXlKjgSQgQeZRbLRPzq0qPL0N7Esqvg5g83gOUnVMkPXLtnvXsFPYO2MoT7V4oRyY8ncW7X3GF1biG3+BdbwQvdbeG9p9v9e9/qTmfPfQRVhXUsh71Bw1HxjzwSaEWQXoKtjE137aBBRNKDDH29CtA6DVzVKpzAqp1T7V5C8oBzEJQzHN8Nb5teYSLQiy3T3rpCY5/SoRMj/5WO9BIMytmIYg2buWqi+iIq+W304rQ0NF1t4PYnjssRfbm/ljyRQi+MCPBjN8IjfpKI5Y1ZGwTVk6t9WVLGrwx103u03V1/lpJL9G2qVg4tSydaB7Jq5ddTTn1hGn7NcMzVOsbydCpMeJHCSgAnMP34RCyO/ntA9TYj2GyAIj1xdTKOd1o+r3vmKG9FCees8bSLzt2EegaNQ/zMg0GHOW51x9RhpHHSUDDR/MNhFbULNzn6L+Y5yQoSr7b+0fEcgOY0ubVQ= 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:(13230028)(4636009)(376002)(39860400002)(346002)(396003)(136003)(451199021)(36840700001)(40470700004)(46966006)(86362001)(82310400005)(36860700001)(40460700003)(36756003)(40480700001)(5660300002)(7416002)(356005)(41300700001)(921005)(8676002)(70206006)(316002)(81166007)(8936002)(70586007)(4326008)(82740400003)(47076005)(2906002)(478600001)(26005)(15650500001)(16526019)(2616005)(7696005)(186003)(1076003)(54906003)(83380400001)(110136005)(426003)(336012)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 07:02:39.7058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e5e14652-c0c0-40fc-f16b-08db7937fe30 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: DM6NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6634 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, 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, T_SCC_BODY_TEXT_LINE=-0.01 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: 1688108595752100003 Content-Type: text/plain; charset="utf-8" After suspending and resuming guest VM, you will get a black screen, and the display can't come back. This is because when guest did suspending, it called into qemu to call virtio_gpu_gl_reset. In function virtio_gpu_gl_reset, it destroyed resources and reset renderer, which were used for display. As a result, guest's screen can't come back to the time when it was suspended and only showed black. So, this patch adds a new ctrl message VIRTIO_GPU_CMD_STATUS_FREEZING to get notification from guest. If guest is during suspending, it sets freezing status of virtgpu to true, this will prevent destroying resources and resetting renderer when guest calls into virtio_gpu_gl_reset. If guest is during resuming, it sets freezing to false, and then virtio_gpu_gl_reset will keep its origin actions and has no other impaction. Due to this implemention needs cooperation with guest, so it added a new feature flag VIRTIO_GPU_F_FREEZING, so that guest and host can negotiate whenever freezing is supported or not. Signed-off-by: Jiqian Chen --- hw/display/virtio-gpu-base.c | 3 ++ hw/display/virtio-gpu-gl.c | 9 +++- hw/display/virtio-gpu-virgl.c | 7 +++ hw/display/virtio-gpu.c | 52 ++++++++++++++++++++- hw/virtio/virtio.c | 3 ++ include/hw/virtio/virtio-gpu.h | 6 +++ include/standard-headers/linux/virtio_gpu.h | 15 ++++++ 7 files changed, 92 insertions(+), 3 deletions(-) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index a29f191aa8..d55dc8fdfc 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -215,6 +215,9 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64= _t features, if (virtio_gpu_blob_enabled(g->conf)) { features |=3D (1 << VIRTIO_GPU_F_RESOURCE_BLOB); } + if (virtio_gpu_freezing_enabled(g->conf)) { + features |=3D (1 << VIRTIO_GPU_F_FREEZING); + } =20 return features; } diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index e06be60dfb..de108f1502 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -100,7 +100,14 @@ static void virtio_gpu_gl_reset(VirtIODevice *vdev) */ if (gl->renderer_inited && !gl->renderer_reset) { virtio_gpu_virgl_reset_scanout(g); - gl->renderer_reset =3D true; + /* + * If guest is suspending, we shouldn't reset renderer, + * otherwise, the display can't come back to the time when + * it was suspended after guest resumed. + */ + if (!virtio_gpu_freezing_enabled(g->parent_obj.conf) || !g->freezi= ng) { + gl->renderer_reset =3D true; + } } } =20 diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index 73cb92c8d5..547c4d98ad 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -464,6 +464,13 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, case VIRTIO_GPU_CMD_GET_EDID: virtio_gpu_get_edid(g, cmd); break; + case VIRTIO_GPU_CMD_STATUS_FREEZING: + if (virtio_gpu_freezing_enabled(g->parent_obj.conf)) { + virtio_gpu_cmd_status_freezing(g, cmd); + } else { + cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; + } + break; default: cmd->error =3D VIRTIO_GPU_RESP_ERR_UNSPEC; break; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 5e15c79b94..54a5e2e57c 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -373,6 +373,16 @@ static void virtio_gpu_resource_create_blob(VirtIOGPU = *g, QTAILQ_INSERT_HEAD(&g->reslist, res, next); } =20 +void virtio_gpu_cmd_status_freezing(VirtIOGPU *g, + struct virtio_gpu_ctrl_command *cmd) +{ + struct virtio_gpu_status_freezing sf; + + VIRTIO_GPU_FILL_CMD(sf); + virtio_gpu_bswap_32(&sf, sizeof(sf)); + g->freezing =3D sf.freezing; +} + static void virtio_gpu_disable_scanout(VirtIOGPU *g, int scanout_id) { struct virtio_gpu_scanout *scanout =3D &g->parent_obj.scanout[scanout_= id]; @@ -986,6 +996,13 @@ void virtio_gpu_simple_process_cmd(VirtIOGPU *g, case VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING: virtio_gpu_resource_detach_backing(g, cmd); break; + case VIRTIO_GPU_CMD_STATUS_FREEZING: + if (virtio_gpu_freezing_enabled(g->parent_obj.conf)) { + virtio_gpu_cmd_status_freezing(g, cmd); + } else { + cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; + } + break; default: cmd->error =3D VIRTIO_GPU_RESP_ERR_UNSPEC; break; @@ -1344,6 +1361,27 @@ void virtio_gpu_device_realize(DeviceState *qdev, Er= ror **errp) QTAILQ_INIT(&g->reslist); QTAILQ_INIT(&g->cmdq); QTAILQ_INIT(&g->fenceq); + + g->freezing =3D false; +} + +static void virtio_gpu_device_unrealize(DeviceState *qdev) +{ + VirtIOGPU *g =3D VIRTIO_GPU(qdev); + struct virtio_gpu_simple_resource *res, *tmp; + + /* + * This is to prevent memory leak in the situation that qemu is + * destroyed when guest is suspended. This also need hot-plug + * support. + */ + if (virtio_gpu_freezing_enabled(g->parent_obj.conf) && g->freezing) { + QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) { + virtio_gpu_resource_destroy(g, res); + } + virtio_gpu_virgl_reset(g); + } + } =20 void virtio_gpu_reset(VirtIODevice *vdev) @@ -1352,8 +1390,15 @@ void virtio_gpu_reset(VirtIODevice *vdev) struct virtio_gpu_simple_resource *res, *tmp; struct virtio_gpu_ctrl_command *cmd; =20 - QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) { - virtio_gpu_resource_destroy(g, res); + /* + * If guest is suspending, we shouldn't destroy resources, + * otherwise, the display can't come back to the time when + * it was suspended after guest resumed. + */ + if (!virtio_gpu_freezing_enabled(g->parent_obj.conf) || !g->freezing) { + QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) { + virtio_gpu_resource_destroy(g, res); + } } =20 while (!QTAILQ_EMPTY(&g->cmdq)) { @@ -1425,6 +1470,8 @@ static Property virtio_gpu_properties[] =3D { 256 * MiB), DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags, VIRTIO_GPU_FLAG_BLOB_ENABLED, false), + DEFINE_PROP_BIT("freezing", VirtIOGPU, parent_obj.conf.flags, + VIRTIO_GPU_FLAG_FREEZING_ENABLED, false), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -1441,6 +1488,7 @@ static void virtio_gpu_class_init(ObjectClass *klass,= void *data) vgbc->gl_flushed =3D virtio_gpu_handle_gl_flushed; =20 vdc->realize =3D virtio_gpu_device_realize; + vdc->unrealize =3D virtio_gpu_device_unrealize; vdc->reset =3D virtio_gpu_reset; vdc->get_config =3D virtio_gpu_get_config; vdc->set_config =3D virtio_gpu_set_config; diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index eb6347ab5d..e2ccf50a9e 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -240,6 +240,9 @@ qmp_virtio_feature_map_t virtio_gpu_feature_map[] =3D { FEATURE_ENTRY(VIRTIO_GPU_F_CONTEXT_INIT, \ "VIRTIO_GPU_F_CONTEXT_INIT: Context types and synchronization " "timelines supported"), + FEATURE_ENTRY(VIRTIO_GPU_F_FREEZING, \ + "VIRTIO_GPU_F_FREEZING: Freezing virtio-gpu and keeping resour= ces" + "alive is supported."), FEATURE_ENTRY(VHOST_F_LOG_ALL, \ "VHOST_F_LOG_ALL: Logging write descriptors supported"), FEATURE_ENTRY(VHOST_USER_F_PROTOCOL_FEATURES, \ diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 2e28507efe..53e06e47cb 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -90,6 +90,7 @@ enum virtio_gpu_base_conf_flags { VIRTIO_GPU_FLAG_EDID_ENABLED, VIRTIO_GPU_FLAG_DMABUF_ENABLED, VIRTIO_GPU_FLAG_BLOB_ENABLED, + VIRTIO_GPU_FLAG_FREEZING_ENABLED, }; =20 #define virtio_gpu_virgl_enabled(_cfg) \ @@ -102,6 +103,8 @@ enum virtio_gpu_base_conf_flags { (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DMABUF_ENABLED)) #define virtio_gpu_blob_enabled(_cfg) \ (_cfg.flags & (1 << VIRTIO_GPU_FLAG_BLOB_ENABLED)) +#define virtio_gpu_freezing_enabled(_cfg) \ + (_cfg.flags & (1 << VIRTIO_GPU_FLAG_FREEZING_ENABLED)) =20 struct virtio_gpu_base_conf { uint32_t max_outputs; @@ -173,6 +176,7 @@ struct VirtIOGPU { =20 uint64_t hostmem; =20 + bool freezing; bool processing_cmdq; QEMUTimer *fence_poll; QEMUTimer *print_stats; @@ -284,5 +288,7 @@ void virtio_gpu_virgl_reset_scanout(VirtIOGPU *g); void virtio_gpu_virgl_reset(VirtIOGPU *g); int virtio_gpu_virgl_init(VirtIOGPU *g); int virtio_gpu_virgl_get_num_capsets(VirtIOGPU *g); +void virtio_gpu_cmd_status_freezing(VirtIOGPU *g, + struct virtio_gpu_ctrl_command *cmd); =20 #endif diff --git a/include/standard-headers/linux/virtio_gpu.h b/include/standard= -headers/linux/virtio_gpu.h index 2da48d3d4c..cc9286b30e 100644 --- a/include/standard-headers/linux/virtio_gpu.h +++ b/include/standard-headers/linux/virtio_gpu.h @@ -65,6 +65,11 @@ */ #define VIRTIO_GPU_F_CONTEXT_INIT 4 =20 +/* + * VIRTIO_GPU_CMD_STATUS_FREEZING + */ +#define VIRTIO_GPU_F_FREEZING 5 + enum virtio_gpu_ctrl_type { VIRTIO_GPU_UNDEFINED =3D 0, =20 @@ -100,6 +105,9 @@ enum virtio_gpu_ctrl_type { VIRTIO_GPU_CMD_UPDATE_CURSOR =3D 0x0300, VIRTIO_GPU_CMD_MOVE_CURSOR, =20 + /* status */ + VIRTIO_GPU_CMD_STATUS_FREEZING =3D 0x0400, + /* success responses */ VIRTIO_GPU_RESP_OK_NODATA =3D 0x1100, VIRTIO_GPU_RESP_OK_DISPLAY_INFO, @@ -116,6 +124,7 @@ enum virtio_gpu_ctrl_type { VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID, VIRTIO_GPU_RESP_ERR_INVALID_CONTEXT_ID, VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER, + }; =20 enum virtio_gpu_shm_id { @@ -453,4 +462,10 @@ struct virtio_gpu_resource_unmap_blob { uint32_t padding; }; =20 +/* VIRTIO_GPU_CMD_STATUS_FREEZING */ +struct virtio_gpu_status_freezing { + struct virtio_gpu_ctrl_hdr hdr; + __u32 freezing; +}; + #endif --=20 2.34.1