From patchwork Sat May 4 20:28:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 13654127 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) (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 06DE6C4345F for ; Sat, 4 May 2024 20:31:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3M14-0007SU-Be; Sat, 04 May 2024 16:29:54 -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 1s3M0z-0007Q6-5n for qemu-devel@nongnu.org; Sat, 04 May 2024 16:29:49 -0400 Received: from madrid.collaboradmins.com ([46.235.227.194]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3M0x-0005Wz-Ix for qemu-devel@nongnu.org; Sat, 04 May 2024 16:29:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1714854585; bh=1ptEik5fipIhqT02OLKiYqBPj191E1/Idbn7Da3INkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fQxPfR5li7oAg4riNHJwk6Agc/Y2O4YRII3W4HoDj0jjAOmQVWz8c3uT/vt/eVJhx 0N1SUl2vsXTEgg6OhfiNAKklHWG+NCQ2LMwzVLQToYzn+GwuvqAKG62Zf827BM680k 8NM2lj91MoU9GaL381yeARom7OXGVVbMzWaVMLKZEq3ldyITC9TFEQ2a9Hz+h7ktpb 7YZd5ICVRk3HhelbCVhLN9LrBzZyYiLCGeLzg8jjlN1afZERHBz4lGFPTnefeVCdZo lIUsw5uDB2OWRFk5JMbsfc0SGsgO+lubFCeoAUI9tGyKsXFX8racffHWAVkYbS01bh E1HWuGp4qaxPA== Received: from workpc.. (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dmitry.osipenko) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 615CA378215C; Sat, 4 May 2024 20:29:43 +0000 (UTC) From: Dmitry Osipenko To: Akihiko Odaki , Huang Rui , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , "Michael S . Tsirkin" , Stefano Stabellini , Anthony PERARD , Antonio Caggiano , "Dr . David Alan Gilbert" , Robert Beckett , Gert Wollny , =?utf-8?q?Alex_Benn=C3=A9e?= Cc: qemu-devel@nongnu.org, Gurchetan Singh , ernunes@redhat.com, Alyssa Ross , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= , Alex Deucher , Stefano Stabellini , =?utf-8?q?Christian_K?= =?utf-8?q?=C3=B6nig?= , Xenia Ragiadakou , Pierre-Eric Pelloux-Prayer , Honglei Huang , Julia Zhang , Chen Jiqian , Yiwei Zhang Subject: [PATCH v10 07/10] virtio-gpu: Support suspension of commands processing Date: Sat, 4 May 2024 23:28:31 +0300 Message-ID: <20240504202834.399780-8-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240504202834.399780-1-dmitry.osipenko@collabora.com> References: <20240504202834.399780-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Received-SPF: pass client-ip=46.235.227.194; envelope-from=dmitry.osipenko@collabora.com; helo=madrid.collaboradmins.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_NONE=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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add new "suspended" flag to virtio_gpu_ctrl_command telling cmd processor that it should stop processing commands and retry again next time until flag is unset. Signed-off-by: Dmitry Osipenko --- hw/display/virtio-gpu-gl.c | 1 + hw/display/virtio-gpu-rutabaga.c | 1 + hw/display/virtio-gpu-virgl.c | 3 +++ hw/display/virtio-gpu.c | 5 +++++ include/hw/virtio/virtio-gpu.h | 1 + 5 files changed, 11 insertions(+) diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c index 95806999189e..2a9e549ad2e9 100644 --- a/hw/display/virtio-gpu-gl.c +++ b/hw/display/virtio-gpu-gl.c @@ -79,6 +79,7 @@ static void virtio_gpu_gl_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) cmd->vq = vq; cmd->error = 0; cmd->finished = false; + cmd->suspended = false; QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next); cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command)); } diff --git a/hw/display/virtio-gpu-rutabaga.c b/hw/display/virtio-gpu-rutabaga.c index 17bf701a2163..b6e84d436fb2 100644 --- a/hw/display/virtio-gpu-rutabaga.c +++ b/hw/display/virtio-gpu-rutabaga.c @@ -1061,6 +1061,7 @@ static void virtio_gpu_rutabaga_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) cmd->vq = vq; cmd->error = 0; cmd->finished = false; + cmd->suspended = false; QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next); cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command)); } diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index 2fedccb1fc8d..dc2b5a496630 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -687,6 +687,9 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, break; } + if (cmd->suspended) { + return; + } if (cmd->finished) { return; } diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 1e57a53d346c..a1bd4d6914c4 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1054,6 +1054,10 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g) /* process command */ vgc->process_cmd(g, cmd); + if (cmd->suspended) { + break; + } + QTAILQ_REMOVE(&g->cmdq, cmd, next); if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { g->stats.requests++; @@ -1113,6 +1117,7 @@ static void virtio_gpu_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) cmd->vq = vq; cmd->error = 0; cmd->finished = false; + cmd->suspended = false; QTAILQ_INSERT_TAIL(&g->cmdq, cmd, next); cmd = virtqueue_pop(vq, sizeof(struct virtio_gpu_ctrl_command)); } diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index ba36497c477f..0c00c303f41b 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -132,6 +132,7 @@ struct virtio_gpu_ctrl_command { struct virtio_gpu_ctrl_hdr cmd_hdr; uint32_t error; bool finished; + bool suspended; QTAILQ_ENTRY(virtio_gpu_ctrl_command) next; };