From patchwork Tue Oct 29 12:10:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 839332 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:4593:b0:37d:45d0:187 with SMTP id gb19csp329285wrb; Tue, 29 Oct 2024 05:12:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX5AnJDUtF174DwyeJVd3jVBk+jDkr2v8dyY/dpAFI2aP79/t9EdclnlsrNRgzvgQAmw1hXTg==@linaro.org X-Google-Smtp-Source: AGHT+IFFRsyN3RswcyatjlQUinDYPbpKHk1qZnjGdWB6Zf6SK6KIPq6puvZuLVf1pPwL/au29/tC X-Received: by 2002:a05:6102:c86:b0:4a4:8928:7181 with SMTP id ada2fe7eead31-4a8cfd69b87mr8754061137.29.1730203961986; Tue, 29 Oct 2024 05:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730203961; cv=none; d=google.com; s=arc-20240605; b=RiarTUOz6l2Ja5v7kE3vMLiZQvlVtR4sAp+8HFuDF4XMlYdMgVdelniY6P2pxi+3Tj 41jQGebxKPWo0RSVhHXoqEW5wp22AWikGleU3cuyuZL6SKeQlyfAJEaTqpqaZtE5uXuA XFGWocuagniAI35Chuxbc4n0dG77R1K4OZNujGltea65ovrgZ4JLmat9vo/KO+Wuo0xA yVKg5HAn0p8KBqliLVxOe5jfMI114yOAdirJcDZqq25ymYtD1kzOOLbWLIzL3Xa4rJn1 N7Znqg42Iu1ihQSWtSk8badzWOm/OUzItaoZcuyck5lBOi+/GigXaQEC8/VwtrF9bFFF Lw/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lAiNUZHWMY8UPn2mHH/EVqrwGLL5X/il2luCyizrIjs=; fh=w99Yap7FLIJRLhFiWnRHkpNnh3wm8CJGv7ueKT6PKxg=; b=COiA/xtgXiBfN0zRsi0mcul2mtnvC7KGVmnDHShoZQFseN8d5MM+C/g6SINmD5Myv2 YAUnyKd5Xslmdww0M1hHFvyvbC45D5hprxZUESoAKcnmkOpoip/rrHzXwEvq77W/j4ht TgBC9KBB96R5FzgEjDfY3qoJgm2jnUVS75I6r4v191tEvRK6gw7/rlwUdd/hGF7Wh5Hj ccjm8EMidFqjEvS3MvYq8VDHJTUzIfHxjMG96H7QWdTAWSQEQljufH0ACHb3fiERZiex aywWbNm4maRQYJ+di80o8zhVCghDJLAxYGQg6UJWmE9lttnXMyD9fTsjmlNzUqnlby2x MF1Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FK6JgtKQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4a8c539ad2bsi2280786137.707.2024.10.29.05.12.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Oct 2024 05:12:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FK6JgtKQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5l3l-0004dy-8M; Tue, 29 Oct 2024 08:10:53 -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 1t5l3a-0004bN-6n for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:10:45 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5l3Y-0007TL-Go for qemu-devel@nongnu.org; Tue, 29 Oct 2024 08:10:41 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4314c452180so43846415e9.0 for ; Tue, 29 Oct 2024 05:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730203839; x=1730808639; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lAiNUZHWMY8UPn2mHH/EVqrwGLL5X/il2luCyizrIjs=; b=FK6JgtKQsYObCyuXCrI080FboH2GbVw/cI6lr8P+SaJdB8kJNs/iBbOuPd2ZCgiYEP E0IWFfJTbnsQdvuqyvQN54ztitsNk7svIpwYcFa6muaRrZo+oUdaq1t+8GhPGhnP0onv 4lmSFCedeweDAvKdCHgDpcyegwCglKwfZoI25rcfunqIXaC8kF/kg82dkuWomimtiFBH J9YQjcZkCqlgzdyQYSJe1V4gph7L2Wmg6JM/fxgz+/HoN0DxNjtMMEpshZ18GbwNvVI2 LMeS6v/JGr0A/j+5dh6sQLW7hH8vHEciGQKVruc/70rBMwkyyoxYo23HvCtWiPzv3bdU 88zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730203839; x=1730808639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lAiNUZHWMY8UPn2mHH/EVqrwGLL5X/il2luCyizrIjs=; b=OFY0ph0Sj7q2HHyhlNc+fGPfqLPZEdQCDoeTpMoGnywAzA1qbU7bKJXXF1zkh5Bs67 swxsDC8/IzK/PArO6NhogLROAQrYrYaMjj+gVH7ja9XYru8X//Luj++fbk+RYHaENPjH yoX/DM6dnX+MPyPNOEyzXbKysQDLikmA4pw3FkDPdZ+QgwIaF2KqwtlB1+Iq2wxDwNHj /kptpgPKcMtd29aBq8pViGqrHxZx0ZQClSBkqPXZnXDZdNTVB7N1voOnV+bYmHFyL3tt BiBleMdpyYPTrPKNo/P37rCeQL66a60VNWffmcF65C4n0DFQDIJdaO5+VuQF8I+rGzu/ h76g== X-Gm-Message-State: AOJu0YzrgwK+aCjkiZ379UruQTO0GC3dgvG3JlH08ODSOGtqdazJgIte bEtGAlcwZ+QyYPAaoZe4EbN/a22//uINb3Hi5SCwvNe+ePbT21Pn/D5Bvtl0uIo= X-Received: by 2002:adf:fc83:0:b0:374:adf1:9232 with SMTP id ffacd0b85a97d-3817d636aecmr1454300f8f.19.1730203838951; Tue, 29 Oct 2024 05:10:38 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38058b3bde6sm12349602f8f.40.2024.10.29.05.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 05:10:34 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 6B09C5FB4D; Tue, 29 Oct 2024 12:10:31 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Dmitry Osipenko , Akihiko Odaki , =?utf-8?q?Alex_Benn=C3=A9e?= , "Michael S. Tsirkin" Subject: [PULL 10/13] virtio-gpu: Support suspension of commands processing Date: Tue, 29 Oct 2024 12:10:27 +0000 Message-Id: <20241029121030.4007014-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241029121030.4007014-1-alex.bennee@linaro.org> References: <20241029121030.4007014-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.google.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, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Dmitry Osipenko Check whether command processing has been finished; otherwise, stop processing commands and retry the command again next time. This allows us to support asynchronous execution of non-fenced commands needed for unmapping host blobs safely. Suggested-by: Akihiko Odaki Signed-off-by: Dmitry Osipenko Message-Id: <20241024210311.118220-11-dmitry.osipenko@collabora.com> Signed-off-by: Alex Bennée diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 3d9679c1ef..180d882f0a 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1034,6 +1034,12 @@ void virtio_gpu_process_cmdq(VirtIOGPU *g) /* process command */ vgc->process_cmd(g, cmd); + /* command suspended */ + if (!cmd->finished && !(cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_FENCE)) { + trace_virtio_gpu_cmd_suspended(cmd->cmd_hdr.type); + break; + } + QTAILQ_REMOVE(&g->cmdq, cmd, next); if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { g->stats.requests++; diff --git a/hw/display/trace-events b/hw/display/trace-events index e212710284..d26d663f96 100644 --- a/hw/display/trace-events +++ b/hw/display/trace-events @@ -55,6 +55,7 @@ virtio_gpu_fence_ctrl(uint64_t fence, uint32_t type) "fence 0x%" PRIx64 ", type virtio_gpu_fence_resp(uint64_t fence) "fence 0x%" PRIx64 virtio_gpu_inc_inflight_fences(uint32_t inflight) "in-flight+ %u" virtio_gpu_dec_inflight_fences(uint32_t inflight) "in-flight- %u" +virtio_gpu_cmd_suspended(uint32_t cmd) "cmd 0x%x" # qxl.c disable qxl_io_write_vga(int qid, const char *mode, uint32_t addr, uint32_t val) "%d %s addr=%u val=%u"