From patchwork Tue Jul 16 18:09:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812775 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435191wrr; Tue, 16 Jul 2024 11:10:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUiw4wFsIFbYc8PKn+qgrvjkFiQgZ59Kx0KmEBTMbrmvK6vCmPksdmfwrUsSgqgwyaJOGXN8BisHTYhQ+krsp2S X-Google-Smtp-Source: AGHT+IG4sbzlwbgCHZ9RZMVeT65a6WF/Z1FIoA9XiQShHc8No9NZt/gTfJ8Rh6oBEJ+t8mR0Z5tA X-Received: by 2002:a05:6808:2124:b0:3d8:a93a:33bd with SMTP id 5614622812f47-3dac7bf4f77mr3829154b6e.34.1721153428225; Tue, 16 Jul 2024 11:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153428; cv=none; d=google.com; s=arc-20160816; b=txac8D5XKkM8aLRh7b0uTjrgEQdMGFiUJdnT4rQRJNwVmyqpjGQqMBtVaPgKKUwqe9 XHmU2zFCgRdpkxkV+OV5+/9jk61v8T2hMsS74RE/eVlBqLIMY5LxIBYh8an/T2d3SBfH bzEd8PO6ZjBZcGYs+q+DTZ5d00cOCFPA/lPZh2UGetF7S5ADMosYC4dX3cxHFqGhqCzt /kIHjxAttntlc2wsnH49f0ym7Kq+p2Qmo3FhZlUIDCnDWQ4psHCpBL+3LcSuKpDRsb4Y DABbtKo3VlIyRlF0/t4ncQVZfyStN0mSU6USM+xW0AVBQpC83uRDIA7ig4PF+7Qhau2K SrvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=+SuZjNq7VfYR+yUP5NB/Weekc2q9mEwEfGGbbLYskCs=; fh=1ieggTHFECSIMInboqlh7X75OhpJtso/ZV12TJvwK60=; b=Z3JfK//0H2ABCVsJl53KjafvbzRtjY85IeMz5opw+TELUhpPVAw9AA9tX9LPNQZqq/ dLh2nzFIfvpoRkrXMOv7507qqL4bSyfaeYUDNDM7XzLoK1hAHIJ9IcC0JQw8Wd7ZbuDo axQmLTXIKcIXAD7Ql8E/nVX2BW8AQLSYMoXMZ3wh+vErJ+aaNyAeF5zK2TmZR3aSWTap elP+YTV32ngAHUpqTDVjAcHvHI5pPJsKGvfmbladNW+fcczv5A2GvaZpWT6bhaVWTvQy G/p2MaPrkdU/47Cu1sn0fKPT2c692K4tXaevStDCN37fslkRFsTF6GyF/jxuaCrxVxIq ASMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W68+pyle; 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 af79cd13be357-7a160c84654si748143685a.687.2024.07.16.11.10.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:10:28 -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=W68+pyle; 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 1sTmcd-00066s-V7; Tue, 16 Jul 2024 14:09:56 -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 1sTmcb-0005xF-FR for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:09:53 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmcZ-0000tk-Ga for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:09:53 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-367990aaef3so3475527f8f.0 for ; Tue, 16 Jul 2024 11:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153389; x=1721758189; 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=+SuZjNq7VfYR+yUP5NB/Weekc2q9mEwEfGGbbLYskCs=; b=W68+pylefKOECTzT1CgRHZKODUyNXt3jPtJpGUG6pySLu+m+K5C+Bsuge3vNS2o5hK 2iJ07klONyCnmYKnCf0wgGiee99h4j6pqwxkY9PUM2Vq1yqoAoORhZ8mX+ifu0WYGAfo Wc+73quMWAOTyjqyD0cwOuZmTiNpXxq0KQwdL1CDBgIKrc2oJoaId+uUMweVBvEpgdNe LR2wdiDOBr9N7jX/UN/IRY762swzHGypvei6SPsCFRJ8yxaA/qVvYh+RHcJYiH+O69SP W9oTGzHP/KOLU4kIQFAYYyHIHeK9o6yLYP2JGBD8NvwemXJ8gfsnNTG6wcnHTkt8E8W6 LsGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153389; x=1721758189; 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=+SuZjNq7VfYR+yUP5NB/Weekc2q9mEwEfGGbbLYskCs=; b=NiUfW/HqyOr4KN94j3QStXcc02w41oEebqQGby5l/E+AlUH4yHVkxSmjPySVs2OuV/ mF8f2/dqyvWvSpt6Nu8CcqC4BxJDDIz6kt6NBYHr5e6UIEpydGej1l57HhMJ1zBun1lx MhkWcmv3NrE+fyzejLyWfXnVGORT4r7S8w50/aJCyNniuvQvIbsAT6LsS3aNah0bcXl1 yu0dIftrZwtcKKVaGqHh2VW3ZN7Q40AjIEzNsK+4uu5OlLjxh0EJ1Q+tXluCYPdQ4P+g Dsd4qZS7aQPC75vhTK5KhgVuj3lTOFlfEewGaBUjSFRdZ/ySWqhl2LzXrIS+FDK+uxZE nVeA== X-Gm-Message-State: AOJu0YzB3Qnq6TwCCNjsteu/ftYAu6FpLXJYTYEoxEfpuHs/JwXGML0k KlRxRzOeEg/jZsSBLUeBsV3fGgjGcBsoxqiPUUB1dsYvulV5flqQhnd1RVJsXXfLV2y6DulW7hd M1t5RmA== X-Received: by 2002:adf:dd83:0:b0:364:3ba5:b629 with SMTP id ffacd0b85a97d-3682610f680mr1966923f8f.20.1721153389591; Tue, 16 Jul 2024 11:09:49 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427ba20aaf8sm29584465e9.0.2024.07.16.11.09.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:09:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gregor Haas , Xingtao Yao , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= Subject: [PULL 01/13] hw/core/loader: allow loading larger ROMs Date: Tue, 16 Jul 2024 20:09:28 +0200 Message-ID: <20240716180941.40211-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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: Gregor Haas The read() syscall is not guaranteed to return all data from a file. The default ROM loader implementation currently does not take this into account, instead failing if all bytes are not read at once. This change loads the ROM using g_file_get_contents() instead, which correctly reads all data using multiple calls to read() while also returning the loaded ROM size. Signed-off-by: Gregor Haas Reviewed-by: Xingtao Yao Reviewed-by: Daniel P. Berrangé Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240628182706.99525-1-gregorhaas1997@gmail.com> [PMD: Use gsize with g_file_get_contents()] Signed-off-by: Philippe Mathieu-Daudé --- hw/core/loader.c | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index a3bea1e718..39bd8f9e4d 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -1076,8 +1076,8 @@ ssize_t rom_add_file(const char *file, const char *fw_dir, { MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); Rom *rom; - ssize_t rc; - int fd = -1; + gsize size; + g_autoptr(GError) gerr = NULL; char devpath[100]; if (as && mr) { @@ -1095,10 +1095,10 @@ ssize_t rom_add_file(const char *file, const char *fw_dir, rom->path = g_strdup(file); } - fd = open(rom->path, O_RDONLY | O_BINARY); - if (fd == -1) { - fprintf(stderr, "Could not open option rom '%s': %s\n", - rom->path, strerror(errno)); + if (!g_file_get_contents(rom->path, (gchar **) &rom->data, + &size, &gerr)) { + fprintf(stderr, "rom: file %-20s: error %s\n", + rom->name, gerr->message); goto err; } @@ -1107,23 +1107,8 @@ ssize_t rom_add_file(const char *file, const char *fw_dir, rom->fw_file = g_strdup(file); } rom->addr = addr; - rom->romsize = lseek(fd, 0, SEEK_END); - if (rom->romsize == -1) { - fprintf(stderr, "rom: file %-20s: get size error: %s\n", - rom->name, strerror(errno)); - goto err; - } - + rom->romsize = size; rom->datasize = rom->romsize; - rom->data = g_malloc0(rom->datasize); - lseek(fd, 0, SEEK_SET); - rc = read(fd, rom->data, rom->datasize); - if (rc != rom->datasize) { - fprintf(stderr, "rom: file %-20s: read error: rc=%zd (expected %zd)\n", - rom->name, rc, rom->datasize); - goto err; - } - close(fd); rom_insert(rom); if (rom->fw_file && fw_cfg) { const char *basename; @@ -1160,9 +1145,6 @@ ssize_t rom_add_file(const char *file, const char *fw_dir, return 0; err: - if (fd != -1) - close(fd); - rom_free(rom); return -1; } From patchwork Tue Jul 16 18:09:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812776 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435276wrr; Tue, 16 Jul 2024 11:10:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWxMAEJK3oVP9jBhNNfzAxoflFCdzfMcDmRiy7ZwCihbkemgD6oANmRTzlorxrAiVS7RSIsj6Qs3aYCABFQBTee X-Google-Smtp-Source: AGHT+IFkG2WJi5yRGZn/YiuYwaVMrv/rA86WAYGhl1eDYSGzjHQjkuRUgSkd/Y4XDCJg9ueq+q3s X-Received: by 2002:a05:6214:e47:b0:6b0:62bb:ab9a with SMTP id 6a1803df08f44-6b77f4dbf86mr40590856d6.19.1721153439206; Tue, 16 Jul 2024 11:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153439; cv=none; d=google.com; s=arc-20160816; b=ybVFX8CrZZQyet9MpswpwtGqWK9k8P4WF+QRKw4UxVIV6gWNwCtOMHvqfssD4v16uR r8p3g1kGTdtZYczIUzULfI4giuk/XX1NYr3mIYaWDjb2VyvkSQsQ5rNqCKC0/2fgJHVb rN6z7t+hx19SWZ7B27VeOPv069dnamfs/LEmvRGtNSBI3hLjEcxyrgX4rBORRyggF4BV NP/RQQErAfZVD0LxYHYUcFChwNsD3M4Nzrs0dXHRcGTKW+50rDotYJrEHqYujAsWUyug 2TsU5X86y6tdSIjmfaT0mmLEpTV49qbuCrzXEivqlzjeHVuzwKIXqyUJcC8sGGBkTTeg bF9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=sasciBya2HV1iigybBBfHdwHjguksb3KeHQbVPO+dbY=; fh=Tr7NIUtXAhmtWFkJJjP6G2+mN+Bis7DT7Z3/vsFybJ4=; b=aCMMUNlmShlWX5EWLrvyis6GDQOC2A/dCyodJ1Rcl7+B06xkN9gF7OjkE9yGi/g3Eh nDkZVHTvwrn+XQ90Afbe9rS4qd4CAAcK8rOGMQynA7tCJAi8m4uw5LmwT95wCKpGQ4EJ vVYVGne+MGYi3JHPC7mwoGVc1EnDjbeDCktM/e62CKmxae+v5NqAg3B8xIB6WD0kXa1h MffNn8zbDyOOb4THSi8Ubw5IOfk8q2AY1j9M5IvykO10bwBpSP62PewPsE2aoiKfLgcF Nc0jx7AspRoYZL3lz8r/YFzXNLMxgeje9C4iv+PN3hH8UNT9TRtm3uFpvfn5DvYFoW76 yjPA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=foVM5Fb6; 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 6a1803df08f44-6b761a5d1d6si80275416d6.501.2024.07.16.11.10.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:10:39 -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=foVM5Fb6; 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 1sTmcj-0006UP-ME; Tue, 16 Jul 2024 14:10:01 -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 1sTmch-0006Jm-5u for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:09:59 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmcf-0000uA-0l for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:09:58 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-427aeebaecdso16860645e9.1 for ; Tue, 16 Jul 2024 11:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153395; x=1721758195; 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=sasciBya2HV1iigybBBfHdwHjguksb3KeHQbVPO+dbY=; b=foVM5Fb6P/vCLvrpC461DSE9E+gXEVZirL+ZC8I528nRwtIa0El1fslKMt6qnLlSD0 3/Zys9tUIokhxJj77PB+QtF7MkScROmhy9W5/1nTu04UGB2dJgmpJPVOinvN6mgptBRE Z+I2YcGFekHAnD/eAD09hFEwkdUQIQP6G7/ZNJUnBWBAHfZT4xUSqOeeEwgRpUEHG5CU 9u14TMgsyEE64ZRNazVU4KGJ7lZg2wedlgUKPp6A4DcYOoG14bMXR5Pfe14fZG8qsGT0 hrEm3vfRlWtA/swC7g/3lGxbfGH3unFy5xr/SgwdYzRReZNIMEtlM/G+0HFaXfXAWc2S 5OSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153395; x=1721758195; 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=sasciBya2HV1iigybBBfHdwHjguksb3KeHQbVPO+dbY=; b=sIZA8yT/IpjLwnKvGZt/qczdhMDamqKgk4N5Jws9ee38XKiZJmcOLBSoQHPl83+q4H P5AdfeaR35HrcoYKuiNadtB6eovwo5r0/X0d88CKRZfpdgfjS9mlsOc82uFDx0NEZoJ8 e1+mKiwlwLWUwZfoTFPSc4sURH8qRohqomxQHjHrfhk3xN54v8nxkxeH69Qv1Iqz6tCh Ar/wBTZmYn3iVimPgr2oMC5lxJmNAJOghA3DTnao/GC2VlaPv3jB2PklnuF747Qc6Gqt CG8sWRS/mgI3sk2X0jmIDCCHVObBP32W3aPAFacOAHfPdvo8CYwYvSySG1ksCI90DXBT Gf2Q== X-Gm-Message-State: AOJu0YzvxAn6+sHhZ1W4lqdiaFcR7ZLl8NMmNZy0tR4cX4m5KdKBu3aW UV3hy71nCYHWjp6R5VngflvBXylZkJgjOTfFKIhKbOwr9PDUSx4nzpEgf7G24dY7v8uVFpiQaiR sMDhJfg== X-Received: by 2002:a05:6000:2c6:b0:367:9903:a81 with SMTP id ffacd0b85a97d-368261df9fcmr2732143f8f.43.1721153395073; Tue, 16 Jul 2024 11:09:55 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dafbea9sm9777803f8f.82.2024.07.16.11.09.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:09:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bernhard Beschow , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 02/13] hw/isa/vt82c686: Turn "intr" irq into a named gpio Date: Tue, 16 Jul 2024 20:09:29 +0200 Message-ID: <20240716180941.40211-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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: Bernhard Beschow Makes the code more comprehensible, matches the datasheet and the piix4 device model. Signed-off-by: Bernhard Beschow Reviewed-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240704205854.18537-2-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/isa/vt82c686.c | 2 +- hw/mips/fuloong2e.c | 2 +- hw/ppc/amigaone.c | 5 +++-- hw/ppc/pegasos2.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 8582ac0322..505b44c4e6 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -719,7 +719,7 @@ static void via_isa_realize(PCIDevice *d, Error **errp) ISABus *isa_bus; int i; - qdev_init_gpio_out(dev, &s->cpu_intr, 1); + qdev_init_gpio_out_named(dev, &s->cpu_intr, "intr", 1); qdev_init_gpio_in_named(dev, via_isa_pirq, "pirq", PCI_NUM_PINS); isa_irq = qemu_allocate_irqs(via_isa_request_i8259_irq, s, 1); isa_bus = isa_bus_new(dev, pci_address_space(d), pci_address_space_io(d), diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index a45aac368c..6e4303ba47 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -299,7 +299,7 @@ static void mips_fuloong2e_init(MachineState *machine) object_resolve_path_component(OBJECT(pci_dev), "rtc"), "date"); - qdev_connect_gpio_out(DEVICE(pci_dev), 0, env->irq[5]); + qdev_connect_gpio_out_named(DEVICE(pci_dev), "intr", 0, env->irq[5]); dev = DEVICE(object_resolve_path_component(OBJECT(pci_dev), "ide")); pci_ide_create_devs(PCI_DEVICE(dev)); diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c index ddfa09457a..900f93c15e 100644 --- a/hw/ppc/amigaone.c +++ b/hw/ppc/amigaone.c @@ -153,8 +153,9 @@ static void amigaone_init(MachineState *machine) object_property_add_alias(OBJECT(machine), "rtc-time", object_resolve_path_component(via, "rtc"), "date"); - qdev_connect_gpio_out(DEVICE(via), 0, - qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT)); + qdev_connect_gpio_out_named(DEVICE(via), "intr", 0, + qdev_get_gpio_in(DEVICE(cpu), + PPC6xx_INPUT_INT)); for (i = 0; i < PCI_NUM_PINS; i++) { qdev_connect_gpio_out(dev, i, qdev_get_gpio_in_named(DEVICE(via), "pirq", i)); diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index c1bd8dfa21..9b0a6b70ab 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -195,8 +195,8 @@ static void pegasos2_init(MachineState *machine) object_property_add_alias(OBJECT(machine), "rtc-time", object_resolve_path_component(via, "rtc"), "date"); - qdev_connect_gpio_out(DEVICE(via), 0, - qdev_get_gpio_in_named(pm->mv, "gpp", 31)); + qdev_connect_gpio_out_named(DEVICE(via), "intr", 0, + qdev_get_gpio_in_named(pm->mv, "gpp", 31)); dev = PCI_DEVICE(object_resolve_path_component(via, "ide")); pci_ide_create_devs(dev); From patchwork Tue Jul 16 18:09:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812781 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435731wrr; Tue, 16 Jul 2024 11:11:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUlZeT1L5PrH+H2QI62W0KtLLYVOKRw2pixv+3EosJ6RVpwRbmv2s9RNqx83juldsnPiZXyd+l17oXODtmZ4O5C X-Google-Smtp-Source: AGHT+IEq1lipslipoIW5vYFUScOWgxFK6Os2cZ64laLlHEt7xWzxEg/7piQyEr+ohJ54Z1wJ5BRM X-Received: by 2002:a81:8784:0:b0:631:43e1:6b99 with SMTP id 00721157ae682-6637f2b7c28mr30857257b3.12.1721153504810; Tue, 16 Jul 2024 11:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153504; cv=none; d=google.com; s=arc-20160816; b=DkHmuE/uxDlCVM0CZJfMNIJG3qgMwIoaAFV+KYfxVTZd6lFOg9oJacZu3fMKD6cZB6 rPihPvXCz/wwUH3zcxAhe82ALDSCNDTtZHWKpHQjchiLeAqNPTjsoX1yb3oQJqFGbdCW AuFuUHYRmZfB84vwkEz+gUE/lUCm6PJ4yji8EA3YwGgCsq2dj4cGokdXBdJ7EAVfIhxM LVrayub30DsBGtWbTbH8nWZhW48m1y5Kk1v7/VgZl76GMU9JJ06Q74wf5uIxugAw0+8J 71FqthYGuQFZ1dP8+S1uLBDSvUG47gK8zJ7LDHO0H/32MV/OkMF4gv8HCHTh3ztLISCt pluA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=+f/7N8GJRq8hKRVda+Tlkh41f3Qt1aALkfzBVC63ub4=; fh=SvSSdOh/FtIuNzd1oS5IjFxss0muSWHQxcPQVOxivx8=; b=KIopUBBQNEv87cVBcx7lFhqfHfUzOTehzQ8qaqoUyz/p3DOcXQI9fGC1ZAlQrw8pdo 8K/qmYpbUZ9ttA9rSTlhiOjGVofn/WWJiufnBS9er6xRapnfDhfNpJ0DbDT/KZRkn5Ap pps/Oc/6K+PZ3tLS9cjmsPLK0I7g1PQx21u+cIqVxldcuR0mhgy13cXkt+EJ4YHK5Nyh kKmkIDklViDG/D8FW9neIerVMPJpf+8bqoLpq/ePvqdHQdYISUh7QDae1vSdmUQ6Gz27 iJWNxkZIl91BoYiRqVqwS4IR5+r11HHB674cXRZvVDaP2j1eULlmA3w2Kf9tpAxxgqd+ WFNg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V7Ct9ZN0; 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 d75a77b69052e-44f5b79e16fsi78852001cf.215.2024.07.16.11.11.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:11:44 -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=V7Ct9ZN0; 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 1sTmco-0006oo-NJ; Tue, 16 Jul 2024 14:10:06 -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 1sTmcm-0006i6-Sp for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:04 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmcl-0000ur-22 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:04 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3678aa359b7so5749f8f.1 for ; Tue, 16 Jul 2024 11:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153401; x=1721758201; 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=+f/7N8GJRq8hKRVda+Tlkh41f3Qt1aALkfzBVC63ub4=; b=V7Ct9ZN03/DkPtULc0Y+htfBvdw1OfHV7TWTWk7XIeyTZKd0bXgm2NCmloWnQACBaA 4NFL8lszHMpLT3nvE2Q84L0XGWqKqkLfvKjvMRKQ5NWvFT+0duRN8CSie5a6Yc/pLF2X xjeK5a9QrUV4JU25RtnJykxKBUZUCOhIAxbBpUs5Xo9LjZ0eWW+prRhnJlv6rzBDiYHB pi5FpjzUEarIz4hZ4KmFzKMv4m6B9SPBW+p9IQaaH+gC40E9zDy2KpKFckQx/Pe9ea4V 6KRhjiOfg6R6uHGv7KV67lx/2DsPJNkfrqaMlPYg2RtZcEKxlpebcmSeWEWMZ3pCpfg6 PPMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153401; x=1721758201; 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=+f/7N8GJRq8hKRVda+Tlkh41f3Qt1aALkfzBVC63ub4=; b=SmzD/M0LRiIIAWR2WdyDU8bwpdSZkqWsR3ihJf9SW0/1gxVfEpZhEbjDB9hrGZEFxN rgEshtlIRK++9hG4cLuhozutHNiHDDAd4DyQI+jmQy3YEZ4t+2sVJmDZczFXRvfNC08e 9CkpReVK6jDte2Fo3jtC/MNpCGVNkeT915C6F3snJhguh0HukigX5/SwxdBGpiwAfx2D Va86Lom+MEux5IIYSK3HYSgrXGQkxF/Zrl9B0KT2zK6DrXCA9wnewk2t+pPHge7h54RT K7phR4bdZC8lovSs9OcXIyMDHF7U0PEYJ4CK/UkRpoHmKB0L+TDfjG1pUet20ku+TQOp m21Q== X-Gm-Message-State: AOJu0Yznp3krq1e8vd1Kck9cXI2nIHZQpnjHMcQ4UBa621HhQdpMS8NN i9Fhdtp4qOXz6r8xEd4g9sgG1+j7Mm77+1DjNftjVp+q2AKxE4FT6fVqCKrnzJLMm8b/xefMber j+OsG7w== X-Received: by 2002:adf:ef86:0:b0:367:8e57:8 with SMTP id ffacd0b85a97d-36827432f95mr2270756f8f.19.1721153400814; Tue, 16 Jul 2024 11:10:00 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dafb939sm9701924f8f.89.2024.07.16.11.09.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:00 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , BALATON Zoltan , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 03/13] include/hw/qdev-core.h: Correct and clarify gpio doc comments Date: Tue, 16 Jul 2024 20:09:30 +0200 Message-ID: <20240716180941.40211-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.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: Peter Maydell The doc comments for the functions for named GPIO inputs and outputs had a couple of problems: * some copy-and-paste errors meant the qdev_connect_gpio_out_named() doc comment had references to input GPIOs that should be to output GPIOs * it wasn't very clear that named GPIOs are arrays and so the connect functions specify a single GPIO line by giving both the name of the array and the index within that array Fix the copy-and-paste errors and slightly expand the text to say that functions are connecting one line in a named GPIO array, not a single named GPIO line. Reported-by: BALATON Zoltan Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240708153312.3109380-1-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/qdev-core.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 5336728a23..77bfcbdf73 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -624,8 +624,9 @@ qemu_irq qdev_get_gpio_in(DeviceState *dev, int n); * @name: Name of the input GPIO array * @n: Number of the GPIO line in that array (which must be in range) * - * Returns the qemu_irq corresponding to a named input GPIO line - * (which the device has set up with qdev_init_gpio_in_named()). + * Returns the qemu_irq corresponding to a single input GPIO line + * in a named array of input GPIO lines on a device (which the device + * has set up with qdev_init_gpio_in_named()). * The @name string must correspond to an input GPIO array which exists on * the device, and the index @n of the GPIO line must be valid (i.e. * be at least 0 and less than the total number of input GPIOs in that @@ -673,15 +674,15 @@ void qdev_connect_gpio_out(DeviceState *dev, int n, qemu_irq pin); * GPIO lines * @dev: Device whose GPIO to connect * @name: Name of the output GPIO array - * @n: Number of the anonymous output GPIO line (which must be in range) + * @n: Number of the output GPIO line within that array (which must be in range) * @input_pin: qemu_irq to connect the output line to * - * This function connects an anonymous output GPIO line on a device - * up to an arbitrary qemu_irq, so that when the device asserts that - * output GPIO line, the qemu_irq's callback is invoked. + * This function connects a single GPIO output in a named array of output + * GPIO lines on a device up to an arbitrary qemu_irq, so that when the + * device asserts that output GPIO line, the qemu_irq's callback is invoked. * The @name string must correspond to an output GPIO array which exists on * the device, and the index @n of the GPIO line must be valid (i.e. - * be at least 0 and less than the total number of input GPIOs in that + * be at least 0 and less than the total number of output GPIOs in that * array); this function will assert() if passed an invalid name or index. * * Outbound GPIO lines can be connected to any qemu_irq, but the common @@ -796,7 +797,7 @@ void qdev_init_gpio_out(DeviceState *dev, qemu_irq *pins, int n); * @dev: Device to create output GPIOs for * @pins: Pointer to qemu_irq or qemu_irq array for the GPIO lines * @name: Name to give this array of GPIO lines - * @n: Number of GPIO lines to create + * @n: Number of GPIO lines to create in this array * * Like qdev_init_gpio_out(), but creates an array of GPIO output lines * with a name. Code using the device can then connect these GPIO lines From patchwork Tue Jul 16 18:09:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812783 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435790wrr; Tue, 16 Jul 2024 11:11:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX4lj16If89qMVcCs6P1tAZGM6K8iyj7n13iCX43HQIe2S80uHmgToPB7eEVxIjixuO15fkLsugb02Qu38PXUl4 X-Google-Smtp-Source: AGHT+IFOzOhNwTSPFngzUEN0SF+73KbLRnFMGTrOKRwtrpRtNoLjGsubTRbYCRv4k759HbxWTbuk X-Received: by 2002:ac8:5f88:0:b0:447:f105:e6dc with SMTP id d75a77b69052e-44f7abd41f5mr40369101cf.4.1721153515254; Tue, 16 Jul 2024 11:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153515; cv=none; d=google.com; s=arc-20160816; b=N2DmAuTBEsr+OeaEaz3Jg8TVDFDKcmAMb2Ga2HF3x34/wOSaIcM5brmuLJcJKxOpoQ qLqX/zg+gaCQaBZMuLGrG1zkHYzjFu/5X3Lmq5p7P4TglLPRXTGF5Up4PXq4Xlpiwmh3 wjG82qkKiqE3MxGYU7Im/v0L0lSFTfXqWhVRuQLZLQCBjrBa8ST9XfBuN7twf1VC/ciV xmIszm0/FklXF64KBHd8GT48YFsMcFOCuh7lLS2VMPwL9tFRDDWi5WamUbEMiROh8CKW TCagIdnVYSAYvGHM/CxdmkTFJVsvU2d2X3/9sIR1HOWXbXfvQKw7iQ4Cwe3kIxkTx4m/ cc8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=5NkIaFDVC7mCONUcx74ZzxY6giGkJtU3xAyO2Vz6jhE=; fh=FmxlZx5/TR51h4+oK1M2WmmGqBUetpYvniY9YlLbvkc=; b=hu8qhskLGt6gxDaTdqfobIsuv6FrPTnApxK1rHAl2joTMmjOu9nrOQvcMh55F09Iqw KpZrj5VkPExXKEOGSRms2iZYg+JCyYCCFSBCSVgXuclWgPl4Q5Pq5yZHpxLGqQ5qiXP1 /AlSmbCFv+KmuydUMRFWxcD/OADX0BHV3noxAc+1HUHqk+PPT5/yCzDaTPD5o8GQF5LH 2u7s6ZWUacLqk6NYcyfZ7PuvG9ZbS/Sra4CLnW3CVNmpsQ70HHODtEwu3C1/XazY45b4 izgEfq/MJ/Hzp3YZp7ulefLT0V4SxRHM/0J+V8aL4sqrRa1wroSieZeemuV34M/FDonp ovBg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SlCuDIqT; 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 d75a77b69052e-44f5b77eeccsi81149781cf.107.2024.07.16.11.11.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:11:55 -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=SlCuDIqT; 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 1sTmct-0007AD-KB; Tue, 16 Jul 2024 14:10:11 -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 1sTmcs-00074l-08 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:10 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmcq-00011q-1C for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:09 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4257d5fc9b7so46452065e9.2 for ; Tue, 16 Jul 2024 11:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153406; x=1721758206; 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=5NkIaFDVC7mCONUcx74ZzxY6giGkJtU3xAyO2Vz6jhE=; b=SlCuDIqTNSAU0XZafHImW+vkQTc8KerUAgv2Xtw88DZPaacCDZbO+KP/WeThltH4/+ gFQxOz6C2Ph8npnKpYlLEqgexKsP2hSnGfrTuZ/ynshfnK5JEb7t+eLpNYmM/a6MbM0f xeWB2cYtnLaDoHzHeOryWmy+NkKWKfFrQ8vRUwVsMpxbZKi9Hmdsa8D3Jmqf7eWfpaIR QoQ84Elzz4r03nYLx9w42HS0/u+VxVp2RnDw+lb/ZYcqhilPAWPLBlsjHeRZoKVtpnxy Z67OHs5UImoZ5ljMHdDN7+N8RcfA/klrBT4HBXu2oYe6MsA4PEjyg1b+JK07cUbmuj61 1EdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153406; x=1721758206; 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=5NkIaFDVC7mCONUcx74ZzxY6giGkJtU3xAyO2Vz6jhE=; b=osFJ5dQAp/snQNpz+Ylw1JrJuFYO4NEU4ZJUR7JLF1FcoJiri5YgjKYQbDv3FIwje5 HC3RJOO9FU515SfVBVw8wI6sNQ1BLHtBywgkKwlRQpvbUDuwm7EYngW20/KDI0G7QMxz igpBcf7GBxBFiyZnTrotKGSkaovKei5ES+KfOYvwKLTCinrhetZkgeiySlNsRbH8Lka6 r/cEQGeY44RW3Zeej1qxZy0QjMxxr3Fkmk1eejKFjKdHD3ld33FKgVqITAfsm+Wmzb91 wxlObYjkQ1i+uZOy5I0UPFJPInUaioCF6beliE1m/2SDprOWNJUZugzuE+t2XAGLYY3M kwEw== X-Gm-Message-State: AOJu0Yx09P4MDmbE3mIOIX94NxabFFmI1/A4iW6L7mhEidi1UU2tnyov PmzlbqDwGhcQMt6KcqMRWGHZCE+67BwJccvHdAAQzbxwx9tP5hIcOuf8RtYAxkKz/6T7Qhis5B5 PoRw1cw== X-Received: by 2002:a05:600c:1f90:b0:426:6b14:1839 with SMTP id 5b1f17b1804b1-427ba47ab0amr26929585e9.0.1721153406167; Tue, 16 Jul 2024 11:10:06 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dabefa6sm9664487f8f.44.2024.07.16.11.10.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:05 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 04/13] loader: remove load_image_gzipped function as its not used anywhere Date: Tue, 16 Jul 2024 20:09:31 +0200 Message-ID: <20240716180941.40211-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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: Ani Sinha load_image_gzipped() does not seem to be used anywhere. Remove it. Signed-off-by: Ani Sinha Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240711072448.32673-1-anisinha@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/loader.h | 4 +--- hw/core/loader.c | 13 ------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/include/hw/loader.h b/include/hw/loader.h index 9844c5e3cf..7f6d06b956 100644 --- a/include/hw/loader.h +++ b/include/hw/loader.h @@ -77,15 +77,13 @@ ssize_t load_image_targphys(const char *filename, hwaddr, ssize_t load_image_mr(const char *filename, MemoryRegion *mr); /* This is the limit on the maximum uncompressed image size that - * load_image_gzipped_buffer() and load_image_gzipped() will read. It prevents + * load_image_gzipped_buffer() will read. It prevents * g_malloc() in those functions from allocating a huge amount of memory. */ #define LOAD_IMAGE_MAX_GUNZIP_BYTES (256 << 20) ssize_t load_image_gzipped_buffer(const char *filename, uint64_t max_sz, uint8_t **buffer); -ssize_t load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz); - /** * unpack_efi_zboot_image: * @buffer: pointer to a variable holding the address of a buffer containing the diff --git a/hw/core/loader.c b/hw/core/loader.c index 39bd8f9e4d..31593a1171 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -845,19 +845,6 @@ ssize_t load_image_gzipped_buffer(const char *filename, uint64_t max_sz, return ret; } -/* Load a gzip-compressed kernel. */ -ssize_t load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz) -{ - ssize_t bytes; - uint8_t *data; - - bytes = load_image_gzipped_buffer(filename, max_sz, &data); - if (bytes != -1) { - rom_add_blob_fixed(filename, data, bytes, addr); - g_free(data); - } - return bytes; -} /* The PE/COFF MS-DOS stub magic number */ #define EFI_PE_MSDOS_MAGIC "MZ" From patchwork Tue Jul 16 18:09:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812786 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp436164wrr; Tue, 16 Jul 2024 11:12:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUyvLqkev2qBHPap3sflqljyEuZEqhQKPUqaCz2g7mmd8bv4elo+0pQfK8ci1GfSAQ7fnuW1r0ne2si3GheoMOs X-Google-Smtp-Source: AGHT+IFs6XMXYEBepeJ0T3PyPPDGdr6Prb8jg5CW4daRQzlTbtBo/AHz0j//TYYSwzFL+UmVMTPO X-Received: by 2002:a05:6808:2dc5:b0:3d6:2fe3:35f4 with SMTP id 5614622812f47-3dac7c38f38mr3776315b6e.54.1721153573565; Tue, 16 Jul 2024 11:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153573; cv=none; d=google.com; s=arc-20160816; b=jI3RfR58Dj5bhy+uOyI0khBceje0K6nzlSbeDehsv5q1QosAexzroz6C9YbpKuxKqf D5t5yj/CPJqlLTglv3kcMpJZ6Eg5D6JeTrED7NI7xGVdsYnykBlVP36PMYEOpSyLBwpZ BV/ew48ghmIz+tsTgnW/+Esn1UI1HFJrwHa+XaCzqrC6mu7sZS3s/bBKlRrDjqmKrl6P NaA8qMTxCAVTkEc3SRQ5KWuR8/x1HeCKQu4XGUcr8tLp0YL85898VEOZk6NQYdwwRfVP Zf8zl+XOXYMCLApds5hzsbxh8y0ixrUgUHpzKtocIJ/dHmTjnpvcLZBNTa+0I7LXuRAa mA6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=fhnQiVznBi2Zvr4gz5/6RuKKxU2+0PGgb84J5GpHddM=; fh=kcP7ZIMp0jXqwn1u8iNqoh0SFyVgb46932DBs4jmj0s=; b=EUUmlby0NIBLre+L+1pOYjuaiW4U9KnR4gmX6BgyHbY3x6nWzPxSO5eQakhKwKqh9I LeTWG1fPcQuE87UP3pwnmJ/nlIS4GZCzK4NkNieZ5hm7QN4eYKn0z9KWcBUZ+jFZDsoe d9oxvGyL9cW6bC8P5LwgUdnGoXG5y8rhM00IqHnnv4L5xfqFnyGaBkA+1jD0i4yQAjV5 n5B4ZFbzwB5LYKu6zVpb76Wv5S9r7zMoGngahZ58t44zXIh78NZxSb4vW7RyuSqXYfdn V5oOW+x1qTx9fseKF7qDZ0Ht2vfo/nmCENj7YLGJe4TBl2RxRSxFx5Zs8ywdjd5UJaeb OgLA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nr059V3Y; 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 d75a77b69052e-44f8347bdc2si1803241cf.562.2024.07.16.11.12.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:12:53 -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=Nr059V3Y; 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 1sTmcy-0007UF-IT; Tue, 16 Jul 2024 14:10:16 -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 1sTmcx-0007Q5-DR for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:15 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmcv-00018Y-FF for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:15 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4267300145eso46440675e9.3 for ; Tue, 16 Jul 2024 11:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153411; x=1721758211; 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=fhnQiVznBi2Zvr4gz5/6RuKKxU2+0PGgb84J5GpHddM=; b=Nr059V3YPWAL576zT/ugBT3wpUfKI4c1vfxR30jvp2+OA5dil/PFbmfsVb5P2l631d 5YxUt0RmYV7mPQFBK3eZAT3lH0iYlSRcNUyZ7XGGUmlUGfMCTC6IYvyIeCXcMc6COf2U uM38KSJw0i4DOXc0yzJl0BbAUDOADWeRWS8qH5ezVOazhQdHfINDZ+kO3XDgz9ZRzW7A WYp/a9ErQ7/J9T3nl7mfYaX0n6+UqrWwJvjr0g6buRXmLNvU+Y5KJR4dZQC1LSRnok+7 8wGC9fdpDBKys6cEs9uoB2odbnzbkyO4Avo00PTciF+iyW9i8ckDTge9RT68kauixm4t y22A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153411; x=1721758211; 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=fhnQiVznBi2Zvr4gz5/6RuKKxU2+0PGgb84J5GpHddM=; b=dY/1b21erS90oYvwzRoHVb4XQcFduvIYIzbJg52Wh+GAxDNVZJawDQvcaipA4ghI6X poRnY1r9+e5DyrDlkjuJ7qYr64KEIqm8+9K0krA/lxCn5n8b5BHlYC/4L8zJa/vZMGoI FZxZuBESvqJxzL6WzxxqX2ajrRD2LpdRK/4C9+pWxzzE/J5L6DjreY0WBLtBTteyj3xV tXWfEM0wPSuqKbrqeVAYN8wt9bkSRzK/vEjy4F2MmndlnG1f49JDDV6uY6Tdj9M23fu4 ychzTlGMFB9ZaIsKl01vNuJBgeCkmgtmZCaN8LGNhF2uKtoDX8p2f5QOzm+cuXbgItVI eLCg== X-Gm-Message-State: AOJu0YwRhDtvVX4RrKS1Q/+relo1b82zmMjOfbDu5wJlYYe4TEjEQG5s jr3OhcOjgtU87fd0GKfx2SnbEPNIS9UWIKHT2WBJxm2VXF8IzWmg4bSWKR7lRm9d0Q58pCISxlu wYSEG9A== X-Received: by 2002:a05:600c:3548:b0:426:6f87:65fc with SMTP id 5b1f17b1804b1-427ba6872f1mr28007535e9.17.1721153411661; Tue, 16 Jul 2024 11:10:11 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427a5edb50fsm138130745e9.38.2024.07.16.11.10.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson Subject: [PULL 05/13] accel/tcg: Make cpu_exec_interrupt hook mandatory Date: Tue, 16 Jul 2024 20:09:32 +0200 Message-ID: <20240716180941.40211-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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: Peter Maydell The TCGCPUOps::cpu_exec_interrupt hook is currently not mandatory; if it is left NULL then we treat it as if it had returned false. However since pretty much every architecture needs to handle interrupts, almost every target we have provides the hook. The one exception is Tricore, which doesn't currently implement the architectural interrupt handling. Add a "do nothing" implementation of cpu_exec_hook for Tricore, assert on startup that the CPU does provide the hook, and remove the runtime NULL check before calling it. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson Message-ID: <20240712113949.4146855-1-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 4 ++-- target/tricore/cpu.c | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 245fd6327d..9010dad073 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -857,8 +857,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, else { const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops; - if (tcg_ops->cpu_exec_interrupt && - tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) { + if (tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) { if (!tcg_ops->need_replay_interrupt || tcg_ops->need_replay_interrupt(interrupt_request)) { replay_interrupt(); @@ -1080,6 +1079,7 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp) /* Check mandatory TCGCPUOps handlers */ #ifndef CONFIG_USER_ONLY assert(cpu->cc->tcg_ops->cpu_exec_halt); + assert(cpu->cc->tcg_ops->cpu_exec_interrupt); #endif /* !CONFIG_USER_ONLY */ cpu->cc->tcg_ops->initialize(); tcg_target_initialized = true; diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 4d9c0368f2..1a26171590 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -155,6 +155,11 @@ static void tc37x_initfn(Object *obj) set_feature(&cpu->env, TRICORE_FEATURE_162); } +static bool tricore_cpu_exec_interrupt(CPUState *cs, int interrupt_request) +{ + /* Interrupts are not implemented */ + return false; +} #include "hw/core/sysemu-cpu-ops.h" @@ -169,6 +174,7 @@ static const TCGCPUOps tricore_tcg_ops = { .synchronize_from_tb = tricore_cpu_synchronize_from_tb, .restore_state_to_opc = tricore_restore_state_to_opc, .tlb_fill = tricore_cpu_tlb_fill, + .cpu_exec_interrupt = tricore_cpu_exec_interrupt, .cpu_exec_halt = tricore_cpu_has_work, }; From patchwork Tue Jul 16 18:09:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812784 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435802wrr; Tue, 16 Jul 2024 11:11:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV6GfbdH5Gpuk7+t1KoGkWPS2reyPFYLChkakIEwUNLWqBrYR186lhHW0062Fu6VuMOjl80ywdNxnUHoDZW3dG8 X-Google-Smtp-Source: AGHT+IFihDYrZMQWCDQH8CQ+l25Kehs1vfFtY46pFlSTogm6oVr3N/5becDyUT8MipYhMtjZesud X-Received: by 2002:a05:622a:5cb:b0:446:5764:3c9f with SMTP id d75a77b69052e-44f7ac3b91dmr37425331cf.22.1721153516533; Tue, 16 Jul 2024 11:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153516; cv=none; d=google.com; s=arc-20160816; b=saMPlSZEhWUYB7dSp8vITybXb/Bg8nnjGpeT/mLYCTsnPFfSw7CrNEJ/7H7sX8szn9 WtXLuxU6ZaWjECfrKebM/lS88SRrkAjdbpBh6O55Er8YXLq8BiMFTBQnySIRuWMbdDuL cFrFMxnwtwjreKiJpHLjiYUi/YaSENspnNJC5/ouvbTp97To0bNXh/T++7JrPmyyj/a1 /U7Zj3MUlYPgZhFA9ICllCE1RS3Za1xl69jBqvCHBIXOSBsugf4FSUhFL8XXrUwXaPt4 BJs75nCkLuvK1m9sBcov/peaclAyJmOpIurr2gXM77krPGttJEiVYXffn5EGq3FXYCcg T/Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=J/fWelIsDk94bV5CUZ155GFV3Kb2G+dluPKM584VupM=; fh=QF/JOPHaZZtQXIB8vEzxUZ9RIvYo4vCjR/Qv3feI8es=; b=CC4NizG8vKQTOF5eNrMsuMi1v+lClWSH3eMHTw0YdyXCwwrKwikMe0p6rw/3i3aV5W GUQozMsy5ATyWch1wH/TX6ppOXohn6b31oPQmW1ojiX76ObLL9HSweob21WVdrDoUXFV nwUp1+leKagLsigu5miNDTvFr29bG7vYiwcPUmlzVfZ2ZC93qwcw1fJSVyIh/aAllkTg KcSGIwAQLrlD9nIOjHa2CHYTgKvNRWSHbMePiBnYn2lMJmcZOp/H+LdbO5iLVbdFzCjJ dHlBwY3hDKkaBHrjNocxzpLI9PFuO8unSFNKSMHlDXzIVZYr6KPSA1mdA2SGPC8LnCzZ O+NQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I2n9uXes; 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 d75a77b69052e-44f5b7f66adsi82041781cf.235.2024.07.16.11.11.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:11:56 -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=I2n9uXes; 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 1sTmd5-0008DD-8W; Tue, 16 Jul 2024 14:10:23 -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 1sTmd2-0007ys-Na for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:20 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmd0-0001AY-U9 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:20 -0400 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4257d5fc9b7so46453835e9.2 for ; Tue, 16 Jul 2024 11:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153417; x=1721758217; 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=J/fWelIsDk94bV5CUZ155GFV3Kb2G+dluPKM584VupM=; b=I2n9uXesiILmZMw4DqEKU37v8iPPPG90TR2n/IPhfnEEeYO64uPxQVO/T89VR7HoI2 FpLIvBycJhuMrBlInrhGOxcHuIiu/iqULdm9Sb3IZLVTtHWGxEWSp9O4eoqpOuRzs+9U 3ataOTTFWMgkbin+GQmtH//MzMPL8craq9cArUwYMgUpxw75yfn0bXBpV2ywZe4OaU5m A6nZd14cr9T6qkJgJC2jW05Y1uM8SQCXJy6GYw2eQ3Fsq6mkU2T/bZBzy4rwlts0bKJn 2lVb4sJoihBZvW3F2vLs0D1uHMSLbpYBCqh2xqnR5m1dfU6zo61Qjkl2ualZKQTqSs3m Fgzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153417; x=1721758217; 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=J/fWelIsDk94bV5CUZ155GFV3Kb2G+dluPKM584VupM=; b=wutjvGfOZt1ZLWiCIsiJE4Lv/Tdsyf39fEoHo4xEhmYq2/GwcbIH9LCSZaaQ8/qyXC 0YQvkjcM5iG4Tsm/fOFO/lV7skx1Q20ir/3fdOHzVCFTZLdTs2ed/VHm091g4A7Qp2iD RD9bWQoSYe5mjw31ByPWaVaIysPVWZz4tIB7GG0/dCdEpj73LGtqEv8ba9CN8hInPmnH M13HEy3nt9qneJ6lBoBC59ur+UVmnYI/9sQBg9kemiBbV8QT+Vdf6uZsNDGAqg+uzByN 8at0lHXWa1MjTCi7svCTA6IRzGuM2WWqoVUtRxlpXghdI8KLVJgH+NikrhXhJEJlq95k D9Gw== X-Gm-Message-State: AOJu0YwAi6lgzinvWvqyaZjSG6yeBOdcA+v2QGTdipxsZ73usx8Pk8jW AVg7aHOfQGRMfZFNBdX+0WE+hAAjskG0BkiD1FzQEuqyiviHR/ewuNUuz4T9HVU9uLEgyV86cR1 9zItL2g== X-Received: by 2002:a05:600c:198e:b0:426:52a5:1ca4 with SMTP id 5b1f17b1804b1-427ba69ae4emr23743705e9.21.1721153417039; Tue, 16 Jul 2024 11:10:17 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dabf133sm9532426f8f.37.2024.07.16.11.10.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:16 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Nicholas Piggin , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Xu , Richard Henderson Subject: [PULL 06/13] system/cpus: Add cpu_pause() function Date: Tue, 16 Jul 2024 20:09:33 +0200 Message-ID: <20240716180941.40211-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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: Nicholas Piggin This factors the CPU pause function from pause_all_vcpus() into a new cpu_pause() function, similarly to cpu_resume(). cpu_resume() is moved to keep it next to cpu_pause(). Cc: Philippe Mathieu-Daudé Cc: Peter Xu Cc: Richard Henderson Signed-off-by: Nicholas Piggin Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Message-ID: <20240712120247.477133-17-npiggin@gmail.com> Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/cpu.h | 8 ++++++++ system/cpus.c | 30 +++++++++++++++++------------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index a2c8536943..e6acfcb59a 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -984,6 +984,14 @@ void cpu_reset_interrupt(CPUState *cpu, int mask); */ void cpu_exit(CPUState *cpu); +/** + * cpu_pause: + * @cpu: The CPU to pause. + * + * Pauses CPU, i.e. puts CPU into stopped state. + */ +void cpu_pause(CPUState *cpu); + /** * cpu_resume: * @cpu: The CPU to resume. diff --git a/system/cpus.c b/system/cpus.c index d3640c9503..5e3a988a0a 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -568,6 +568,22 @@ void cpu_thread_signal_destroyed(CPUState *cpu) qemu_cond_signal(&qemu_cpu_cond); } +void cpu_pause(CPUState *cpu) +{ + if (qemu_cpu_is_self(cpu)) { + qemu_cpu_stop(cpu, true); + } else { + cpu->stop = true; + qemu_cpu_kick(cpu); + } +} + +void cpu_resume(CPUState *cpu) +{ + cpu->stop = false; + cpu->stopped = false; + qemu_cpu_kick(cpu); +} static bool all_vcpus_paused(void) { @@ -588,12 +604,7 @@ void pause_all_vcpus(void) qemu_clock_enable(QEMU_CLOCK_VIRTUAL, false); CPU_FOREACH(cpu) { - if (qemu_cpu_is_self(cpu)) { - qemu_cpu_stop(cpu, true); - } else { - cpu->stop = true; - qemu_cpu_kick(cpu); - } + cpu_pause(cpu); } /* We need to drop the replay_lock so any vCPU threads woken up @@ -613,13 +624,6 @@ void pause_all_vcpus(void) bql_lock(); } -void cpu_resume(CPUState *cpu) -{ - cpu->stop = false; - cpu->stopped = false; - qemu_cpu_kick(cpu); -} - void resume_all_vcpus(void) { CPUState *cpu; From patchwork Tue Jul 16 18:09:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812778 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435338wrr; Tue, 16 Jul 2024 11:10:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVjefcA9agYz7Px6/zTsYoEhgYA/H027TkSLKTeMfAyQUTnd/YmuJRBDc3QkdU7dMm6PudZ5uVi+iW4cAY+tou3 X-Google-Smtp-Source: AGHT+IH+ez0Fdx6KL5LdlMCmEz2bXzMMlWo2VbZGFW2DO6Jp8VM1j2YRI/+47OetAQb+Jg0W4evR X-Received: by 2002:ad4:5cc2:0:b0:6b5:53a7:74b3 with SMTP id 6a1803df08f44-6b77f4ecd5emr36490716d6.15.1721153446228; Tue, 16 Jul 2024 11:10:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153446; cv=none; d=google.com; s=arc-20160816; b=jJUh2hulGZVwJe90Po+4VxNTWZjNboQV7H3V6O78EIrs0N6fjionVjeJobqKULDUzn WG2Ab45Zi9k7hzfhG0SQldg3Folme/Zu8iqlQg/e2UZFoBrvqV+GpbBoQbgSz2jA14iy cgb38BzLVEMGm0jwr8giHbEqWHXbJk7l47eP1mXYcafgr29wxaHIJIFR9bKTac8vTIig rVZVq/lnX3+4nZtx5pTpyqp7Pli9pql3zDBo4ti3RbcCDUjW9gMy8u7KlEK/Qd0yYESB ceL5jdcYLXf7nDh/3jDmFrSynjwuYkb0rTQYIsZ7XkUWvfS5ZWYPZ5LZtZY7hC0kozBD tTGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=FU51jMVYxoSXZSJRtYZsN/eDuyNUsq+vn/b+UhmfSb8=; fh=J4M4Z4TZxvAT8lkmK1LtxqMjpO7Qiod4IMBL2bk0hxA=; b=NXBcFS3qY8+EWBmsvvjfZSoMwWn+iExvkz+JwK6O+Jk3Iq1l+Y7T9D9J2VApvaLU+M LFgtS+kpZviEJwiWH3b86bYaXFR3rUTHiLANOgPIK6DQseVNcJp8kJf6ND5YzCaAVM1V m4nEDvB8Y3y5xTMLdMkeIfAS/ZckpWfE+bQkH1Bq5xohdguVbbv1Fzlqeemx1H9vMZjB egyn639NGZwMdbI5hGsDQuFe+Syl4gWJO4bP2Rtx2do6pkWFz4Fz97GcFycc+kqWp8Nh GK8DvA5iA9ZWwq4kfpW0OL9AOLdDbHa4SIk/E005Ks6rOyoQUlvDfsp4/T9y134YPqnX cScA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g5kNvtZ1; 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 6a1803df08f44-6b761a79f8esi82006216d6.568.2024.07.16.11.10.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:10:46 -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=g5kNvtZ1; 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 1sTmdF-0000eb-9k; Tue, 16 Jul 2024 14:10:34 -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 1sTmd9-0008Vj-Pe for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:28 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmd6-0001Ct-9S for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:25 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-427b1d4da32so129455e9.0 for ; Tue, 16 Jul 2024 11:10:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153422; x=1721758222; 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=FU51jMVYxoSXZSJRtYZsN/eDuyNUsq+vn/b+UhmfSb8=; b=g5kNvtZ1ez567cFZpAs5pO/vfBD2amuY3nOG2ZBjxyQPHeEAmz9tGn9D0B71iSF41v owaC5JYAwrl+7pQXhPvAPnciExEhDoFZ80W09oOnqDqZ9gHMgnaS4NSVhZ3NoiekfGD0 acHxeS6Cc/OnUor+QewcxXE49tPs5yejwHmpTtZ+bfEJ/uHKVkx0KWfsAgqb0DFqq4hs NQkFq3L8S/DOFT2Rt8psahswtB2N9TVQV1QJgZ76Iy7w8Hiot43pKjdCNyWHqpO94G8Z ZR0di/dXOwF1ZwG65USXUYmfiTD+Yhl13IMqZlabfwO7oY3oz3hgGgrG7PFLw9am3JD6 e1tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153422; x=1721758222; 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=FU51jMVYxoSXZSJRtYZsN/eDuyNUsq+vn/b+UhmfSb8=; b=Y+P06tBdSkskQ17iiXcDyEOIYCZCsgfNn+cGMZ0Wk93epZeoceA8hmDir+eod8W8BT jPVzvZMdvPn6Iyw4YfW7JXEO+MD1i0qlyJiBlJT5mDj8QgqdVLUuB/76yMvIptN/iwR8 RthwaWRRv58CATYnSZB6DmrPYTQATgyLTTkvfX6Jo4E8FXIAUL6KdL26vAvGwjYjvXZ6 rMB+e7NuN6jfvpevWsxoTHnbcWAVRhOWQdWFYyi05NlJQQrZBo8cOBoWHWiDT0LsYwC7 3vsnxOfHhVKAv9AXBMJvNh1Y2Ypa/QOCIAUw+DQUA+GNc8AH2/znkQgakLFZRf5PW2fG ipUg== X-Gm-Message-State: AOJu0Yw1AXtXTGIuyRVcIAh9badYnfDElPuomZOLZIbWdRdCno5KZv7m oYzSdeMEqe0aeVexoL/BaWZWI+WFmZgVepLe89qTg1PAe/Bdx9ti2xZLni7YXrn3ngndDobM2JQ 0JHY1lw== X-Received: by 2002:a05:600c:1e09:b0:426:62a2:34fc with SMTP id 5b1f17b1804b1-427bf39020amr11850995e9.11.1721153422383; Tue, 16 Jul 2024 11:10:22 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427a5e77429sm138183465e9.8.2024.07.16.11.10.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:22 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PULL 07/13] esp: remove transfer size check from DMA DATA IN and DATA OUT transfers Date: Tue, 16 Jul 2024 20:09:34 +0200 Message-ID: <20240716180941.40211-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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: Mark Cave-Ayland The transfer size check was originally added to prevent consecutive DMA TI commands from causing an assert() due to an existing SCSI request being in progress, but since the last set of updates [*] this is no longer required. Remove the transfer size check from DMA DATA IN and DATA OUT transfers so that issuing a DMA TI command when there is no data left to transfer does not cause an assert() due to an existing SCSI request being in progress. [*] See commits f3ace75be8..78d68f312a Signed-off-by: Mark Cave-Ayland Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2415 Message-ID: <20240713224249.468084-1-mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé --- hw/scsi/esp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 5d9b52632e..8504dd30a0 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -594,7 +594,7 @@ static void esp_do_dma(ESPState *s) if (!s->current_req) { return; } - if (s->async_len == 0 && esp_get_tc(s) && s->ti_size) { + if (s->async_len == 0 && esp_get_tc(s)) { /* Defer until data is available. */ return; } @@ -647,7 +647,7 @@ static void esp_do_dma(ESPState *s) if (!s->current_req) { return; } - if (s->async_len == 0 && esp_get_tc(s) && s->ti_size) { + if (s->async_len == 0 && esp_get_tc(s)) { /* Defer until data is available. */ return; } From patchwork Tue Jul 16 18:09:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812785 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435924wrr; Tue, 16 Jul 2024 11:12:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVDSTXJ+n7z3VTqC5nVwU2vBjzolknxkKIoSSjTVxnL0SqLkCEZtkr25cjw2vbSj6rwxdK6mwpIlNUSuV61u3iC X-Google-Smtp-Source: AGHT+IG6KosPVC/mYP9iSMCeGXTs7V0BGxF6HNNouEw/3BfKu+c3QpbheOitTCYZaQRTvk5psjKl X-Received: by 2002:ac8:5904:0:b0:446:3927:5a9 with SMTP id d75a77b69052e-44f7acad29amr36592521cf.10.1721153541263; Tue, 16 Jul 2024 11:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153541; cv=none; d=google.com; s=arc-20160816; b=OOmZrHsymDKjxArWWiiVK1/OxpGJK/gsXX+1Ni6UMq7mvfFC2FgS8AE1Uw0t9Olono lbxONsNQ/Dw4QzuMEhkBn7vF2KR5fOmCnClXuUax56WueXxusiZWgDTQF/fTkQFLA1U2 QfJd8qshLtNc6/3eQ1iS1kDgUsu+E4Un2jGh7SDNq/c256rN/Z5Ouiri4ynuABsOoAH0 ULjJ+NKj17gDfX4czNcmxlcnUXMWWGD/4+bkexfhHQVoT4vga9Nx7yLXeWN+RaR2Wbic FI/PdJIwm4bO7UL8SThYk/vsPbsSDznKzTnhSl+sPjo/4e0UBcCFjlLmtdPC7MY1LAkD sDoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=eXyrM2tLHAmHfdAt3y0LUG4EVP52RhZxQbundRVG0Yk=; fh=wiKz0x7qvKwceerDkCg/vXelUIS3VMX4wuMEccF/XUs=; b=n7y0lFc7wa2Yp/HgwL/iWJwyUg6h9Layo4rSHQaz/JC4Tpbcjlkq2NYfQaYepv5N1N 5T2PspFYnk5M9pSZwbh3VBBiLEIWezolB0bD9e1suJlM+WiyjpDEdLFZBni2I8CVsw0N go8BVZQQ0HuHczCJ/g7Pj5v0xJXzuIqFWUaAET01b3W/0IhvmVsFg21ZzN7fm/QdtXNm XHXR1+LiaBtdt/gGedM0ND5e7rL0uUgjLIbCfEOso890g3v5oHnQqk7Bt0cf57qNuGKH ugDXDKZRO4LXkLT1v2/UKN3FRhm+qKD9c+5d99okCBYNR6sa+QCyIPlq+HsfSR84urNK tifg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CgOdY1rd; 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 d75a77b69052e-44f5b821c7asi81610511cf.653.2024.07.16.11.12.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:12:21 -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=CgOdY1rd; 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 1sTmdV-0001b4-PT; Tue, 16 Jul 2024 14:10:51 -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 1sTmdF-0000fM-AG for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:33 -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 1sTmdC-0001HM-BM for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:33 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4279ca8af51so36334045e9.3 for ; Tue, 16 Jul 2024 11:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153428; x=1721758228; 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=eXyrM2tLHAmHfdAt3y0LUG4EVP52RhZxQbundRVG0Yk=; b=CgOdY1rdX/R+0iYabBrqhZX/UUZ6usnVkGKR3gaIG8754cW0nmV/wAZNDeFv8XRW+Z unDaJ57AN+ApG47d3SogWvKDFkFzA9+apxm+wMZtLPxkp+kUNo13ne9alhxKon5PAyEC /OVyKzNTFRo7FQT5XYw3f4qjz3XeOP00q5WgtZG+LV4/IvV23pRc7e/WuvK07yIbIVLm eP+LRnYxD2fOZ8lpI5y4ONHXf0c4ckdYcYYC/OTS4DE6EfRsyXdIh6Cjcn9UzJUWHjEi ncIqFFDc9VVTSz6APhQAxgwNTpjG5yB8ZvzhDTwQuB6n8n0OINznBkMlnQlVsvVi+4uK FW5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153428; x=1721758228; 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=eXyrM2tLHAmHfdAt3y0LUG4EVP52RhZxQbundRVG0Yk=; b=bqN4qCRW0bH4KG1AvMKis3xVTkhKO784AsELvE5+EabBcOrgp6gXSrs2RnM5T+6+eo EHasbOKMMmeyIdGVlTZuqTJPL7GfWFv045KWJz8S7ZNJ/SQ6+pVn5FlQDsE+zVF+FJff azo6n7HNW0OwQm/E/GToeFa5c0Ejqu9PyOzmnGO1zAeM2VSGX9+VgLHSFhFQ4tyzFDUY gOpph8UPA7saGyYn68MBKT0tO596/Nzl46ptNjagYkekvt4c6ACGHPtOBg+47Tpn5/39 ZvRdYLEYTw0Qhz7tBKJxPQgxvMW6qxGMm1QbDIwzLCUaVPygPLSxa43CpwA17iDFZl/O InTQ== X-Gm-Message-State: AOJu0YzEp6xlt3whbGARUrTl6L+6yqrUESp1kNvp1smyYW/fjxks2JD3 G0q53S/sKToENaNl3IEEKumZ8CdijEG9xw3trz/MdTHq3/cleKWxYvKvI43M0pOkmi/vOUOk1k8 /lRtw9g== X-Received: by 2002:a05:600c:468e:b0:426:67f0:b4fa with SMTP id 5b1f17b1804b1-427ba655261mr22919295e9.1.1721153427828; Tue, 16 Jul 2024 11:10:27 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427a5e8387fsm136156095e9.20.2024.07.16.11.10.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:27 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Phil Dennis-Jordan , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 08/13] ui/cocoa: Release CGColorSpace Date: Tue, 16 Jul 2024 20:09:35 +0200 Message-ID: <20240716180941.40211-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@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: Akihiko Odaki CGImageCreate | Apple Developer Documentation https://developer.apple.com/documentation/coregraphics/1455149-cgimagecreate > The color space is retained; on return, you may safely release it. Signed-off-by: Akihiko Odaki Tested-by: Phil Dennis-Jordan Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240715-cursor-v3-1-afa5b9492dbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé --- ui/cocoa.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 2935247cdd..79a054b128 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -307,6 +307,7 @@ @interface QemuCocoaView : NSView BOOL isMouseGrabbed; BOOL isAbsoluteEnabled; CFMachPortRef eventsTap; + CGColorSpaceRef colorspace; } - (void) switchSurface:(pixman_image_t *)image; - (void) grabMouse; @@ -359,6 +360,7 @@ - (id)initWithFrame:(NSRect)frameRect [trackingArea release]; screen.width = frameRect.size.width; screen.height = frameRect.size.height; + colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_14_0 [self setClipsToBounds:YES]; #endif @@ -379,6 +381,7 @@ - (void) dealloc CFRelease(eventsTap); } + CGColorSpaceRelease(colorspace); [super dealloc]; } @@ -456,7 +459,7 @@ - (void) drawRect:(NSRect) rect DIV_ROUND_UP(bitsPerPixel, 8) * 2, //bitsPerComponent bitsPerPixel, //bitsPerPixel stride, //bytesPerRow - CGColorSpaceCreateWithName(kCGColorSpaceSRGB), //colorspace + colorspace, //colorspace kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, //bitmapInfo dataProviderRef, //provider NULL, //decode From patchwork Tue Jul 16 18:09:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812782 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435770wrr; Tue, 16 Jul 2024 11:11:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVkal+IeVmA/osdc5M192mV37M21YW7WI6Gj5hoxfM1u7xZD2UsPW82TWVPoN1AN3zwCChXC6Sw89zfL/4H9xRJ X-Google-Smtp-Source: AGHT+IGT7HspRu3Wpvt3gKer4OrkWAgdNwL2WnlmqdKxAUoG0BulnB84E74bjotPtwyHjqgrsk3s X-Received: by 2002:a05:6820:1f03:b0:5c6:aea8:aae7 with SMTP id 006d021491bc7-5d3ce3f0806mr227109eaf.5.1721153510798; Tue, 16 Jul 2024 11:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153510; cv=none; d=google.com; s=arc-20160816; b=n5fz7s5SD4wOsm7gdM41Re2a//HlLkU6WBlWn8EeCrLHcBbZwTIAh5S0izUzqbD1n7 G/dE5B9BQAVcRA8wflEpmUgRfgyNIAs4xRDYG8lLEGv9dciXMvN3HD0Kv/lYUpUJnFkz ahokiqPhXRRYTerUR/QIFfohSML8CZvrFcaXxa+CxuOdXTX01mvMyTLOWzYgJhDT4HqU zKk4PgyaO70CQZ3AODD23UIPkQSRMKcb5PNrp+hATEZSr8tjqsRT7hkSQ9qrg1wet2LK 1Otwjd62xTkMbeP0pMkX3bhA2jh9j0SW/V0A/bkD05ovNV6d1QZ68tXKLh5MezDlUcri kgyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=fjXvs4g8beqO1KLudvEIr0iy0B0rZvJHKWCqys4N1lI=; fh=oruLLm9I2y68+yMpiQR2p6Zt44/DCmjsZcQJB5D1un0=; b=BKdbBR87SC5iyJ1Go4C7Qpb92k/ylLIkAObcPvsk5PWLTHDODi/SbRqCTmt8McKCFp Pu4iaRErUgssz+3BQSSMV+exsmBJO49+lnJVO+8Opai236waIpSaCXKVliRuiDri6HrQ bphZWTiWJmRgDuY+bj6lPdQhhMT2qWtMRBPbEBKb89h1s7/sS58V3/CSQU5HerOuE4Nu 4pdL6yvHgm3DUMqS/jruDXXD1dM25NuVG79YERMZCY1reOw6wjAEtqfXKcyo1SuAYYkm VHB/nRV/Hp8qDtZeFdFv7rX0BBxabxn0cuK6eIO2aEfyx8ihJYPeGwtkUWF1GfUydn+o CcOQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y+cvOGHP; 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 6a1803df08f44-6b761a7d0ffsi78558006d6.584.2024.07.16.11.11.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:11:50 -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=Y+cvOGHP; 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 1sTme4-00047Y-KT; Tue, 16 Jul 2024 14:11:24 -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 1sTmdO-0001Ud-3B for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:42 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmdM-0001Ib-0r for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:41 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-367b8a60b60so3236399f8f.2 for ; Tue, 16 Jul 2024 11:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153433; x=1721758233; 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=fjXvs4g8beqO1KLudvEIr0iy0B0rZvJHKWCqys4N1lI=; b=Y+cvOGHPXSudVzNe5H0Mql1W3/SGak6CMHmPJsiyhB75CZrI3FSPUpuXo4j88zDHCU mlHvHeZF1A5rMO3l90STL9nDFSmOB+coMDuC7a6Z6e1D2OKxfz4y01zyrt6KJE1IkfB6 LNoAxBCNIo+tfC1iPYrW+bLGoG+HRCyBLeLWS/u8pZpB/a9d84GpCKpRgL4S03Lx0bbB u/F89OB/QOfaHS6DyoNivUaajBS/2+yV5BWBEAfEAl40u7Ui69IoShhcAdwmYsksIF5H u8JgJeM6ypxT57MHDCAo58d15aq+/TIhC20fdA11PkpicF4k1NnGPHLTG8zGG4IZys2L FPIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153433; x=1721758233; 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=fjXvs4g8beqO1KLudvEIr0iy0B0rZvJHKWCqys4N1lI=; b=Td/hU+CnxK3qZXtWMbpoFQ4iDo88uceA0NexeyxslowwHoi0APeXMPa/DsPWBrCqVK kD8QdBUH68qeFhkKYycmJ1IOmFn7vPkWinnoTuYgepUqS0symZidNnV/euKtMfcR/wOt ttdbQcRf9Q2vLeno71UaS397g3m7JLHjtXYjhPu+4kYtzgjmX0MzbyQ7CUzgfsOw7b/q 7CZmb3TszL+FXcM4r59s03AC14LJBjMsNYn/oLqY0HNjfr6wDFfhBMwAXCwZlztcYMl0 19h4xfW6OgNqNCZxng6cY6nnq151f7ZjVN7mxShkFQMCxx2jFzEq888HBSvL6+qgahgm 70NA== X-Gm-Message-State: AOJu0Ywo/WJj8j8+RXR1ws+V3EnX8S/qAKvlwYGP+MKNF9x+6u3P0uJ2 ykUIYIBKr+IpiB18Q0MrHQ1H+EMwJjUSM3yGBkmL85ukNK8e2K7eBXDqQEGuB7xGvo8S/IvyRsA 5EZprhg== X-Received: by 2002:a5d:598f:0:b0:367:923b:656b with SMTP id ffacd0b85a97d-368263249e0mr2037764f8f.54.1721153433345; Tue, 16 Jul 2024 11:10:33 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dab3f13sm9766649f8f.4.2024.07.16.11.10.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:32 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Marc-Andr=C3=A9_Lure?= =?utf-8?q?au?= , Phil Dennis-Jordan , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 09/13] ui/console: Convert mouse visibility parameter into bool Date: Tue, 16 Jul 2024 20:09:36 +0200 Message-ID: <20240716180941.40211-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.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: Akihiko Odaki Reviewed-by: Marc-André Lureau Tested-by: Phil Dennis-Jordan Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240715-cursor-v3-2-afa5b9492dbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé --- include/ui/console.h | 4 ++-- hw/display/ati.c | 2 +- hw/display/virtio-gpu.c | 3 +-- hw/display/vmware_vga.c | 2 +- ui/console.c | 5 +++-- ui/dbus-listener.c | 2 +- ui/gtk.c | 2 +- ui/sdl2.c | 4 ++-- ui/spice-display.c | 11 ++++++----- ui/vnc.c | 2 +- 10 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index a208a68b88..82b573e680 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -233,7 +233,7 @@ typedef struct DisplayChangeListenerOps { /* optional */ void (*dpy_mouse_set)(DisplayChangeListener *dcl, - int x, int y, int on); + int x, int y, bool on); /* optional */ void (*dpy_cursor_define)(DisplayChangeListener *dcl, QEMUCursor *cursor); @@ -322,7 +322,7 @@ void dpy_gfx_replace_surface(QemuConsole *con, void dpy_text_cursor(QemuConsole *con, int x, int y); void dpy_text_update(QemuConsole *con, int x, int y, int w, int h); void dpy_text_resize(QemuConsole *con, int w, int h); -void dpy_mouse_set(QemuConsole *con, int x, int y, int on); +void dpy_mouse_set(QemuConsole *con, int x, int y, bool on); void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor); bool dpy_cursor_define_supported(QemuConsole *con); bool dpy_gfx_check_format(QemuConsole *con, diff --git a/hw/display/ati.c b/hw/display/ati.c index 8d2501bd82..b1f94f5b76 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -742,7 +742,7 @@ static void ati_mm_write(void *opaque, hwaddr addr, if (!s->cursor_guest_mode && (s->regs.crtc_gen_cntl & CRTC2_CUR_EN) && !(t & BIT(31))) { dpy_mouse_set(s->vga.con, s->regs.cur_hv_pos >> 16, - s->regs.cur_hv_pos & 0xffff, 1); + s->regs.cur_hv_pos & 0xffff, true); } break; } diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index d60b1b2973..3281842bfe 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -109,8 +109,7 @@ static void update_cursor(VirtIOGPU *g, struct virtio_gpu_update_cursor *cursor) s->cursor.pos.x = cursor->pos.x; s->cursor.pos.y = cursor->pos.y; } - dpy_mouse_set(s->con, cursor->pos.x, cursor->pos.y, - cursor->resource_id ? 1 : 0); + dpy_mouse_set(s->con, cursor->pos.x, cursor->pos.y, cursor->resource_id); } struct virtio_gpu_simple_resource * diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 1c0f9d9a99..512f224b9f 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1167,7 +1167,7 @@ static void vmsvga_reset(DeviceState *dev) s->enable = 0; s->config = 0; s->svgaid = SVGA_ID; - s->cursor.on = 0; + s->cursor.on = false; s->redraw_fifo_last = 0; s->syncing = 0; diff --git a/ui/console.c b/ui/console.c index e67c5dae2b..8e9cc1628a 100644 --- a/ui/console.c +++ b/ui/console.c @@ -49,7 +49,8 @@ typedef struct QemuGraphicConsole { uint32_t head; QEMUCursor *cursor; - int cursor_x, cursor_y, cursor_on; + int cursor_x, cursor_y; + bool cursor_on; } QemuGraphicConsole; typedef QemuConsoleClass QemuGraphicConsoleClass; @@ -957,7 +958,7 @@ void dpy_text_resize(QemuConsole *con, int w, int h) } } -void dpy_mouse_set(QemuConsole *c, int x, int y, int on) +void dpy_mouse_set(QemuConsole *c, int x, int y, bool on) { QemuGraphicConsole *con = QEMU_GRAPHIC_CONSOLE(c); DisplayState *s = c->ds; diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 5490088043..a54123acea 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -726,7 +726,7 @@ static void dbus_gfx_switch(DisplayChangeListener *dcl, } static void dbus_mouse_set(DisplayChangeListener *dcl, - int x, int y, int on) + int x, int y, bool on) { DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl); diff --git a/ui/gtk.c b/ui/gtk.c index 93b13b7a30..bc29f7a1b4 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -446,7 +446,7 @@ static GdkDevice *gd_get_pointer(GdkDisplay *dpy) } static void gd_mouse_set(DisplayChangeListener *dcl, - int x, int y, int visible) + int x, int y, bool visible) { VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl); GdkDisplay *dpy; diff --git a/ui/sdl2.c b/ui/sdl2.c index 0a0eb5a42d..98ed974371 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -49,7 +49,7 @@ static int gui_grab_code = KMOD_LALT | KMOD_LCTRL; static SDL_Cursor *sdl_cursor_normal; static SDL_Cursor *sdl_cursor_hidden; static int absolute_enabled; -static int guest_cursor; +static bool guest_cursor; static int guest_x, guest_y; static SDL_Cursor *guest_sprite; static Notifier mouse_mode_notifier; @@ -729,7 +729,7 @@ void sdl2_poll_events(struct sdl2_console *scon) } static void sdl_mouse_warp(DisplayChangeListener *dcl, - int x, int y, int on) + int x, int y, bool on) { struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl); diff --git a/ui/spice-display.c b/ui/spice-display.c index 8a8472d029..c794ae0649 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -254,7 +254,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) static SimpleSpiceCursor* qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd, QEMUCursor *c, - int on) + bool on) { size_t size = c ? c->width * c->height * 4 : 0; SimpleSpiceCursor *update; @@ -448,7 +448,8 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, qemu_mutex_lock(&ssd->lock); if (ssd->cursor) { g_free(ssd->ptr_define); - ssd->ptr_define = qemu_spice_create_cursor_update(ssd, ssd->cursor, 0); + ssd->ptr_define = + qemu_spice_create_cursor_update(ssd, ssd->cursor, false); } qemu_mutex_unlock(&ssd->lock); } @@ -476,7 +477,7 @@ void qemu_spice_cursor_refresh_bh(void *opaque) ssd->mouse_x = -1; ssd->mouse_y = -1; qemu_mutex_unlock(&ssd->lock); - dpy_mouse_set(ssd->dcl.con, x, y, 1); + dpy_mouse_set(ssd->dcl.con, x, y, true); } else { qemu_mutex_unlock(&ssd->lock); } @@ -747,7 +748,7 @@ static void display_refresh(DisplayChangeListener *dcl) } static void display_mouse_set(DisplayChangeListener *dcl, - int x, int y, int on) + int x, int y, bool on) { SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); @@ -774,7 +775,7 @@ static void display_mouse_define(DisplayChangeListener *dcl, g_free(ssd->ptr_move); ssd->ptr_move = NULL; g_free(ssd->ptr_define); - ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, 0); + ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, false); qemu_mutex_unlock(&ssd->lock); qemu_spice_wakeup(ssd); } diff --git a/ui/vnc.c b/ui/vnc.c index dd530f04e5..dae5d51210 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -981,7 +981,7 @@ int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h) } static void vnc_mouse_set(DisplayChangeListener *dcl, - int x, int y, int visible) + int x, int y, bool visible) { /* can we ask the client(s) to move the pointer ??? */ } From patchwork Tue Jul 16 18:09:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812788 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp436176wrr; Tue, 16 Jul 2024 11:12:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXFEeMj/hx8pXjxsesywpnVNGdMIQFX+4qTdBES3thZ3Py4wrmkFWqTX8gkcqdXMR85iCwiJUiCD2edTcTtUH96 X-Google-Smtp-Source: AGHT+IG6YSFzwa24phArb96ZeU5Z7noehVR8aUVbYdgAjTBbJOv9hBvM7UuNiTZIEfcI3Yz+v1Bg X-Received: by 2002:a05:620a:2585:b0:79f:1841:e5e2 with SMTP id af79cd13be357-7a17b6da7ddmr397465085a.41.1721153575392; Tue, 16 Jul 2024 11:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153575; cv=none; d=google.com; s=arc-20160816; b=c/QVpJLbN9FwwZ76KFO2zZp2Xh3I+gy8ocjyEeaJOXlggkALeWmN+yDxJKo30lQtkT 1uXMNkRpkoR6MKsaPTPCMGxdfWYra7HNL5i8GCA6TrXUqrSjxemrlEDs9C2tugXUhcEV KNlBWVaQsnvBMBu9zZabEEf72GxqCYc6EnYAs4YR9DJ+dubovtH1jQvks1+Qig6ya368 xFiGtnNwwt2qsM/BULM64Ej0KRAMqx6byWKRA3xHgQWkVctTfnT8hGQYFwn0iqUdBb1E WhECMb6M3Zq/PYeXLLhGQWfKVorM4N5INmd+5JrBI+5i6Yg79UYnku+nDE31mizfWLOa 9zbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=T0D9AUY7gUeEKLy7Uo83BX14QqkvgyIU5b+p9IGxUa0=; fh=wiKz0x7qvKwceerDkCg/vXelUIS3VMX4wuMEccF/XUs=; b=uFbK4Gild+Y5dJ6HKNLVH6QR1SzrB2TKDyrpWCBe/b7qwR9N3Mb98FAdaun1yFtkLU UpXpoIGFiHiibbIRxkRYFZ75LN2cgXZbRszmzyhBMhZOnh+1Ql45N07LrU+43HVpXtUX t8Cc1Ytz1DqJiEbGBLLfQGzhQUIEFhEtVTjH8RVuoLEpg4/6i1DNUZLqakpxfMmzxpM4 rB0We+ZskOAkvIQ63oxQ7j+6Z5AHjoW3RTmu4d80+5HyhTpdrrzb6eqVYgkIUAY1aHrs BnXx/dQBjaTY2sPVIUuwP72Lz2Cq2hliYTjjNLbxy713QyOGIC7Xak1oFzpPGy3xuUWw bH9A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xMZRMUsU; 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 af79cd13be357-7a160c69393si814762685a.441.2024.07.16.11.12.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:12:55 -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=xMZRMUsU; 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 1sTme5-0004sc-28; Tue, 16 Jul 2024 14:11:25 -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 1sTmdQ-0001hF-47 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:49 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmdN-0001JG-45 for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:43 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-426526d30aaso41300645e9.0 for ; Tue, 16 Jul 2024 11:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153439; x=1721758239; 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=T0D9AUY7gUeEKLy7Uo83BX14QqkvgyIU5b+p9IGxUa0=; b=xMZRMUsUoZL4CDu/F41+r6OT67G0ebFBV5WgA+EOisZeQpaMHPg8ZZ4fqM7V3+XyA4 OcZ2HfmtvMibu7mrY+6Sj5E2qXjjjjDEDzfO3xI0p/wQY5Du+7sxp2kFuO7VxKWYeho0 jsHMfFpTlBcZSsvECthJ7HRt6iY5sWWRBfmiWk5omw/J8xOcR9Ly4EVRrfmy+PZrRlxx jo9BzOzqliBUKlCiF2qMb7X8ej1Y7YZhaFC6rC+Zss0PI3NC9LZvzFBshtbNZs6otl1w W1J6ECkoYYxEFunBLNydHaG7ZC3t+NAfwui3PsHnB9HxsyYPW6nThcV3PTewN/Ky0t3C 7dBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153439; x=1721758239; 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=T0D9AUY7gUeEKLy7Uo83BX14QqkvgyIU5b+p9IGxUa0=; b=fwcKPm5MU1Nb8DKMXSeKJ39WAJWjJ6+XszYYMZx65EAY0Hjh3WvzxVJUm2iTdprj5N Hh6NuFSS0E7WJGTjjmiK0jVtFH30IjnJ9dwM9ikCQlQcHmzhF2JvOsVHmQ7Y5Um/S0Om GiWIeg9kVy9xxJbpS/GnmSaWPCTW+MTTcJ1YFlgr7YNObyw0dJtyWFMl2VPvMUXyvWXi 9Tgbh6yX4fSHbLLaaBRagi9Z+iGYriM3ldu1UwNOWG0EzbOUF8H0ypm/w+ZaepCq2AEm tgbAZk1jhj8wPF/7pFfAFSYur67IeGaRhou+3B62YwfC4IBvR0KO/r1H9+P1ZK3ng/0L xG2A== X-Gm-Message-State: AOJu0YwK2VFVbQMiJ37cC2bCExTpInyqiQfg+OUHGO2Lkgns/3gEFwEg YBt6CNBdV4db/u5HbPK+v48RHvPAfhUecWbP2my/Gmokk15UacgQ+VHhoh7NamisHXF0wTLusp1 iI9l96w== X-Received: by 2002:a05:600c:3b0f:b0:426:6fd3:1547 with SMTP id 5b1f17b1804b1-427ba654e7amr19745035e9.2.1721153438966; Tue, 16 Jul 2024 11:10:38 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427a5e8266asm137898735e9.13.2024.07.16.11.10.37 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , Phil Dennis-Jordan , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 10/13] ui/cocoa: Add cursor composition Date: Tue, 16 Jul 2024 20:09:37 +0200 Message-ID: <20240716180941.40211-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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: Akihiko Odaki Add accelerated cursor composition to ui/cocoa. This does not only improve performance for display devices that exposes the capability to the guest according to dpy_cursor_define_supported(), but fixes the cursor display for devices that unconditionally expects the availability of the capability (e.g., virtio-gpu). The common pattern to implement accelerated cursor composition is to replace the cursor and warp it so that the replaced cursor is shown at the correct position on the guest display for relative pointer devices. Unfortunately, ui/cocoa cannot do the same because warping the cursor position interfers with the mouse input so it uses CALayer instead; although it is not specialized for cursor composition, it still can compose images with hardware acceleration. Co-authored-by: Phil Dennis-Jordan Tested-by: Phil Dennis-Jordan Signed-off-by: Akihiko Odaki Message-ID: <20240715-cursor-v3-3-afa5b9492dbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé --- meson.build | 3 +- ui/cocoa.m | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 6a93da48e1..a1e51277b0 100644 --- a/meson.build +++ b/meson.build @@ -1070,7 +1070,8 @@ if get_option('attr').allowed() endif endif -cocoa = dependency('appleframeworks', modules: ['Cocoa', 'CoreVideo'], +cocoa = dependency('appleframeworks', + modules: ['Cocoa', 'CoreVideo', 'QuartzCore'], required: get_option('cocoa')) vmnet = dependency('appleframeworks', modules: 'vmnet', required: get_option('vmnet')) diff --git a/ui/cocoa.m b/ui/cocoa.m index 79a054b128..4c2dd33532 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #import +#import #include #include "qemu/help-texts.h" @@ -79,12 +80,16 @@ static void cocoa_switch(DisplayChangeListener *dcl, DisplaySurface *surface); static void cocoa_refresh(DisplayChangeListener *dcl); +static void cocoa_mouse_set(DisplayChangeListener *dcl, int x, int y, bool on); +static void cocoa_cursor_define(DisplayChangeListener *dcl, QEMUCursor *cursor); static const DisplayChangeListenerOps dcl_ops = { .dpy_name = "cocoa", .dpy_gfx_update = cocoa_update, .dpy_gfx_switch = cocoa_switch, .dpy_refresh = cocoa_refresh, + .dpy_mouse_set = cocoa_mouse_set, + .dpy_cursor_define = cocoa_cursor_define, }; static DisplayChangeListener dcl = { .ops = &dcl_ops, @@ -308,6 +313,11 @@ @interface QemuCocoaView : NSView BOOL isAbsoluteEnabled; CFMachPortRef eventsTap; CGColorSpaceRef colorspace; + CALayer *cursorLayer; + QEMUCursor *cursor; + int mouseX; + int mouseY; + bool mouseOn; } - (void) switchSurface:(pixman_image_t *)image; - (void) grabMouse; @@ -364,6 +374,12 @@ - (id)initWithFrame:(NSRect)frameRect #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_14_0 [self setClipsToBounds:YES]; #endif + [self setWantsLayer:YES]; + cursorLayer = [[CALayer alloc] init]; + [cursorLayer setAnchorPoint:CGPointMake(0, 1)]; + [cursorLayer setAutoresizingMask:kCALayerMaxXMargin | + kCALayerMinYMargin]; + [[self layer] addSublayer:cursorLayer]; } return self; @@ -382,6 +398,8 @@ - (void) dealloc } CGColorSpaceRelease(colorspace); + [cursorLayer release]; + cursor_unref(cursor); [super dealloc]; } @@ -426,6 +444,72 @@ - (void) unhideCursor [NSCursor unhide]; } +- (void)setMouseX:(int)x y:(int)y on:(bool)on +{ + CGPoint position; + + mouseX = x; + mouseY = y; + mouseOn = on; + + position.x = mouseX; + position.y = screen.height - mouseY; + + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + [cursorLayer setPosition:position]; + [cursorLayer setHidden:!mouseOn]; + [CATransaction commit]; +} + +- (void)setCursor:(QEMUCursor *)given_cursor +{ + CGDataProviderRef provider; + CGImageRef image; + CGRect bounds = CGRectZero; + + cursor_unref(cursor); + cursor = given_cursor; + + if (!cursor) { + return; + } + + cursor_ref(cursor); + + bounds.size.width = cursor->width; + bounds.size.height = cursor->height; + + provider = CGDataProviderCreateWithData( + NULL, + cursor->data, + cursor->width * cursor->height * 4, + NULL + ); + + image = CGImageCreate( + cursor->width, //width + cursor->height, //height + 8, //bitsPerComponent + 32, //bitsPerPixel + cursor->width * 4, //bytesPerRow + colorspace, //colorspace + kCGBitmapByteOrder32Little | kCGImageAlphaFirst, //bitmapInfo + provider, //provider + NULL, //decode + 0, //interpolate + kCGRenderingIntentDefault //intent + ); + + CGDataProviderRelease(provider); + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + [cursorLayer setBounds:bounds]; + [cursorLayer setContents:(id)image]; + [CATransaction commit]; + CGImageRelease(image); +} + - (void) drawRect:(NSRect) rect { COCOA_DEBUG("QemuCocoaView: drawRect\n"); @@ -2015,6 +2099,21 @@ static void cocoa_refresh(DisplayChangeListener *dcl) [pool release]; } +static void cocoa_mouse_set(DisplayChangeListener *dcl, int x, int y, bool on) +{ + dispatch_async(dispatch_get_main_queue(), ^{ + [cocoaView setMouseX:x y:y on:on]; + }); +} + +static void cocoa_cursor_define(DisplayChangeListener *dcl, QEMUCursor *cursor) +{ + dispatch_async(dispatch_get_main_queue(), ^{ + BQL_LOCK_GUARD(); + [cocoaView setCursor:qemu_console_get_cursor(dcl->con)]; + }); +} + static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; From patchwork Tue Jul 16 18:09:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812779 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435726wrr; Tue, 16 Jul 2024 11:11:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXLkpgVKmBTfDtJ6c8zIuPFOQWk4SArLf+eSRf14Eg0Is4+K0ucEEFRasBmRmRANEQ68IR0VeBgTqf8MIxg7Tsu X-Google-Smtp-Source: AGHT+IHJekXYuC8ViCWxAezNO+SkQ4HbwJn2qamIX4Jc2PMMb1G5mps3MhX32ubZXDi/ZEnx05fq X-Received: by 2002:a05:620a:29d1:b0:79c:f0e:f7ac with SMTP id af79cd13be357-7a17b6cdc29mr293733985a.28.1721153503905; Tue, 16 Jul 2024 11:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153503; cv=none; d=google.com; s=arc-20160816; b=VyxbZhmIEVeXyKa5/7Tosw9D8M6eEmVFRpmZ90R0Yded1+dT7R9RTenuXINDsoYTAR h5Fd1Zw4ASUUSXnsa2Wo2PfK0Pyt71xas/PZcGuH91hQUDmyCj8W6lxnwCVNrsEpdXm6 N731QkQGRdirZksOPpZ8Tkodb1qL6kfWJc2GpG7xlXjA8E2pmdnFniOuvzjgpvDA34xq BAzGBXObCYvHkE6rkmRb1yOF+yqLtt8EqjQUIiMcjc+/y95QDEf3iddiS3/6ySNoryNg BH6PX5gA/LL784Aqbn5Gk+BZv3FD3dmaJzJrUXDPWQ837oXIhhvqOguAsG1UHwsAGXYn NNhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=oPwMKRXBS8MyVAS8Asd2KzqkL8mMuPjVu/RXCe/87vw=; fh=oruLLm9I2y68+yMpiQR2p6Zt44/DCmjsZcQJB5D1un0=; b=ZiWuuZwle9JjojDJcbc0vtNCoPnE1o92O5T0VTQlhoCb1M5vnkGlTEjki5hKORuwLb W7zV01o96yjUOd32IYeZfPaNalAKS9Y5+ohyYIUwcHH/cfrFHhM+ep0ewirXS94z612n HCHAnW7MCoc62ck2wuP/498zpltzuj+MpBP8tZ0D7d1ys6rKiza9Tqtns/W4TnTGUJv1 TPuXm4Fx2NYm1RtTkjmnRUp+sEcp7hjJbJcCsAQvYr+i1pm/EseWEzcI/QtYUOCnQo8E HuDfuxmBFI/BCdxZUvjq8GdYyHN+nfhnbFrVRP8KbfzQ1zFwdwSb0/ZTrYJ6crZTZiJo dCXA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uViokpyN; 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 af79cd13be357-7a160c49da7si808949185a.339.2024.07.16.11.11.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:11:43 -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=uViokpyN; 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 1sTme8-0005Se-11; Tue, 16 Jul 2024 14:11:28 -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 1sTmdV-00024C-Ac for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:51 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmdS-0001Jm-7a for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:48 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4257d5fc9b7so46458345e9.2 for ; Tue, 16 Jul 2024 11:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153444; x=1721758244; 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=oPwMKRXBS8MyVAS8Asd2KzqkL8mMuPjVu/RXCe/87vw=; b=uViokpyN300etDlrmR1YMqz/MNQJa6g9Ny1E4sx9+bvTlExBRIFFVPFml4lv1J/Ww8 WL9Wl0MnKFg5Vv5qkkPq1wmKP64ZZakPs/STu7+EkD7xLm4QxLIgaYPHBIbJkoG3ekRa iVDzuRS/NZWvOW8ABLvL+Nm5orhl5nOclwpbmYMImEB5TwOY7IyzV/MpbDRe2LLTORoS WDxPwE2mx+pLkxxIhje6R53EV8nhYHGT64ob7/y6K4Xm54j9kQLdZxtyB48fgk28K62j yGwsvQ1Q+XnaLdjJUmf+4dMh0jwbHU5Shibs5O/MdBPioWL6GzwRKpn+GSUmVYa5Qgw3 6F3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153444; x=1721758244; 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=oPwMKRXBS8MyVAS8Asd2KzqkL8mMuPjVu/RXCe/87vw=; b=dqymLERuwfRqL0UkIK/9cbiMwLZsbguiKla1FhFx7CHvKuT+nifOmuPOcA24fetdA1 xzlPK57+BXgAqk5YYB4CLaPPrQ5xWrLOtIKC7nB/mJ+mNGVn76Lsx5xMHb3FCpMgrUh+ dJIP3c5oEECo0KoyTUvFrJOkyhUk36Hhzo8gpzuzCJF+fIyj5KnvrBRoJsyaqINMfF7r 6eAQ/jzzMvf0rV75FFzidkRUBDRl/n6h33exH6KDY1QDUerrNHAncwsSYysE2ibeCA/U HRNofYCPvN3hsL55CWpL3sFlaE69CX/+OE7pcDhnh9hx/j1hK+WBVnYXBg9pDe5EinSv oa1g== X-Gm-Message-State: AOJu0YzVAQgjtjYdTDMKqNGviFVlDIJFwuEKSbdZ/gejl2EqOWZa7xYu g3lKZjia+1j62l4HA62o5rIdRnRswyTDf2BSyFqdCRKGR/uha3EdZ6DAQzyiSh+lCGGae0Kbb2p QdY934g== X-Received: by 2002:a05:600c:35c7:b0:425:64c5:5780 with SMTP id 5b1f17b1804b1-427ba64e216mr28107175e9.1.1721153444384; Tue, 16 Jul 2024 11:10:44 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4279f2d74d5sm175755225e9.46.2024.07.16.11.10.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Akihiko Odaki , =?utf-8?q?Marc-Andr=C3=A9_Lure?= =?utf-8?q?au?= , Phil Dennis-Jordan , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PULL 11/13] ui/console: Remove dpy_cursor_define_supported() Date: Tue, 16 Jul 2024 20:09:38 +0200 Message-ID: <20240716180941.40211-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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: Akihiko Odaki Remove dpy_cursor_define_supported() as it brings no benefit today and it has a few inherent problems. All graphical displays except egl-headless support cursor composition without DMA-BUF, and egl-headless is meant to be used in conjunction with another graphical display, so dpy_cursor_define_supported() always returns true and meaningless. Even if we add a new display without cursor composition in the future, dpy_cursor_define_supported() will be problematic as a cursor display fix for it because some display devices like virtio-gpu cannot tell the lack of cursor composition capability to the guest and are unable to utilize the value the function returns. Therefore, all non-headless graphical displays must actually implement cursor composition for correct cursor display. Another problem with dpy_cursor_define_supported() is that it returns true even if only some of the display listeners support cursor composition, which is wrong unless all display listeners that lack cursor composition is headless. Reviewed-by: Marc-André Lureau Reviewed-by: Phil Dennis-Jordan Signed-off-by: Akihiko Odaki Message-ID: <20240715-cursor-v3-4-afa5b9492dbf@daynix.com> Signed-off-by: Philippe Mathieu-Daudé --- include/ui/console.h | 1 - hw/display/qxl-render.c | 4 ---- hw/display/vmware_vga.c | 6 ++---- ui/console.c | 13 ------------- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 82b573e680..fa986ab97e 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -324,7 +324,6 @@ void dpy_text_update(QemuConsole *con, int x, int y, int w, int h); void dpy_text_resize(QemuConsole *con, int w, int h); void dpy_mouse_set(QemuConsole *con, int x, int y, bool on); void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor); -bool dpy_cursor_define_supported(QemuConsole *con); bool dpy_gfx_check_format(QemuConsole *con, pixman_format_code_t format); diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c index 8daae72c8d..335d01edde 100644 --- a/hw/display/qxl-render.c +++ b/hw/display/qxl-render.c @@ -307,10 +307,6 @@ int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext) return 1; } - if (!dpy_cursor_define_supported(qxl->vga.con)) { - return 0; - } - if (qxl->debug > 1 && cmd->type != QXL_CURSOR_MOVE) { fprintf(stderr, "%s", __func__); qxl_log_cmd_cursor(qxl, cmd, ext->group_id); diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 512f224b9f..3db3ff98f7 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -904,10 +904,8 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address) caps |= SVGA_CAP_RECT_FILL; #endif #ifdef HW_MOUSE_ACCEL - if (dpy_cursor_define_supported(s->vga.con)) { - caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | - SVGA_CAP_CURSOR_BYPASS; - } + caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | + SVGA_CAP_CURSOR_BYPASS; #endif ret = caps; break; diff --git a/ui/console.c b/ui/console.c index 8e9cc1628a..e8f0083af7 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1001,19 +1001,6 @@ void dpy_cursor_define(QemuConsole *c, QEMUCursor *cursor) } } -bool dpy_cursor_define_supported(QemuConsole *con) -{ - DisplayState *s = con->ds; - DisplayChangeListener *dcl; - - QLIST_FOREACH(dcl, &s->listeners, next) { - if (dcl->ops->dpy_cursor_define) { - return true; - } - } - return false; -} - QEMUGLContext dpy_gl_ctx_create(QemuConsole *con, struct QEMUGLParams *qparams) { From patchwork Tue Jul 16 18:09:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812787 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp436168wrr; Tue, 16 Jul 2024 11:12:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW8TC/SusOxm5tBqlDRjFTxDXaz886oUckLMGEKQc9SEXPhQUYr3O3K53GmIfdz5256h+0IiV01yqcVreEUF+O5 X-Google-Smtp-Source: AGHT+IGj6f86UOoTTZLYBXvBNfcHuQp+zU0EDsbebwphI2k6xfz7lN7bveqDLmfKgxQPlNhybV2+ X-Received: by 2002:a05:620a:1a93:b0:79f:913:8109 with SMTP id af79cd13be357-7a17b690f3fmr375636385a.36.1721153574299; Tue, 16 Jul 2024 11:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153574; cv=none; d=google.com; s=arc-20160816; b=kbAjsYkxcmgs6Y33EuXV7saUjUpC29sVc+sWZ6WmDC4KyUfEPB+XBeIvjnqVUMD/X6 YQv8tmfULx7EwochmLb8l1M3DfouMWIA4KD6sdw/xXHj7OmuaF+9l9bnb4LUhczTqEUv C+X5wM8AAucR31Q16JlZKd5dWqs58QH6eg9uqeAiKNHhQIKRYCn2XLiRRCag/aECPFIC oUB+JcGw2rMIp59QDveZ0gH+lo3WxH8fwHDmsrsQXzK/nlweavGmqrn7IwGnAEJDq9vA JO6uWrIEYozmggoU9nqtyO7HtBbhOa28RI2FumQLMMiSL2lNERH5er7ncteUDU3/H7ar k1XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=VrGZmaUNm2C+uivQuRjRJj4n0srykunZLqWSf7H3M6M=; fh=Fd6aBa0kjgdlhrvDwFUbt95hlpkQS/dn/+AD99bFGaA=; b=LGWJe5fHxMB07wt9nL29cDDngRs4VW+sR8Zi280J6/86gY84dWA3HzWwgM460sBw8o RQI42zqAxL/EXLMIrd4VrJKrff2OQaxI+Pxdfvw8BiMLyZD/ThJ6ZfqhbYHHO9AKVmiS xw12s0DlwWF8L7ebsjEVTe9AJ91Pog14iOYVQ0FviTNoAKEVegg/DMXdv5EgfApkRUC4 /iCvAbxzbA3SfLS78im69YIooFjqX7r21uRxVCsHInhkfDJLwJBxcFUDh8Sy4WWucPp1 /R4G7dojrtpKgI9/GACX0FfBbZ/TiolWrxoQSQbedlx5HrSku433z9CyacJGQbRwxn7N t0gw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UVqfVx5Z; 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 af79cd13be357-7a160b7be2asi798925185a.47.2024.07.16.11.12.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:12:54 -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=UVqfVx5Z; 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 1sTme5-0004zS-Bc; Tue, 16 Jul 2024 14:11:25 -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 1sTmdZ-0002OD-8U for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:56 -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 1sTmdX-0001KC-Kk for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:10:53 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4265b7514fcso51435e9.1 for ; Tue, 16 Jul 2024 11:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153449; x=1721758249; 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=VrGZmaUNm2C+uivQuRjRJj4n0srykunZLqWSf7H3M6M=; b=UVqfVx5Zg6JYYbRebn4ohEijgCGxs5yB9k2K8PL4rCDqdC3n9p74bB0sKCM9zudST8 viJsVAlHC+Jo8S6ozM4Sc8jfrvdc961X2hzOdY8ppPN/aTFgCLe6DuoVTPY7p4vVh4JK X6Ujdvln6bIlpsmIaYOX1vHCeI3/6Ac310eOgC6zhPYWTcv5231gVwqElDq1WgZNPS7b ZhiNgtldmsQLuKUGjpzpGXV4IzWhGINto6Pfq27S63V79oBbCIsnewx4wBvEvjEJnxYX PIblKPIIMYqHZfwDckRkJNe7dkRUzpHTtXLe3P0Ziw2WcSLQ3beJ2/0MnEqsFdzsbbn/ xpsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153449; x=1721758249; 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=VrGZmaUNm2C+uivQuRjRJj4n0srykunZLqWSf7H3M6M=; b=eQ6jFrfQtuKoS5gvyJvIx77cqZe1/ZgGBYDw2JuBsXDPXAs4LH759XczivNdTv0gyr QdQoSa8JPLeVTPDP4/WmrrscE8n2RcZGwlAEkj059zxpSbRdcF+fqaKtl8tzIcjKaoHq XxFr8LLvs7vQjh8gMppwh9TrQvzVK4VtgzSXlPF5iZ4/tREYnd0Q8la/PwhZgTnAhFdu NP+swPkcs97ncHM5HtYrJcrpSRKktHKHS0y9iTlsfcy7qbBrHvaWWroblhfUXQBdzope Ngmn9eqWutyJEFzXjW/WWqfh2gLyBFzT/ZzeQGmpqpkbkZHfKIJRUYfwCc0MNQ5WC6KZ Fg6g== X-Gm-Message-State: AOJu0YwQv/ZxHljAFt5ZzUy8s6tE6lsTRMLBXkWnxfIh2O+BIE/Q3q0w yBEihhA9j2VMnmFWYLFiJC8Or5C9xa9LF8XHBH3rNoOSp71d1j6doGijyB946wFRW+gSMsQ4ppE 776TjmA== X-Received: by 2002:a05:600c:310c:b0:426:5cc7:82f with SMTP id 5b1f17b1804b1-427bb8c4cebmr20400235e9.13.1721153449549; Tue, 16 Jul 2024 11:10:49 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dabf15dsm9745401f8f.32.2024.07.16.11.10.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:49 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 12/13] vl: fix "type is NULL" in -vga help Date: Tue, 16 Jul 2024 20:09:39 +0200 Message-ID: <20240716180941.40211-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@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: Marc-André Lureau Don't pass NULL to module_object_class_by_name(), when the interface is unavailable. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Message-ID: <20240715114420.2062870-1-marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- system/vl.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/system/vl.c b/system/vl.c index bdd2f6ecf6..9e8f16f155 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1000,9 +1000,16 @@ static bool vga_interface_available(VGAInterfaceType t) const VGAInterfaceInfo *ti = &vga_interfaces[t]; assert(t < VGA_TYPE_MAX); - return !ti->class_names[0] || - module_object_class_by_name(ti->class_names[0]) || - module_object_class_by_name(ti->class_names[1]); + + if (!ti->class_names[0] || module_object_class_by_name(ti->class_names[0])) { + return true; + } + + if (ti->class_names[1] && module_object_class_by_name(ti->class_names[1])) { + return true; + } + + return false; } static const char * From patchwork Tue Jul 16 18:09:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 812780 Delivered-To: patch@linaro.org Received: by 2002:a5d:42c4:0:b0:367:895a:4699 with SMTP id t4csp435729wrr; Tue, 16 Jul 2024 11:11:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW3fy/sO3/Cb+wIGrEbg5DDqE+4LnbOoP9Q9ZwlkMT1bmsrjwiMS/tAhst62KVPYHc1uw6zLcxyYElGbDszmwgV X-Google-Smtp-Source: AGHT+IH7OZ5ZPrSQP2we3ZI49f50n22fQcWidB2FmQ97zPJj2OSkj4okFKv+ct5ZR03lehWOewI4 X-Received: by 2002:a05:6902:2609:b0:e03:5369:5196 with SMTP id 3f1490d57ef6-e05d57b96aemr3833197276.43.1721153504564; Tue, 16 Jul 2024 11:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721153504; cv=none; d=google.com; s=arc-20160816; b=etRmAw0nb+k/pt90IrYK8wjol4g+wcm3PWZY3poPVuqNH80Ez8SEdcD7pUCEgh6MSQ dZbrBZEFlHaKUp/OXnOeAc0113JKVL3vQ4K1w+hKnCqGm/NnI/GCoNiZwsQ2QJ4hkPuQ 0AMWjaI2419bdr9y20s9c5pocfDuLKx596mZ2qMpUU1yab78JtmRZfPn/0C4zgzLMPhV +EzFd/eOzojAqyDjBWtUaMLiysYvFt5rkrXZD0MmvN2niCZzevy1Cu+sE0Urv5w5yUp5 2eW9VdYW+qa1gtpdnkUt7OwWqk5aJc0+HzJDOKoCiX9ZN1d9eXy68V9VSh/VhytGC8lL c/6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=AsnfcUgakDS94yBAG2Ho01nyvEXdce5IphgHAtL+bDo=; fh=NfNS77YVLLMqwQzNjSO0AClnbWF4cUMVDIMYIlhtGaU=; b=t6jP8LqbX7GTVNhhVTIKkG8fcZWynAR2/w8nydLdYv+N8d5D4Z3tl6Y95yyv2tqj82 BuKA8fL58ZKPUJIL0hRE+yOTNFPDS9ZGi9RiwPki9ZNeymX2HT99Bt2WOChfsXKJQ8tB RWl0yCL8uxkWIOhlfRoRilLsQlxWQ6s9zV2i7r1frFxc6DLRqPQ6ctOsTHUmAyO7AbTt AZhplIoSVlRfiIpgj10V9jg7bkiNHXPkVblGL0wJzItJ67eDb5M5WJoQZsmSYtYPeMfr DL5sKt2yLHfdDsDmT6dRmKwnnDJXip+bQu0GQ0bLYNzvk9yiStClPpEV23d6a0ZX6BAm xPpw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jQ/J/e57"; 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 6a1803df08f44-6b7619503cdsi79484316d6.88.2024.07.16.11.11.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jul 2024 11:11:44 -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="jQ/J/e57"; 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 1sTme9-0005ix-9n; Tue, 16 Jul 2024 14:11:30 -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 1sTmdo-0003Uy-Qf for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:11:11 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTmdc-0001Ke-Qs for qemu-devel@nongnu.org; Tue, 16 Jul 2024 14:11:01 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-426717a2d12so133635e9.0 for ; Tue, 16 Jul 2024 11:10:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721153455; x=1721758255; 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=AsnfcUgakDS94yBAG2Ho01nyvEXdce5IphgHAtL+bDo=; b=jQ/J/e57ZkWb2u+iznDsi7Hwza7A0P1ONiJoEL4NOXtEdv+/RkhgUoKndP43vRNjwY club/9CJGHVfZ+O0tTU9LMG6MaCI8RGLbGsr6NH07j3IqR57eAprqelv5mzEB3hhK7vX wkcVRkfC+s2Tbh8/y4uHvjfF9CNHyCYtU3rBvSpkfFYzkLo0+j0Ab/+CLI09PWLiup+/ bjJLcKRXrBBDASxSVctJOKOsann/2uubKWc9GULJ2dc2D3h8V9Dl3nKUs7sjcR5Lx84E 9eR5R0vKo/GJ0iDpoo74/CSARMFzoBJ3XsqKB8xFK7+zYVtJ7SljGYynI/HWPRIQdOUw J9RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721153455; x=1721758255; 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=AsnfcUgakDS94yBAG2Ho01nyvEXdce5IphgHAtL+bDo=; b=Fb1HlIovQVlcwTYshwgh+nGQzfWWYmDUmnnMss1238Lrio+4St0UQuVTsKIZM497WW mkV4ce8su3u6lbRwePazw0syzfSLBUz9zEXnJvMtzFauavVHS/WSHhwhWDvmuJsVigG6 AKoTjjhPf0JJkrqPy3BMNW0R7BuslyeQkBYpck5YE79G4ar21l7Kr45eZ9f0VOvzSNhJ SAD86+O40fdbHAJf4qc8FcoSh5phYxIsvC2BB1sYNOCnEGgtvl3aSer7SkkOw27R1eb9 SpcdQ8P2XamQewevenKTobzZVb4bB/boOmMvso1egEzpB61/E651nyiRnDMuL4Ksqyvb zIfQ== X-Gm-Message-State: AOJu0Yzl+dImQxdzDGPNyzm8YDvCWZaHUV1fwhnJTpK4P61GyYl7G8xb VrmP/IlH+QJCLkf0uH5HHE9wDsG+Sei0cf3GQHTt3uwuPi6Bx3UwWsiyuJ4KSmTgGlE5idB5L+Q FAokV/g== X-Received: by 2002:a05:600c:444c:b0:426:5c36:f57a with SMTP id 5b1f17b1804b1-427bb8c508dmr20281685e9.14.1721153454921; Tue, 16 Jul 2024 11:10:54 -0700 (PDT) Received: from localhost.localdomain ([176.187.209.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427a5edb489sm137531985e9.37.2024.07.16.11.10.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 16 Jul 2024 11:10:54 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Zhenzhong Duan , =?utf-8?q?Philippe_Mathieu-Da?= =?utf-8?q?ud=C3=A9?= , David Hildenbrand Subject: [PULL 13/13] system/physmem: use return value of ram_block_discard_require() as errno Date: Tue, 16 Jul 2024 20:09:40 +0200 Message-ID: <20240716180941.40211-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240716180941.40211-1-philmd@linaro.org> References: <20240716180941.40211-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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: Zhenzhong Duan When ram_block_discard_require() fails, errno is passed to error_setg_errno(). It's a stale value or 0 which is unrelated to ram_block_discard_require(). As ram_block_discard_require() already returns -EBUSY in failure case, use it as errno for error_setg_errno(). Fixes: 852f0048f3ea ("make guest_memfd require uncoordinated discard") Signed-off-by: Zhenzhong Duan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: David Hildenbrand Message-ID: <20240716064213.290696-1-zhenzhong.duan@intel.com> Signed-off-by: Philippe Mathieu-Daudé --- system/physmem.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index 2154432cb6..9a3b3a7636 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -1845,11 +1845,14 @@ static void ram_block_add(RAMBlock *new_block, Error **errp) } if (new_block->flags & RAM_GUEST_MEMFD) { + int ret; + assert(kvm_enabled()); assert(new_block->guest_memfd < 0); - if (ram_block_discard_require(true) < 0) { - error_setg_errno(errp, errno, + ret = ram_block_discard_require(true); + if (ret < 0) { + error_setg_errno(errp, -ret, "cannot set up private guest memory: discard currently blocked"); error_append_hint(errp, "Are you using assigned devices?\n"); goto out_free;