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: 13734731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61EE4C3DA59 for ; Tue, 16 Jul 2024 18:10:28 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IEKkaHmsJNvgtJPh1NAzyJERJ2LC57+in97IzNkfAUXYvu3XPwo79A9B2TCdTdUNqq+Fa11ig== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734732 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73148C3DA59 for ; Tue, 16 Jul 2024 18:10:39 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IHeY//i6i+4+LVB7X+fP70swhnOlP7YBFgtHGFe24micFKjeRpqhDhL3Lrije1qB/czoa14QQ== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4537C3DA49 for ; Tue, 16 Jul 2024 18:11:44 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IEg7ym5iqLUHL73R2Cl4lUWDkJMUjemVYHWCt4e2ED0JWyoShqoZhzNTCFCK4J4PBIPGkhh+g== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54EFBC3DA49 for ; Tue, 16 Jul 2024 18:11:55 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IHdodhoA0epDnnbqGTqdUBk0g1Gjnb+TH1mQmnHijHygTUmTo6CrO2Zqrh09qatHzq0zS4aBA== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB129C3DA59 for ; Tue, 16 Jul 2024 18:12:53 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IHuaSKGAxkkhcc+BX8GYIpzsfDHUx19p+2EsFnI5Q9kTQ1kcf7jaOLGlTjANzhZBPHKs9WCBQ== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9C15BC3DA5D for ; Tue, 16 Jul 2024 18:11:56 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IG7hb9GySRVSkBP7ow1KqrpAE8f5R/t8WpXPajvnPY9tJMGGUSQlUMbV4rgB+uDvn+Jj1GhYw== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 720ACC3DA49 for ; Tue, 16 Jul 2024 18:10:46 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IGinRStQMPx7r0CBECg1tXMB+C0IDJCyxIMs1DD9xr+UlnjGFVo8vo52ciQyEijKBJiUHGd9w== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33CCEC3DA59 for ; Tue, 16 Jul 2024 18:12:21 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IFYPsh45bPgDYPiaEsXzn5InYH6oWDA2rxJh5e/B5UAxqVbg9egiUwT0wMJZL+6Jbhi8NIimw== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F367AC3DA59 for ; Tue, 16 Jul 2024 18:11:50 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IH/rppI31A3I4KePKXCCBaNw0iYc4GYRIDKeZHddh23bNXMwxe6zYkqUNFPddyybRlvHlenMw== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A283C3DA5D for ; Tue, 16 Jul 2024 18:12:55 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IFs48Yrh5pWhGCoVY2TzBsGBiXvpyzRIb8s0Q1MFoW0uiaVODFeTB8Ez21Vd1xGowT1gSZ6pw== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0CFAAC3DA59 for ; Tue, 16 Jul 2024 18:11:44 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IFMUW5x06wlcO4afTshW+UATphB8dCVN6/HvK8wPm7/IVym/4vfak8A+ybHNPNdN47aq2FaUQ== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5FBF2C3DA49 for ; Tue, 16 Jul 2024 18:12:54 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IE4QT7PUFjdL7pi9Ig7YhVybjygWiS4Kug16Kte6eHA03IZGN7Lr2QhdKXedaDUjkza0lb6wQ== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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: 13734737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E8CF5C3DA5D for ; Tue, 16 Jul 2024 18:11:44 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IGsWjI4bffQMS8jcbjj/iNJDtSZUvrxC6RhdJvMS4SRpvdIV8AbAr1WGK6/uZSOCWmlmNRP9w== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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;