From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194588; cv=none; d=zohomail.com; s=zohoarc; b=QuEDghyHVelhZ/a8qZlgLh9Ucf4GS6Pq0rC7Gj16gZqGs2ZIGUU/o/L6Fux+xdPdmx3uA2GOjxLM4BQaafiIQeRzHUAk5STPXUXEyr3g833reiJd6YkeRMBlx5BFMZUefB2EKHjJjCRrPKFSMLAeMbqAbQ8veD0G2ho9jXZpcdI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194588; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=R6W2wZouwSAQes85QIyt+CMmBwG3afd8TW13hztwuFc=; b=Zkk7lZjkYUXy5ZzlUsBWMsn3OWAQjP83XkFAWi5tmxvexQ+g9b30s+oT86ceD/ml2yS+c0dU1st6lAGylik5/ge89nPfqo8afmxGQOb/Bu/xBQG2MEECrQsBf7Z9GV4J6boB4QORg0K3ESTtHOv8cLUsILCPAaCoVZQG9oRkZ/c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194588220465.6137371579771; Fri, 30 Jun 2023 23:56:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVq-0007UI-U6; Sat, 01 Jul 2023 02:55:18 -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 1qFUVp-0007Tk-4P for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:17 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFUVn-0007Ed-Ae for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:16 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4f766777605so4300595e87.1 for ; Fri, 30 Jun 2023 23:55:14 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194513; x=1690786513; 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=R6W2wZouwSAQes85QIyt+CMmBwG3afd8TW13hztwuFc=; b=FUVbFDLBybRye6pzlItxbV0rtborrjKewfnQqcCsFdk2Q7D+wvBXouE6vkAj7zLwMj 3XLGMViIh5QnLgIPLushqE8Tl9ls3Bqngm1oyAaqe+03L6B+wlLxn/YHkl/AwpcdA/yb r8ZP+Lcto4lAznfsJO6wQCm18JdlG4LKzr41vSCN+H1OvPrkL4rmQIuq+Fs1D0HW4s9Q ksHJEEjt290Sdt8HFZv3Flfw/gz5FBb54phnzMGQPSvGcvjScR7q/Gx+PciRB/0EX/c3 oPBXUIUQoe8Gl4D6x1htgLPO0DEMc6RM+WgrM8LXQX2id0+xf0w/WuN0B/aAgnarNpkn Q7HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194513; x=1690786513; 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=R6W2wZouwSAQes85QIyt+CMmBwG3afd8TW13hztwuFc=; b=N2Z9gjE6Bzbr2nHDgvZb8U9EhJbVCu7cYgCU4+oqLNHNNFRzBMG2uGmISox2mpBA+2 OJ8L8STD83Nd14BWwhmvfJk8W/c6bAXehQEDvtEDb5deV7JGvdaSv1U3DXokHZHOyzu6 c/98O7F+p7mXgM7k8PDPP8gg4rt1FsgtyaPLFsbsp15DaS69LmmTtbTSTFQIEr8hY94x /6Rh/SPDeWE2RF6QVFB72ZRSkTokKcYhAS/Qo98nzxaMefBuu8LbsI3tzSqqdBGisZPM RR8sONR3QfXn60xwNRCzWE3h9XuWoRMtlFB6Kp+jhArIUKWtOsf9GWf0jCjD4L/H9kW9 rt6w== X-Gm-Message-State: ABy/qLZ8BjFGTyRpzfH7FZZlmmu9e2OtQVl10zVpbX1U2YibQu/bzQZM /ZJcQjXEpfXV8FRp3J8dyxgeJU6WAcKwoeneyOaBvA== X-Google-Smtp-Source: APBJJlEHz2B56xpkbysoeIwGebj9CbytYBnFPPLR1GWQsbtq1Ppv5j52oqFXkbwwIl/izIQQSybSpg== X-Received: by 2002:ac2:4ed4:0:b0:4fb:52f1:9ab4 with SMTP id p20-20020ac24ed4000000b004fb52f19ab4mr3082622lfr.50.1688194513426; Fri, 30 Jun 2023 23:55:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: BALATON Zoltan Subject: [PULL 01/11] ui/dbus: fix build errors in dbus_update_gl_cb and dbus_call_update_gl Date: Sat, 1 Jul 2023 08:55:00 +0200 Message-Id: <20230701065510.514743-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194589074100018 Content-Type: text/plain; charset="utf-8" Add some ifdefs to avoid an unused function and unused variable. Fixes: de1f8ce0abb8 ("ui/dbus: use shared D3D11 Texture2D when possible") Co-developed-by: BALATON Zoltan Message-Id: <336f7697-bcfa-1f5f-e411-6859815aa26c@eik.bme.hu> Signed-off-by: Richard Henderson --- ui/dbus-listener.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index e10162b279..0240c39510 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -177,6 +177,7 @@ fail: } #endif /* WIN32 */ =20 +#if defined(CONFIG_GBM) || defined(WIN32) static void dbus_update_gl_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) @@ -203,11 +204,14 @@ static void dbus_update_gl_cb(GObject *source_object, graphic_hw_gl_block(ddl->dcl.con, false); g_object_unref(ddl); } +#endif =20 static void dbus_call_update_gl(DisplayChangeListener *dcl, int x, int y, int w, int h) { +#if defined(CONFIG_GBM) || defined(WIN32) DBusDisplayListener *ddl =3D container_of(dcl, DBusDisplayListener, dc= l); +#endif =20 trace_dbus_update_gl(x, y, w, h); =20 --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194585; cv=none; d=zohomail.com; s=zohoarc; b=hnPdL5X74biccKMzF6ZW2bvXDP+apnZe2GTfXLp7l6TEgqNBPoKkwEUwGwZ5yK4un3w676MYhrv/uSHg7A4eZwdwGi+SUh5ehBcprOqts8UC4JpY+8Ky8aOu1cqPufD+2umbNenELs22/zz8smPON50mKENrtIpPrzJxP+doTP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194585; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pcc6HB+1pxARPpW2OAO7nKJmZp3YAW//z7LTAV54n+o=; b=E7h1xSAiRMXe//1cQDvl/5PHh7ojfoxQsO9pXCfW5YPZaxq5aoCBQJX5KEIQ27uwPmc7caEtWYhMvrjj32V7w7CQUQMXNUWx7VCmsSCyQQYSgklcNrhDbRo2FB6kiid1SV7/rjkLslrwBpEqnuJaSsUYUWcrTM2fQkA9byAkcfY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194585160409.65118822587453; Fri, 30 Jun 2023 23:56:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVw-0007XI-2j; Sat, 01 Jul 2023 02:55: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 1qFUVq-0007U1-Hw for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:18 -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 1qFUVo-0007Eh-2e for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:18 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fa8cd4a113so28374895e9.2 for ; Fri, 30 Jun 2023 23:55:15 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194514; x=1690786514; 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=pcc6HB+1pxARPpW2OAO7nKJmZp3YAW//z7LTAV54n+o=; b=DNIRUitmEwiUfctH3PuOlkt/NgWdTE2tOCLlEZS6vLqYFUu007n9j/PxAsEZghwmI9 IQfQv2Md/2Kd4ouo/CnIxInwhAlCKh2zXaWrwiEB/AovHMoaca6/TMLKmScvKhHcrqNs UiLILZ/u0EAjeNOGRCidgxdWhPgTjsKYHjhB4lJkgvvSlSLoF6cTTlefSCJD0o2uGqJM dhp0mDZBl4ZlaXXN8EzI+/oi2vJL2ZXcJhL8qWUQnQqrHKGjMM0BhTEDD5ko8srdByJc fS1gGz+FVoK3ZcEUCFpP738YcHMccEe2LBIiZ4Dv6+J2ARuqVqSb6dJUDEWe9z+BWV8Y J47w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194514; x=1690786514; 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=pcc6HB+1pxARPpW2OAO7nKJmZp3YAW//z7LTAV54n+o=; b=dqVHqTyyYgqA56j7uQktjSLk5AZqiTDKBO5bjV3Nb6IF7CuD4tTLWwy6LGu/xPm+y+ Zoi08451pHZhVO19hB+NuHsOVN9SzJvxxV2HRecFsjfL+X/oKnbV8wy1n2VI7JFlSnt2 M92qxtsErouxq6KlTG/Rg/W2VEN1HUqU7xLoyM4cnO22FEGDU12mqNZsFKgV7FCFRaXw OMlsLAOuuiQ9EyYe+nTUdAiYZB76wxL+4/TtDxdIPvkUh3uUt6DgCsiyGDciESbn+OrE NZ5BuLyIpUmlVhLIZsHBJR2BPHEQ3OLGkF62jYKUlCTlT/ss9YBzcu8BtpZ2727THQ+l +s8A== X-Gm-Message-State: AC+VfDySJpTADslkIp/HN6lFzOqf5c5K1iVQtCbTu8PbykS795xgCdAl O32e42Vet697mjgYEwDjwOIq6JsdT9IjDc8E2ekQCg== X-Google-Smtp-Source: ACHHUZ7UqYfxoc0jbwkBizISEy2ukNMlPxXQNxrtIdEnevcr4laoQ0vGvGvvo/AJvsgd0j8KvpLxow== X-Received: by 2002:a1c:c90a:0:b0:3f8:c9a4:4998 with SMTP id f10-20020a1cc90a000000b003f8c9a44998mr3512777wmb.28.1688194514037; Fri, 30 Jun 2023 23:55:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 02/11] audio: dbus requires pixman Date: Sat, 1 Jul 2023 08:55:01 +0200 Message-Id: <20230701065510.514743-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=richard.henderson@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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194586569100003 From: Marc-Andr=C3=A9 Lureau Commit commit 6cc5a615 ("ui/dbus: win32 support") has broken audio/dbus compilation when pixman is not included. Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1739 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230630214156.2181558-1-marcandre.lureau@redhat.com> Signed-off-by: Richard Henderson --- audio/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/meson.build b/audio/meson.build index e7e95cf751..df4d968c0f 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -31,7 +31,7 @@ endforeach =20 if dbus_display module_ss =3D ss.source_set() - module_ss.add(when: gio, if_true: files('dbusaudio.c')) + module_ss.add(when: [gio, pixman], if_true: files('dbusaudio.c')) audio_modules +=3D {'dbus': module_ss} endif =20 --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194584; cv=none; d=zohomail.com; s=zohoarc; b=GeAZguHz7prLt6FZfQd0/7ha6XYzaqZ/XG915kW6mxf49QaYX90ybc0OZk1Jzly25heG3HYAHftLs8Noru9imQBe37QaPHKtyuR8f6FOqcknV9o6zj4Fut+45Lg1ncaQ39ESYiBwwgaHOsKUwwQmJkl+zLKXcBwz6LSIYAxPrVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194584; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fh8ll0z1/lWAw6IZ8VRZwP3jq46crriqiBekj/aaK3E=; b=VwFmRoIhEL0+de1E2XMzYE7IejmF5wO2eooJ408Ny9cSfDAA9zszFZdD7dhR4jjC4rHGnVdSDQFcQenmf/HVl1ivZ538nEm4tt0ySqiohsRXcAXiPTD8227+aSegUusiBfdLBWWgQcbpRWRD+E9L4V0dJnqrBKV07ZOCgCtRzWg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168819458494818.837404715178877; Fri, 30 Jun 2023 23:56:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVr-0007Uf-O6; Sat, 01 Jul 2023 02:55:19 -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 1qFUVq-0007U0-Fz for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:18 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFUVo-0007Er-EY for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:18 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3fbc77e769cso16615065e9.0 for ; Fri, 30 Jun 2023 23:55:16 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194515; x=1690786515; 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=Fh8ll0z1/lWAw6IZ8VRZwP3jq46crriqiBekj/aaK3E=; b=mj4XliJDtCbPwsixJcrD1aSt+HPFMNM0RFuIozXeQY4jMjZvypXS7Pm6yP2CSTRNlA xC1ZgJjbpaRnrhV5AShZVKwx5V2aF3CNsjAXr+S9izLjDq0nSv0K3B0RbkJISA82qx75 o9tPqpAsAaVID/MDw8u+Q75u6Zo433saZxDlU4wBHbKpmbEx5hFve2rAuhXNfwfvXuGQ xW24JxXDBT+soQY0cDVmWkMwhad9obEL6WnM6b9d7/vaIdpSg9j6IBtd1xTkevdLpfRs IcbRXHQpn2cKGEshgYrZ7iu3PU4oK4gaqD7cD/S0arRKVHIh79scW0i0QUe0/PeDX1Zy TXKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194515; x=1690786515; 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=Fh8ll0z1/lWAw6IZ8VRZwP3jq46crriqiBekj/aaK3E=; b=hDbmPS0GEjGF641LXeWDnbmajxK7fQ0Gjg7WuKsAx4Y5KLjuYLwLboxtrmcWUS+mBm 8VrrsrV21sL2k9Sd6hx8vHquNfSLmTD5GvGxxmYvl2FXTrHWN28TSEBK2AJ0Sw2XGm4j kJ71KmRP29fbIw17iQywTOCLmanD/5rwOSLKOSITR0y6bJa3KcTzQt6YRxrycasiVMaQ B7Uerbq2W+GDlIktqsdA6PkmCtAI4EOLp1en0aH+/jSjFG04HXiGTzaw7A6oEPCNMUhZ 38q0+MjVUAWxe9aIatrtDyemftYaYKpfGcGiyjHVPqOsqNb7C4GzdsRPk0/S60HNCsvd iAzQ== X-Gm-Message-State: AC+VfDybDUBYrH2AgljoYhUwEf5HBeavAlyuHvccfr7UlXmJ7G/fvYWR 5s69l8EUG0vHkLG5XRbNx5mtcc5tx3b//Bcw1n4dOA== X-Google-Smtp-Source: ACHHUZ7CkO76rEwP90+j1bWONfgKWRAr10ttJQPBZCiXeyTbRze3TdgAAmZnhyoh2OLuy1HNbc1hrA== X-Received: by 2002:a1c:f702:0:b0:3fa:8866:14af with SMTP id v2-20020a1cf702000000b003fa886614afmr3822303wmh.14.1688194514617; Fri, 30 Jun 2023 23:55:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland Subject: [PULL 03/11] accel/tcg: Fix start page passed to tb_invalidate_phys_page_range__locked Date: Sat, 1 Jul 2023 08:55:02 +0200 Message-Id: <20230701065510.514743-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194587075100015 Content-Type: text/plain; charset="utf-8" From: Mark Cave-Ayland Due to a copy-paste error in tb_invalidate_phys_range, the wrong start address was passed to tb_invalidate_phys_page_range__locked. Correct is to use the start of each page in turn. Signed-off-by: Mark Cave-Ayland Fixes: e506ad6a05 ("accel/tcg: Pass last not end to tb_invalidate_phys_rang= e") Message-Id: <20230629082522.606219-2-mark.cave-ayland@ilande.co.uk> Signed-off-by: Richard Henderson --- accel/tcg/tb-maint.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 3541419845..33ea1aadd1 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1182,15 +1182,17 @@ void tb_invalidate_phys_range(tb_page_addr_t start,= tb_page_addr_t last) index_last =3D last >> TARGET_PAGE_BITS; for (index =3D start >> TARGET_PAGE_BITS; index <=3D index_last; index= ++) { PageDesc *pd =3D page_find(index); - tb_page_addr_t bound; + tb_page_addr_t page_start, page_last; =20 if (pd =3D=3D NULL) { continue; } assert_page_locked(pd); - bound =3D (index << TARGET_PAGE_BITS) | ~TARGET_PAGE_MASK; - bound =3D MIN(bound, last); - tb_invalidate_phys_page_range__locked(pages, pd, start, bound, 0); + page_start =3D index << TARGET_PAGE_BITS; + page_last =3D page_start | ~TARGET_PAGE_MASK; + page_last =3D MIN(page_last, last); + tb_invalidate_phys_page_range__locked(pages, pd, + page_start, page_last, 0); } page_collection_unlock(pages); } --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194603; cv=none; d=zohomail.com; s=zohoarc; b=j0jbTkXvioKgOIAIzcSTsWG0O2Us53e7YWjD/DPvVg7ypSNiH2Cg3gS+E6uRbgJSPzzO3aqnEoDslqMR8Owq0lQF8qlXWsNzBPXgPJ0uJCJjOBQz62fEzRRs4cjmn6IgS/5f19opWGboxLsH+jrpqxxT6KavXamOMQ+dYxn8DoI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194603; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=guLrkyvnxpE2Di61jdSFFK1pil20iWnpknoQn5xGxP4=; b=JJMIl77OC7eBQrb78rhP4mN8bZ/rhfMmNk9QHl0RsdA6IF2nAUybusB8NFSuH5vxg36Xn+f68ZGBCYX5eYBGFMkehalN6IYfS7kFNPzrNApLj5jI3vsG0sP7pAZdvF9TTSqiW3IqCwtqwo9z5KU8x6Btm33oiF1Rudij5WWRyz8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194603715461.25473810232415; Fri, 30 Jun 2023 23:56:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVs-0007Ui-0x; Sat, 01 Jul 2023 02:55:20 -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 1qFUVr-0007UV-1d for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:19 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFUVp-0007Ex-7H for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:18 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fbc59de009so20388975e9.3 for ; Fri, 30 Jun 2023 23:55:16 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194515; x=1690786515; 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=guLrkyvnxpE2Di61jdSFFK1pil20iWnpknoQn5xGxP4=; b=FvKPMtkac/boNy3/r1tm2aIAobRFpgPHT93iGO6YkmhwpTzvNcxwpgt/C+IRhHaiK/ rB2t91xQ/8TeCfxDbd6MBXVwQNPa2C5Inj0WQj8h5LfCWwR40HSWGKy9wwuidUC6Oxv4 ANcHuxOzRNZ0f3l++bsBL4sfWhto+NfD5PimOR9fC9orcjxabdZlB0ZMD1q66QNOxt31 h1apDS/MfveZwLkdY2tht2EAU3m1UhtajodRNhewRCDuuN5gmFIYxc74RIXbtWfUlK0e cYQqCRZcFPea/KrN4VPRDtp2GqdZUkrmNK5SbbboXDPS6bid8qQRJNvukYGqBGmapti3 /GfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194515; x=1690786515; 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=guLrkyvnxpE2Di61jdSFFK1pil20iWnpknoQn5xGxP4=; b=UOu4QsZHR+B9x9GuBAeU3LuhHwZdByID3wVH4M0EDtO2Lcxiql1BMrB4TjFybk4+/K XxiH8iOUcreegVMqLRr7Gd8omz768/pYV8LOH6z790Cd3S811dYqcflhyc6zenLT1w0S SRXd9Py2DXkAuMeHK6wV2wDaxfM96+Nvcx2TtpgMLZL3Utm90l12MS0CVeim9+wXc/No sfWNZDOIOjn4j6Gy8NFBKKT90G5HkNxqWq+VQpPVN2HOtFvG6avn/eqfv/peQAH+hQUf TQhLiBrpqCFpKkvQM1YeKThJAFFmKGeD41b1xtU5W9Tq+ryrdFgMMhDs/Fgx3s+hKusF u3eA== X-Gm-Message-State: AC+VfDxLoEb+oIO0yMadkjeNk+K3xuo/8ybBJKY545IpxOmSSDAgQeoc qysMdsEYZV4ln9HWtqokNOoZW9sIgHjFCnxMmwnjMg== X-Google-Smtp-Source: ACHHUZ6Ygn64FVhTDwcL/YGjYGDQiMxYVjM3AhTyzgi121WJl7tbxMlANHTKtlUzG4IiNVs/JkffNA== X-Received: by 2002:a05:600c:2292:b0:3f8:fc2a:c7eb with SMTP id 18-20020a05600c229200b003f8fc2ac7ebmr3381081wmf.5.1688194515409; Fri, 30 Jun 2023 23:55:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 04/11] accel/tcg: Assert one page in tb_invalidate_phys_page_range__locked Date: Sat, 1 Jul 2023 08:55:03 +0200 Message-Id: <20230701065510.514743-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194605103100001 From: Mark Cave-Ayland Ensure that that both the start and last addresses are within the same guest page. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230629082522.606219-3-mark.cave-ayland@ilande.co.uk> [rth: Use tcg_debug_assert, simplify the expression] Signed-off-by: Richard Henderson --- accel/tcg/tb-maint.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 33ea1aadd1..9566224d18 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1092,6 +1092,9 @@ tb_invalidate_phys_page_range__locked(struct page_col= lection *pages, TranslationBlock *current_tb =3D retaddr ? tcg_tb_lookup(retaddr) : NU= LL; #endif /* TARGET_HAS_PRECISE_SMC */ =20 + /* Range may not cross a page. */ + tcg_debug_assert(((start ^ last) & TARGET_PAGE_MASK) =3D=3D 0); + /* * We remove all the TBs in the range [start, last]. * XXX: see if in some cases it could be faster to invalidate all the = code --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194599; cv=none; d=zohomail.com; s=zohoarc; b=Ii4nbGbfbwoej+6HsNmDagnTQQtDozj1oJdG0x7aJEmpnoeL/Ef2t19U44Jeig1OG35UudbJVZEsnVs/ptF9yc/lIBiQa2Kg30CWOWzXuz6vGiCJK8CDxw57cyCbkKo7jsWlMtCU5a9q8QxR3+qkCHW1VzW1CjZDhBDNud/G2MU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194599; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+mRZecGlk4y92NOTZCV4Vh1o10DfSN55KRLfHTObE+8=; b=ls+C+ylW2Efm+75Ic1htjCoIMTjuy73ErFrNOpFpBbvq624prMpA3IzRGkMFQRMZxCZa06qahf+GmRl1rNiBwgRjT0zZsPGXM9u2zLFEQ9g4mO3fk5ISanMC4iv2iQQ6sChlP+S3wywq4s9zwYH9eiZWz55pdA/HyLY16djxVTo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194599221316.70017378599493; Fri, 30 Jun 2023 23:56:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVt-0007VX-Kd; Sat, 01 Jul 2023 02:55:21 -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 1qFUVr-0007Ug-SN for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:19 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFUVp-0007F8-Ti for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:19 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4fb94b1423eso4203701e87.1 for ; Fri, 30 Jun 2023 23:55:17 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194516; x=1690786516; 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=+mRZecGlk4y92NOTZCV4Vh1o10DfSN55KRLfHTObE+8=; b=Zm3ru0H7iKnM6SFbZwuC+rTBF4XbB7/sZWASnJ2jd2XqVZiitjIkMWnllbInnUM+aB tq7dTa8YFBMFG7UwuXWZgyb5pm/I4K4aqFg50Ut6VLIfy6nIFVM7FZ7wDwQBikkv3ICQ AZXN8rnSSpotwko6OV0hmd+jyz2nMTIQ7bKDOeb2tkS0v4zfB/ySmll/wO9/BDLrukWQ FKKrFDHnMR25XTzrkGW6IIF3OmNfd1O33wixGrEwrWcP/7stmh9p+o5WWINeL2B1IvhU WVUHvfDsdMMNUeegIBwC860RD51pZ11oUBu2uhHdS7fqPh62UeLMpE/lGp4eX564MbTp 2Wmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194516; x=1690786516; 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=+mRZecGlk4y92NOTZCV4Vh1o10DfSN55KRLfHTObE+8=; b=UB+yv0FqPXYUF4eygEbREg94lw/CYmHnjsk5vdB14lEr9rst/odMpZLBZS0mC6lJxA /WMCWjk3/H4L3lJpDLgzjPSAy35O76Z9M1vRK4Pykg+VDybMQMmnIDyE8ASbgpYtdhXD kSxd0bA+vv25Yhb3iKSYaGryqN6WpqPrWUG0T0X0s23eAftwpWHf368AKkHEthu6Tnbj KqDLwEV4/kSL4Sgx+DC+zIjPSK9f8D2UoLFe0QmhbgPiqu319hUiAsTGWkUezK7U8fYM 0a1YjKdGPdmKZN8W1adLHg6uec/SPZiGS2MzlpNCn2zVfrf9tdcgf5Yt2P/x3+ijMJ6e i3Lg== X-Gm-Message-State: ABy/qLbKVnir0z0SzhNUoKoBizpdhTP854wkazXu2xRhG5eqy1hzcQ4j 8RzDpEScfGJCk17BTpaxWzPQ3e73N0BXKb+DaxBClw== X-Google-Smtp-Source: APBJJlEVEN2Dd+ckCRfDYhcbP/acQU2bFn6hPevrWky3O5IaRncm4cn9HdPrFL83paZAsMC3oiG4jQ== X-Received: by 2002:a05:6512:3612:b0:4f8:70f8:d424 with SMTP id f18-20020a056512361200b004f870f8d424mr3206454lfs.65.1688194516086; Fri, 30 Jun 2023 23:55:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Christoph Muellner , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 05/11] fpu: Add float64_to_int{32,64}_modulo Date: Sat, 1 Jul 2023 08:55:04 +0200 Message-Id: <20230701065510.514743-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194601142100002 Add versions of float64_to_int* which do not saturate the result. Reviewed-by: Christoph Muellner Tested-by: Christoph Muellner Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Message-Id: <20230527141910.1885950-2-richard.henderson@linaro.org> --- include/fpu/softfloat.h | 3 ++ fpu/softfloat.c | 31 ++++++++++++++++ fpu/softfloat-parts.c.inc | 78 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 3dcf20e3a2..cd130564d8 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -751,6 +751,9 @@ int16_t float64_to_int16_round_to_zero(float64, float_s= tatus *status); int32_t float64_to_int32_round_to_zero(float64, float_status *status); int64_t float64_to_int64_round_to_zero(float64, float_status *status); =20 +int32_t float64_to_int32_modulo(float64, FloatRoundMode, float_status *sta= tus); +int64_t float64_to_int64_modulo(float64, FloatRoundMode, float_status *sta= tus); + uint16_t float64_to_uint16_scalbn(float64, FloatRoundMode, int, float_stat= us *); uint32_t float64_to_uint32_scalbn(float64, FloatRoundMode, int, float_stat= us *); uint64_t float64_to_uint64_scalbn(float64, FloatRoundMode, int, float_stat= us *); diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 42e6c188b4..0cc130ae9b 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -852,11 +852,24 @@ static uint64_t parts128_float_to_uint(FloatParts128 = *p, FloatRoundMode rmode, #define parts_float_to_uint(P, R, Z, M, S) \ PARTS_GENERIC_64_128(float_to_uint, P)(P, R, Z, M, S) =20 +static int64_t parts64_float_to_sint_modulo(FloatParts64 *p, + FloatRoundMode rmode, + int bitsm1, float_status *s); +static int64_t parts128_float_to_sint_modulo(FloatParts128 *p, + FloatRoundMode rmode, + int bitsm1, float_status *s); + +#define parts_float_to_sint_modulo(P, R, M, S) \ + PARTS_GENERIC_64_128(float_to_sint_modulo, P)(P, R, M, S) + static void parts64_sint_to_float(FloatParts64 *p, int64_t a, int scale, float_status *s); static void parts128_sint_to_float(FloatParts128 *p, int64_t a, int scale, float_status *s); =20 +#define parts_float_to_sint(P, R, Z, MN, MX, S) \ + PARTS_GENERIC_64_128(float_to_sint, P)(P, R, Z, MN, MX, S) + #define parts_sint_to_float(P, I, Z, S) \ PARTS_GENERIC_64_128(sint_to_float, P)(P, I, Z, S) =20 @@ -3409,6 +3422,24 @@ int64_t bfloat16_to_int64_round_to_zero(bfloat16 a, = float_status *s) return bfloat16_to_int64_scalbn(a, float_round_to_zero, 0, s); } =20 +int32_t float64_to_int32_modulo(float64 a, FloatRoundMode rmode, + float_status *s) +{ + FloatParts64 p; + + float64_unpack_canonical(&p, a, s); + return parts_float_to_sint_modulo(&p, rmode, 31, s); +} + +int64_t float64_to_int64_modulo(float64 a, FloatRoundMode rmode, + float_status *s) +{ + FloatParts64 p; + + float64_unpack_canonical(&p, a, s); + return parts_float_to_sint_modulo(&p, rmode, 63, s); +} + /* * Floating-point to unsigned integer conversions */ diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc index 247400031c..527e15e6ab 100644 --- a/fpu/softfloat-parts.c.inc +++ b/fpu/softfloat-parts.c.inc @@ -1181,6 +1181,84 @@ static uint64_t partsN(float_to_uint)(FloatPartsN *p= , FloatRoundMode rmode, return r; } =20 +/* + * Like partsN(float_to_sint), except do not saturate the result. + * Instead, return the rounded unbounded precision two's compliment result, + * modulo 2**(bitsm1 + 1). + */ +static int64_t partsN(float_to_sint_modulo)(FloatPartsN *p, + FloatRoundMode rmode, + int bitsm1, float_status *s) +{ + int flags =3D 0; + uint64_t r; + bool overflow =3D false; + + switch (p->cls) { + case float_class_snan: + flags |=3D float_flag_invalid_snan; + /* fall through */ + case float_class_qnan: + flags |=3D float_flag_invalid; + r =3D 0; + break; + + case float_class_inf: + overflow =3D true; + r =3D 0; + break; + + case float_class_zero: + return 0; + + case float_class_normal: + /* TODO: N - 2 is frac_size for rounding; could use input fmt. */ + if (parts_round_to_int_normal(p, rmode, 0, N - 2)) { + flags =3D float_flag_inexact; + } + + if (p->exp <=3D DECOMPOSED_BINARY_POINT) { + /* + * Because we rounded to integral, and exp < 64, + * we know frac_low is zero. + */ + r =3D p->frac_hi >> (DECOMPOSED_BINARY_POINT - p->exp); + if (p->exp < bitsm1) { + /* Result in range. */ + } else if (p->exp =3D=3D bitsm1) { + /* The only in-range value is INT_MIN. */ + overflow =3D !p->sign || p->frac_hi !=3D DECOMPOSED_IMPLIC= IT_BIT; + } else { + overflow =3D true; + } + } else { + /* Overflow, but there might still be bits to return. */ + int shl =3D p->exp - DECOMPOSED_BINARY_POINT; + if (shl < N) { + frac_shl(p, shl); + r =3D p->frac_hi; + } else { + r =3D 0; + } + overflow =3D true; + } + + if (p->sign) { + r =3D -r; + } + break; + + default: + g_assert_not_reached(); + } + + if (overflow) { + flags =3D float_flag_invalid | float_flag_invalid_cvti; + } + float_raise(flags, s); + return r; +} + /* * Integer to float conversions * --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194584; cv=none; d=zohomail.com; s=zohoarc; b=LSOrZq88/v2zh4TMZm7I+Mp29RVs3d/CVh+N6z5+/pNO6gjc9KW+m231v7IeMMqHLviamYyE1tMS6+smdhNDkRsr28Rc6kQMfDbW423ksjlKpnWpv+CsV+d/gTmHN44smRrUxO70KQcih+g3+hr4zjfkpqhFMbtz2/4N10ipwko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194584; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mV8nHx5xU3W2QWS3dGtP3xyCoVtszahnj86o5dz8D9I=; b=cJlQk4FuKR2v1vvE3Zbgt20KQpS7v66VdqIkmtD8UZT1UXgnus77gupDFBiAzYYfVzjhWPpH2r2UtMxr4GagatKMtxPhznHYa9TqG4R4QcPlwf+0bbdpLGj8ymih411L6KI78h7c4mvd0OQRZiQpDy+Yp1ZpQtggHsQVugSY4WA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194584770983.6947218963934; Fri, 30 Jun 2023 23:56:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVt-0007Vj-Ul; Sat, 01 Jul 2023 02:55:21 -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 1qFUVs-0007Uo-58 for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:20 -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 1qFUVq-0007FH-DX for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:19 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fbc244d307so24076095e9.1 for ; Fri, 30 Jun 2023 23:55:17 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194516; x=1690786516; 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=mV8nHx5xU3W2QWS3dGtP3xyCoVtszahnj86o5dz8D9I=; b=AnxN3oqOfwThmH6eoaLqir2YFZqG0vpIuPWEjoN744ITryrMAkGICfSeyFqxAXRTOi ADDm6OG776ZXcjKlERD9WNEyFdz+Se5h/HgByD4oUuzWqWnIe3wkvx0DdkLMFf5RZRkB lltM/e4qCW3v4JO9/lqWz5CBX4ARqLpj1vGPMDywBobypvGtDV8YjUpfD01Fkx4C+1zO KexsWHpqMuYzllZYtSykzrtmPl67xEjj67QRq6ChV+DYS0e6tUID99y6xM1XPs8vt+3Z 96+P7m1a0I/UdJA94eLIH5o8j8v5hDWXO7nTkCYfi2PT034u+havJYmCJsqXORKZ6DbG Ik0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194516; x=1690786516; 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=mV8nHx5xU3W2QWS3dGtP3xyCoVtszahnj86o5dz8D9I=; b=BIeuyrQhsdtyRvwvOPYJIFaiCki9Ur5RHDjp1sPumznphYQ6QoaM8Du7YJSDr39S7Z vVV4LfIMN9n2gLIykUQM7TFrxCwK46UZyynaKsGl5HKj3ax6X32GpMl4R4T6IWOyLWcM 0USQHRfXwe4y750gAi+a+Q/ixoaHQJsm0i+J76cI2Mgj43IN6KBGbgdX2Q1dRb/r74Dd 7zCEnmAbiUnUtRv4jgjlb6PlRO/WnmLSh9MYi5/uZaVCa2Sg+qX3UlsDT/HRphsxuDof WOPpQCAz7MtaSfHpyg8pI2hEE66TJRY54ngV7K8MlaUCzI+SO+52RcYnc2VkjyDZylkZ bJuA== X-Gm-Message-State: AC+VfDwViUYqUpZXBu3V2pFUJPRNsMnywLMLfNHLj8l87EhIOncu6//q 76k4wDNy+c6NeRWu1mkYNhTf7FIDiDz8pC/zIbc0Vg== X-Google-Smtp-Source: ACHHUZ5QH3lftbp0YitGLqOMpUbNpoYIAxhs5BlvEZgnIOlFubVIfF6MW+KmvUB9/BZosRbjehPOPw== X-Received: by 2002:a05:600c:b54:b0:3f9:846:d892 with SMTP id k20-20020a05600c0b5400b003f90846d892mr3691581wmr.9.1688194516764; Fri, 30 Jun 2023 23:55:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 06/11] tests/tcg/alpha: Add test for cvttq Date: Sat, 1 Jul 2023 08:55:05 +0200 Message-Id: <20230701065510.514743-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194585344100001 Test for invalid, integer overflow, and inexact. Test for proper result, modulo 2**64. Signed-off-by: Richard Henderson Acked-by: Alex Benn=C3=A9e Message-Id: <20230527141910.1885950-3-richard.henderson@linaro.org> --- tests/tcg/alpha/test-cvttq.c | 78 +++++++++++++++++++++++++++++++++ tests/tcg/alpha/Makefile.target | 2 +- 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/alpha/test-cvttq.c diff --git a/tests/tcg/alpha/test-cvttq.c b/tests/tcg/alpha/test-cvttq.c new file mode 100644 index 0000000000..d1ad995312 --- /dev/null +++ b/tests/tcg/alpha/test-cvttq.c @@ -0,0 +1,78 @@ +#include + +#define FPCR_SUM (1UL << 63) +#define FPCR_INED (1UL << 62) +#define FPCR_UNFD (1UL << 61) +#define FPCR_UNDZ (1UL << 60) +#define FPCR_DYN_SHIFT 58 +#define FPCR_DYN_CHOPPED (0UL << FPCR_DYN_SHIFT) +#define FPCR_DYN_MINUS (1UL << FPCR_DYN_SHIFT) +#define FPCR_DYN_NORMAL (2UL << FPCR_DYN_SHIFT) +#define FPCR_DYN_PLUS (3UL << FPCR_DYN_SHIFT) +#define FPCR_DYN_MASK (3UL << FPCR_DYN_SHIFT) +#define FPCR_IOV (1UL << 57) +#define FPCR_INE (1UL << 56) +#define FPCR_UNF (1UL << 55) +#define FPCR_OVF (1UL << 54) +#define FPCR_DZE (1UL << 53) +#define FPCR_INV (1UL << 52) +#define FPCR_OVFD (1UL << 51) +#define FPCR_DZED (1UL << 50) +#define FPCR_INVD (1UL << 49) +#define FPCR_DNZ (1UL << 48) +#define FPCR_DNOD (1UL << 47) +#define FPCR_STATUS_MASK (FPCR_IOV | FPCR_INE | FPCR_UNF \ + | FPCR_OVF | FPCR_DZE | FPCR_INV) + +static long test_cvttq(long *ret_e, double d) +{ + unsigned long reset =3D (FPCR_INED | FPCR_UNFD | FPCR_OVFD | FPCR_DZED= | + FPCR_INVD | FPCR_DYN_NORMAL); + long r, e; + + asm("excb\n\t" + "mt_fpcr %3\n\t" + "excb\n\t" + "cvttq/svic %2, %0\n\t" + "excb\n\t" + "mf_fpcr %1\n\t" + "excb\n\t" + : "=3Df"(r), "=3Df"(e) + : "f"(d), "f"(reset)); + + *ret_e =3D e & FPCR_STATUS_MASK; + return r; +} + +int main (void) +{ + static const struct { + double d; + long r; + long e; + } T[] =3D { + { 1.0, 1, 0 }, + { -1.0, -1, 0 }, + { 1.5, 1, FPCR_INE }, + { 0x1.0p32, 0x0000000100000000ul, 0 }, + { -0x1.0p63, 0x8000000000000000ul, 0 }, + { 0x1.0p63, 0x8000000000000000ul, FPCR_IOV | FPCR_INE }, + { 0x1.0p64, 0x0000000000000000ul, FPCR_IOV | FPCR_INE }, + { 0x1.cccp64, 0xccc0000000000000ul, FPCR_IOV | FPCR_INE }, + { __builtin_inf(), 0, FPCR_INV }, + { __builtin_nan(""), 0, FPCR_INV }, + }; + + int i, err =3D 0; + + for (i =3D 0; i < sizeof(T)/sizeof(T[0]); i++) { + long e, r =3D test_cvttq(&e, T[i].d); + + if (r !=3D T[i].r || e !=3D T[i].e) { + printf("Fail %a: expect (%016lx : %04lx) got (%016lx : %04lx)\= n", + T[i].d, T[i].r, T[i].e >> 48, r, e >> 48); + err =3D 1; + } + } + return err; +} diff --git a/tests/tcg/alpha/Makefile.target b/tests/tcg/alpha/Makefile.tar= get index a585080328..b94500a7d9 100644 --- a/tests/tcg/alpha/Makefile.target +++ b/tests/tcg/alpha/Makefile.target @@ -5,7 +5,7 @@ ALPHA_SRC=3D$(SRC_PATH)/tests/tcg/alpha VPATH+=3D$(ALPHA_SRC) =20 -ALPHA_TESTS=3Dhello-alpha test-cond test-cmov test-ovf +ALPHA_TESTS=3Dhello-alpha test-cond test-cmov test-ovf test-cvttq TESTS+=3D$(ALPHA_TESTS) =20 test-cmov: EXTRA_CFLAGS=3D-DTEST_CMOV --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194631; cv=none; d=zohomail.com; s=zohoarc; b=MrTTXid+V0dereIDQia/b09JqIxB+XDrqVdRZtrwW6SerxofhGoVIUy4EaD+6hj2eNgiefNVFIHrwhG1NqPcTRqxFgJJ7+uAEJCapQav8m9geTZeFr0hBWgKe7GWkRpkCJBnxHJJZQnKD4BdcilchknMZyftRDfFMe0BjPDHm9Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194631; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Zw6bQp1/aPCTHVB9O6SX0clKjc4ibzsmP+nMY0H68OE=; b=dCn7/ZPa4TyZ9tc8mAPruK8Jnb7sqDaTNk6SnalH57quiQdZFQH+eTcoBZJqaODhsdq6BYjffjFvFzC4qevFbcW/S8iOYy+VzopvS3GHWEyxnwAq3lD+tDskCMdUIUGPJDPRY0gFL2UYS+f+d9T73PJNxpC9GEUvzx8Bst2g20A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194631798412.35319229229106; Fri, 30 Jun 2023 23:57:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVu-0007WD-Ik; Sat, 01 Jul 2023 02:55:22 -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 1qFUVs-0007VI-UP for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:20 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFUVr-0007FT-4p for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:20 -0400 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f875b267d9so4333266e87.1 for ; Fri, 30 Jun 2023 23:55:18 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194517; x=1690786517; 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=Zw6bQp1/aPCTHVB9O6SX0clKjc4ibzsmP+nMY0H68OE=; b=B46m4tOq3vehnqsffCn+XtiAB44MrpLtdxBEZAvVhNW3xzh0GcojTw7OVb8yFW2c7Q IuAgaNfTAU7hl2OQfRnFenu0Adf7UO7EDI8tinVZn8PEXnIOcX+xXNpSaKAKgg+wT6Xt fYwbSgnWvPTn8a28RTEhL16Wbcjldu5t4sI5I2LjOT78QK/i3JRr5LbLBC4/nbMo6hso wEfB1hgunEvvvWg9OKrDgGXYMxa2gCQi4Q5FqxWlqZ5JKot6Bk8gN5d7N1WK1eP46F7H Wjxnw0ofcsVB7ClZVYcwqisg2NT0XN0Y9EqjWv+h+i1gIhn2Vt8S9TXrjQCfAAv+9L2c p9Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194517; x=1690786517; 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=Zw6bQp1/aPCTHVB9O6SX0clKjc4ibzsmP+nMY0H68OE=; b=AkPlzvwMdC1Cukdljpb8LXehh3nW9xZ3jUZ3Eo2eR787BWHH7Z9XPKNc+HK5DMYERd SR7vTU9LJnOB0B7uJvnD+o3TDIWuB8bVTskIp+5V/N63Mm/laPZDG9kCdLwyLPBQfycR kPmhmXERKnHHli9DPDZ6ztdMhRaHtbWFvbS3FUlV3WM09A3YXH77gGpr13pRnz7upLJi Pk0cOSI6xQQwOkoBv9wD58YcPbcgXF+oCNUzCpa7zjjDZr19SOcdQLVtYas4ImyVqE+6 F6lVY0YsPaJPgDat8pmll3+9QBr381yksO8B7v+3nDhIbXTHDdq4PRJC6HzSJB2oJ0se ecQQ== X-Gm-Message-State: ABy/qLa3KvyOGkYWdBYSFlAiQqYxEHqqD2oBRUeelWR0M6H0vhQ2/dpK WJSpXA8McRbUxXVHnLyZqbm+y/edH3/BhB4re9fczQ== X-Google-Smtp-Source: APBJJlGJ7B4eKjV10mbKKPD2M+c1GxyOriCmCCq0rjBzEmaA/WxBpW8n5ewp4lwvny+3qDWaKXpktQ== X-Received: by 2002:a05:6512:368b:b0:4f7:6453:f3f1 with SMTP id d11-20020a056512368b00b004f76453f3f1mr3228476lfs.15.1688194517537; Fri, 30 Jun 2023 23:55:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 07/11] target/alpha: Use float64_to_int64_modulo for CVTTQ Date: Sat, 1 Jul 2023 08:55:06 +0200 Message-Id: <20230701065510.514743-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194633729100003 For the most part we can use the new generic routine, though exceptions need some post-processing to sort invalid from integer overflow. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230527141910.1885950-4-richard.henderson@linaro.org> --- target/alpha/fpu_helper.c | 85 +++++++++------------------------------ 1 file changed, 18 insertions(+), 67 deletions(-) diff --git a/target/alpha/fpu_helper.c b/target/alpha/fpu_helper.c index 3ff8bb456d..63d9e9ce39 100644 --- a/target/alpha/fpu_helper.c +++ b/target/alpha/fpu_helper.c @@ -453,78 +453,29 @@ uint64_t helper_cvtqs(CPUAlphaState *env, uint64_t a) =20 static uint64_t do_cvttq(CPUAlphaState *env, uint64_t a, int roundmode) { - uint64_t frac, ret =3D 0; - uint32_t exp, sign, exc =3D 0; - int shift; + float64 fa; + int64_t ret; + uint32_t exc; =20 - sign =3D (a >> 63); - exp =3D (uint32_t)(a >> 52) & 0x7ff; - frac =3D a & 0xfffffffffffffull; + fa =3D t_to_float64(a); + ret =3D float64_to_int64_modulo(fa, roundmode, &FP_STATUS); =20 - if (exp =3D=3D 0) { - if (unlikely(frac !=3D 0) && !env->fp_status.flush_inputs_to_zero)= { - goto do_underflow; - } - } else if (exp =3D=3D 0x7ff) { - exc =3D FPCR_INV; - } else { - /* Restore implicit bit. */ - frac |=3D 0x10000000000000ull; + exc =3D get_float_exception_flags(&FP_STATUS); + if (unlikely(exc)) { + set_float_exception_flags(0, &FP_STATUS); =20 - shift =3D exp - 1023 - 52; - if (shift >=3D 0) { - /* In this case the number is so large that we must shift - the fraction left. There is no rounding to do. */ - if (shift < 64) { - ret =3D frac << shift; - } - /* Check for overflow. Note the special case of -0x1p63. */ - if (shift >=3D 11 && a !=3D 0xC3E0000000000000ull) { + /* We need to massage the resulting exceptions. */ + if (exc & float_flag_invalid_cvti) { + /* Overflow, either normal or infinity. */ + if (float64_is_infinity(fa)) { + exc =3D FPCR_INV; + } else { exc =3D FPCR_IOV | FPCR_INE; } - } else { - uint64_t round; - - /* In this case the number is smaller than the fraction as - represented by the 52 bit number. Here we must think - about rounding the result. Handle this by shifting the - fractional part of the number into the high bits of ROUND. - This will let us efficiently handle round-to-nearest. */ - shift =3D -shift; - if (shift < 63) { - ret =3D frac >> shift; - round =3D frac << (64 - shift); - } else { - /* The exponent is so small we shift out everything. - Leave a sticky bit for proper rounding below. */ - do_underflow: - round =3D 1; - } - - if (round) { - exc =3D FPCR_INE; - switch (roundmode) { - case float_round_nearest_even: - if (round =3D=3D (1ull << 63)) { - /* Fraction is exactly 0.5; round to even. */ - ret +=3D (ret & 1); - } else if (round > (1ull << 63)) { - ret +=3D 1; - } - break; - case float_round_to_zero: - break; - case float_round_up: - ret +=3D 1 - sign; - break; - case float_round_down: - ret +=3D sign; - break; - } - } - } - if (sign) { - ret =3D -ret; + } else if (exc & float_flag_invalid) { + exc =3D FPCR_INV; + } else if (exc & float_flag_inexact) { + exc =3D FPCR_INE; } } env->error_code =3D exc; --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194651; cv=none; d=zohomail.com; s=zohoarc; b=DrZRaUmufNSXKAVpe69FZXiICBsHnJwbCD9JRMo6r+46Nj2LPV0AYpJ7X4XDkkiZtqvRthc0wEXNj41Af0Pv+lazvx4cl43Mqx8dixQiR5lxvPOXXmdxswKmqQ0et6Vr92grsc1mlg8slfyeLoqGOgN2YgokVzSlFMJBRJ/Rep0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194651; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vWBYX+czO68YBn+sruZR19OlwAnKUpeq8kLfDlKJ0tE=; b=LTEV+6H0Niyn8lE46pmW6xi3tCjWZVWp4Qr8InLI4p2wU6o6EY+RXhoEdvVEoLQNzQbtKmna61rFtY7wvp7h4JSYZBOgTLupyM5rSo52yujAgeSVSlIBLIexwtu13WiX8g0fmFyhMy9NspA3zo9nhK8HWUXsMhCAbcCkjZu3A+o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194651328603.942867990864; Fri, 30 Jun 2023 23:57:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVv-0007WX-DY; Sat, 01 Jul 2023 02:55: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 1qFUVt-0007VQ-C6 for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:21 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFUVr-0007Fi-OS for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:21 -0400 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f76a0a19d4so4286838e87.2 for ; Fri, 30 Jun 2023 23:55:19 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194518; x=1690786518; 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=vWBYX+czO68YBn+sruZR19OlwAnKUpeq8kLfDlKJ0tE=; b=XrH4ZjkZoWwK8x81L0/zS9Zwp4O3YrdCQKevSJtyHlxKpEOOSDdi18JMqm0I80YDoK mvphU9oIRoWrGMc/Fh+glo3cAg0DTJqsnTgtNP7HHu68c4QUdnHcDQYOTcqexmnIkRHp LumIOqQbJT87faMzZl4/JttzyeE1DOH+YFFlWP4ndS5PVZgADgJW4aeyHtluUvC0ctbZ qKqkw6SGIr9nM8gVVw5qEiOFROx2O14JIHs2/7Rp15jQsTUdp1yTPTbqxwJf7JmukdUp 8nLrZZ63HZw9IIO+1p24dJ0xIsTT1hJETydQy5h38zq/AdpocxDSKtzbfE5b7rEYvnxT MfGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194518; x=1690786518; 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=vWBYX+czO68YBn+sruZR19OlwAnKUpeq8kLfDlKJ0tE=; b=ZA4SUmky4d2aI3flVDCwrcJ/eWlkllQWDSEdRymHEDgJcWxNBnoXto0Py6dip7eglg VLyiXDd969KmhDiLKHJn2Hb8gdhyVFwkl0kA6jjXVMAdlw3At4ARd+uw4eFQJBo5zu0m qw3g9DLf/5hxdF2vpDnc4UlmBvRNJTwBRk34hDH3PXWNyUm/76YMaChuMkuMP6nYLWYI rO67LkvR+Cbf5RHAYTwH6EdZh/iqrXB0KOXxGiK4DjCHRCfkrs3Y7mIlCu8iNTktYke8 AElSUvqmFGRPxQvIIY7U9W3jQj06j9IwkgVDE1gxnzk4L87f8brzr98b3hNYIeM49f0g 5WVw== X-Gm-Message-State: ABy/qLaEA55QNOds2K/n+oI+xL2u7EEOADRNM/unoyjeZlgGBDx3oHv7 8Y8Dsmr8ejvZPQRsj7NrE8RkbwYBFFGbBEIl5uQalg== X-Google-Smtp-Source: APBJJlF7VAlWOwuqKptLfiCxl/kYNsbbWs5q1az77BClaZHS2vXxwqsgmVPfL2dJduRtpS5iTTJ+2w== X-Received: by 2002:a05:6512:1112:b0:4f8:7503:2041 with SMTP id l18-20020a056512111200b004f875032041mr4320265lfg.37.1688194518190; Fri, 30 Jun 2023 23:55:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 08/11] target/arm: Use float64_to_int32_modulo for FJCVTZS Date: Sat, 1 Jul 2023 08:55:07 +0200 Message-Id: <20230701065510.514743-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194653482100002 The standard floating point results are provided by the generic routine. We only need handle the extra Z flag result afterward. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Message-Id: <20230527141910.1885950-5-richard.henderson@linaro.org> --- target/arm/vfp_helper.c | 71 +++++++---------------------------------- 1 file changed, 12 insertions(+), 59 deletions(-) diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c index 36906db8e0..789bba36cc 100644 --- a/target/arm/vfp_helper.c +++ b/target/arm/vfp_helper.c @@ -1120,68 +1120,21 @@ const FloatRoundMode arm_rmode_to_sf_map[] =3D { uint64_t HELPER(fjcvtzs)(float64 value, void *vstatus) { float_status *status =3D vstatus; - uint32_t exp, sign; - uint64_t frac; - uint32_t inexact =3D 1; /* !Z */ + uint32_t inexact, frac; + uint32_t e_old, e_new; =20 - sign =3D extract64(value, 63, 1); - exp =3D extract64(value, 52, 11); - frac =3D extract64(value, 0, 52); + e_old =3D get_float_exception_flags(status); + set_float_exception_flags(0, status); + frac =3D float64_to_int32_modulo(value, float_round_to_zero, status); + e_new =3D get_float_exception_flags(status); + set_float_exception_flags(e_old | e_new, status); =20 - if (exp =3D=3D 0) { - /* While not inexact for IEEE FP, -0.0 is inexact for JavaScript. = */ - inexact =3D sign; - if (frac !=3D 0) { - if (status->flush_inputs_to_zero) { - float_raise(float_flag_input_denormal, status); - } else { - float_raise(float_flag_inexact, status); - inexact =3D 1; - } - } - frac =3D 0; - } else if (exp =3D=3D 0x7ff) { - /* This operation raises Invalid for both NaN and overflow (Inf). = */ - float_raise(float_flag_invalid, status); - frac =3D 0; + if (value =3D=3D float64_chs(float64_zero)) { + /* While not inexact for IEEE FP, -0.0 is inexact for JavaScript. = */ + inexact =3D 1; } else { - int true_exp =3D exp - 1023; - int shift =3D true_exp - 52; - - /* Restore implicit bit. */ - frac |=3D 1ull << 52; - - /* Shift the fraction into place. */ - if (shift >=3D 0) { - /* The number is so large we must shift the fraction left. */ - if (shift >=3D 64) { - /* The fraction is shifted out entirely. */ - frac =3D 0; - } else { - frac <<=3D shift; - } - } else if (shift > -64) { - /* Normal case -- shift right and notice if bits shift out. */ - inexact =3D (frac << (64 + shift)) !=3D 0; - frac >>=3D -shift; - } else { - /* The fraction is shifted out entirely. */ - frac =3D 0; - } - - /* Notice overflow or inexact exceptions. */ - if (true_exp > 31 || frac > (sign ? 0x80000000ull : 0x7fffffff)) { - /* Overflow, for which this operation raises invalid. */ - float_raise(float_flag_invalid, status); - inexact =3D 1; - } else if (inexact) { - float_raise(float_flag_inexact, status); - } - - /* Honor the sign. */ - if (sign) { - frac =3D -frac; - } + /* Normal inexact or overflow or NaN */ + inexact =3D e_new & (float_flag_inexact | float_flag_invalid); } =20 /* Pack the result and the env->ZF representation of Z together. */ --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194585; cv=none; d=zohomail.com; s=zohoarc; b=bGm82xz9KM+D4yuwGMe7MvsHXPbWFqJgGL6Gi9Fqt0mk+FRZdaCoru3e00mgGamAXg9ZbcjNXkMGn9EcM1PaQ8hEk51WE78Z49qckTtXUgFFfponz4nbjR+mVRDFZu/11suLDL5O/quTw6M/WQo4Y1PRPE/A6qTY3K5I5w5zxMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194585; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/ebwpgVZtFJocO+oyA17J6u/jt74rZXaJP0shDH6azA=; b=YyxC6QVbFzR+mLFcvq+Levg9EO7q7c3Zi6DiOvxqqA4e6TF736MEzexRVz/WzfMGS1tl++d77y9a8339cQ2KexoRhDE5OlDu3+yjw2Wzu29OyJ4KR2WyNeaWhtPF+gOch756WB4j9xNsjoY9jGB4SIZz5Sw74T/pzfVOQn71dnM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194585761751.0530626303546; Fri, 30 Jun 2023 23:56:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVw-0007Xz-No; Sat, 01 Jul 2023 02:55: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 1qFUVt-0007VY-M5 for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:21 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFUVs-0007Fq-3E for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:21 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fa8cd4a113so28375235e9.2 for ; Fri, 30 Jun 2023 23:55:19 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194519; x=1690786519; 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=/ebwpgVZtFJocO+oyA17J6u/jt74rZXaJP0shDH6azA=; b=FofdKOAmr4bQD6X7PS92YgE+Xlh0cnUbS4S2sE3Wx2rg3fK2OjBS6L7Glj6LS2KGGX ri1g3DbT/PorsDbBoeVDUsBEOT8/hVNL66q2JyzwLJFgkyCs8xZlKCRAeD1pvoZbKpYD JnVERKhPQfote0OfOVudSy5OWKVop+o+jyjybR8rbFvVq5isBPS9XLoB2/eiDk08nzmB lml6D8fT+eN5K9u1YsERfKl+ysjBzn5fVdNDAcbX+rPbz8R0qBZ3Tn/Fkwlf6CLRrGSm hXMCL8C6gvOjU5uUS/bMRcuCse6XD4QTolOTQHcpJbGdpskSA3iw7/ziGJIGC2Rr1H4w JqAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194519; x=1690786519; 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=/ebwpgVZtFJocO+oyA17J6u/jt74rZXaJP0shDH6azA=; b=Werk9VyLGZv5q1bla/y3awcpNQpo4uExH7iqittbL7xLMtzVanwrFdPHXwVmDu8w0C nFEcKhi3U4aVL/+RkPJgx6XluxS28e5JFq5Dg1ryWCyAPFYeJ8/OTVGgYMR/TD2D4RiB ZfK4I04VPkLuu3QEy/EH8sGyrm+vHYP4GTaRx79uE0TdhQSTDAtBu0zVuCckPIubmJc0 1MQpZkeV01U11AUbzPzoxeZ6M40jEwXrjuEgoiXXJDAIYtJCpgRkDfg5rn8X00me/irT BSS6jWG6XOL/g5HBeyMKbKJ8SSmmobZaHb/LX1bFZGIhPPIYR5nQCFRnT6PzPFqn6aL8 k8CQ== X-Gm-Message-State: AC+VfDyRjgn8u0KaeG931xItbfjDzzkdC7MWZJOAvfeZRb2tLJxqBusz 8/0m9tgoFiSa3QhFFd192YtC3BSgt7Ceeco+t+n2/Q== X-Google-Smtp-Source: ACHHUZ7tMRycPOHGU9NjX+/lC/hGY1yF2D4zhfpNJaxAtNTPsk5Krr7WFm1sqkfMxy+8e1gO4Aaplg== X-Received: by 2002:a1c:7908:0:b0:3fa:99ae:3a9a with SMTP id l8-20020a1c7908000000b003fa99ae3a9amr3579806wme.2.1688194518872; Fri, 30 Jun 2023 23:55:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 09/11] tcg: Reduce tcg_assert_listed_vecop() scope Date: Sat, 1 Jul 2023 08:55:08 +0200 Message-Id: <20230701065510.514743-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=richard.henderson@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194586997100013 From: Philippe Mathieu-Daud=C3=A9 tcg_assert_listed_vecop() is only used in tcg-op-vec.c. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230629091107.74384-1-philmd@linaro.org> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 6 ------ tcg/tcg-op-vec.c | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 95541e9474..0875971719 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -1135,12 +1135,6 @@ uint64_t dup_const(unsigned vece, uint64_t c); : (qemu_build_not_reached_always(), 0)) \ : dup_const(VECE, C)) =20 -#ifdef CONFIG_DEBUG_TCG -void tcg_assert_listed_vecop(TCGOpcode); -#else -static inline void tcg_assert_listed_vecop(TCGOpcode op) { } -#endif - static inline const TCGOpcode *tcg_swap_vecop_list(const TCGOpcode *n) { #ifdef CONFIG_DEBUG_TCG diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 64bc8a2156..ad8ee08a7e 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -42,9 +42,9 @@ * tcg_ctx->vec_opt_opc is non-NULL, the tcg_gen_*_vec expanders * will validate that their opcode is present in the list. */ -#ifdef CONFIG_DEBUG_TCG -void tcg_assert_listed_vecop(TCGOpcode op) +static void tcg_assert_listed_vecop(TCGOpcode op) { +#ifdef CONFIG_DEBUG_TCG const TCGOpcode *p =3D tcg_ctx->vecop_list; if (p) { for (; *p; ++p) { @@ -54,8 +54,8 @@ void tcg_assert_listed_vecop(TCGOpcode op) } g_assert_not_reached(); } -} #endif +} =20 bool tcg_can_emit_vecop_list(const TCGOpcode *list, TCGType type, unsigned vece) --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194633; cv=none; d=zohomail.com; s=zohoarc; b=ihNijtxpFrAQNNz7cfRgGugrT7gtI6krDyWuUm8WwPvNRvMgMpkBWkc6wHVPf68Xwz9fkQPx9+vDnO3DBNje6sO4GY9JAJjYORPTdMQCP7foKErkP3oO3XWBCIBzf2IoLQtdYaWIDpRSsDKdnlQfp6ILBDO0I5vqT47wDK7VZ2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194633; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aeKcGtvpiTjSJLKdv4xRCsQ244TAR26gRApECngoPiQ=; b=Fe7woOgkIhJ3ZZICR2j7aXd4JeXphRVXv4hHQ4dHuNd+cE9Rb/OoUTanMDeuIVH8vEc2KHnSynWvsBPgj7RV8scdHekdMjg6lIO5DIowRP9yqFrPsJYzBecA1iqQ1xCEUJoJSeEImYYGgvBL+jgGWBm4sn0MS4RKqEaC4EzphFs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194633736162.3125217068142; Fri, 30 Jun 2023 23:57:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVx-0007YC-6o; Sat, 01 Jul 2023 02:55: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 1qFUVv-0007WZ-FI for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:23 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFUVt-0007G4-Dm for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:23 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4f4b2bc1565so4466160e87.2 for ; Fri, 30 Jun 2023 23:55:20 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194519; x=1690786519; 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=aeKcGtvpiTjSJLKdv4xRCsQ244TAR26gRApECngoPiQ=; b=CsRY+JExuzDO931hzhM5mDAGVzzLs93Pb4SwflP7BHXCwAusJpK6vhUz6v+nxoX0EF uATqEalmo5vDrZfhfdqViEXZkcRVx/IqYpZy914fUNLTieKKo4d6ass7dD/MVWgUMA3Z aTCxWs0fQswlBpEUUEo+fW9Hw2lIW1LDGRJRcmJGb6BPTIcMcP2Sgk5BVGOuXobnlHW2 UCA+ZH1CnW5pTk5adXgqItC3kX2SuIdiAcCGMiKOUOAgOfPpR89a0cMwOVw+ttLsvHsl dz2U5ycHH85APPTgnSIwJv1tescaReFig/5OiVVlsqJyR7YyLk4+2fH1YF3ghBFlv+T6 pfdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194519; x=1690786519; 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=aeKcGtvpiTjSJLKdv4xRCsQ244TAR26gRApECngoPiQ=; b=fyzEVImPYDY71Kq2lEhpYZKDmVEfu/ngDMEVeNf3kh+ya6rxer1qEi5Fu1lgrdCrS9 pcxn2MaT6PyGf51TnJk+7VACTYFbtaxsX2NuVzfiGY743NDKwnvDiWbCun+mLvC8qE9r 4TCRdo1aMrUHB4hq6iysZrBKb0ibaLGt0SrbzjVb824LQlqkFQ3/sCffCr5I02oquuIp Tiaip6uuD8qB+8vHhwo4HnWyA4tpGRhSmiSG14P2U7DlOb34FbUTeZ9csHo+g5B7NdTk oeIIDbaS2YOtXPGPN8LtrWM7yU/UGUpJ+uQlGisTXLDsZytCgjQRRfOS3czGwiPyblxz Q/Nw== X-Gm-Message-State: ABy/qLbHG9pbobJAvm+Miu11yKU2Y7dhyi3+vF/u57weJlLNU4d81xhd JeA8O367a2xGUJ9nKLs+UWrbM9rzDUW3ke0N/lBYDw== X-Google-Smtp-Source: APBJJlGQwWv8IIcGJCU9R7RYJ+SgY+cIryneHe5WOjrBxDdtxL2AlDsVOqLhk364i+zNmX04hsvUYw== X-Received: by 2002:a19:8c14:0:b0:4f8:7754:62e1 with SMTP id o20-20020a198c14000000b004f8775462e1mr3554746lfd.40.1688194519514; Fri, 30 Jun 2023 23:55:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 10/11] target/nios2 : Explicitly ask for target-endian loads and stores Date: Sat, 1 Jul 2023 08:55:09 +0200 Message-Id: <20230701065510.514743-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=richard.henderson@linaro.org; helo=mail-lf1-x12b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194635295100007 From: Peter Maydell When we generate code for guest loads and stores, at the moment they end up being requests for a host-endian access. So for target-system-nios2 (little endian) a load like ldw r3,0(r4) results on an x86 host in the TCG IR qemu_ld_a32_i32 r3,loc2,al+leul,0 but on s390 it is qemu_ld_a32_i32 r3,loc2,al+beul,0 The result is that guests don't work on big-endian hosts. Use the MO_TE* memops rather than the plain ones. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1693 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20230623172556.1951974-1-peter.maydell@linaro.org> Signed-off-by: Richard Henderson --- target/nios2/translate.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index a365ad8293..4264c7ec6b 100644 --- a/target/nios2/translate.c +++ b/target/nios2/translate.c @@ -436,19 +436,19 @@ static const Nios2Instruction i_type_instructions[] = =3D { INSTRUCTION_FLG(gen_cmpxxsi, TCG_COND_GE), /* cmpgei */ INSTRUCTION_ILLEGAL(), INSTRUCTION_ILLEGAL(), - INSTRUCTION_FLG(gen_ldx, MO_UW), /* ldhu */ + INSTRUCTION_FLG(gen_ldx, MO_TEUW), /* ldhu */ INSTRUCTION(andi), /* andi */ - INSTRUCTION_FLG(gen_stx, MO_UW), /* sth */ + INSTRUCTION_FLG(gen_stx, MO_TEUW), /* sth */ INSTRUCTION_FLG(gen_bxx, TCG_COND_GE), /* bge */ - INSTRUCTION_FLG(gen_ldx, MO_SW), /* ldh */ + INSTRUCTION_FLG(gen_ldx, MO_TESW), /* ldh */ INSTRUCTION_FLG(gen_cmpxxsi, TCG_COND_LT), /* cmplti */ INSTRUCTION_ILLEGAL(), INSTRUCTION_ILLEGAL(), INSTRUCTION_NOP(), /* initda */ INSTRUCTION(ori), /* ori */ - INSTRUCTION_FLG(gen_stx, MO_UL), /* stw */ + INSTRUCTION_FLG(gen_stx, MO_TEUL), /* stw */ INSTRUCTION_FLG(gen_bxx, TCG_COND_LT), /* blt */ - INSTRUCTION_FLG(gen_ldx, MO_UL), /* ldw */ + INSTRUCTION_FLG(gen_ldx, MO_TEUL), /* ldw */ INSTRUCTION_FLG(gen_cmpxxsi, TCG_COND_NE), /* cmpnei */ INSTRUCTION_ILLEGAL(), INSTRUCTION_ILLEGAL(), @@ -468,19 +468,19 @@ static const Nios2Instruction i_type_instructions[] = =3D { INSTRUCTION_FLG(gen_cmpxxui, TCG_COND_GEU), /* cmpgeui */ INSTRUCTION_ILLEGAL(), INSTRUCTION_ILLEGAL(), - INSTRUCTION_FLG(gen_ldx, MO_UW), /* ldhuio */ + INSTRUCTION_FLG(gen_ldx, MO_TEUW), /* ldhuio */ INSTRUCTION(andhi), /* andhi */ - INSTRUCTION_FLG(gen_stx, MO_UW), /* sthio */ + INSTRUCTION_FLG(gen_stx, MO_TEUW), /* sthio */ INSTRUCTION_FLG(gen_bxx, TCG_COND_GEU), /* bgeu */ - INSTRUCTION_FLG(gen_ldx, MO_SW), /* ldhio */ + INSTRUCTION_FLG(gen_ldx, MO_TESW), /* ldhio */ INSTRUCTION_FLG(gen_cmpxxui, TCG_COND_LTU), /* cmpltui */ INSTRUCTION_ILLEGAL(), INSTRUCTION_UNIMPLEMENTED(), /* custom */ INSTRUCTION_NOP(), /* initd */ INSTRUCTION(orhi), /* orhi */ - INSTRUCTION_FLG(gen_stx, MO_SL), /* stwio */ + INSTRUCTION_FLG(gen_stx, MO_TESL), /* stwio */ INSTRUCTION_FLG(gen_bxx, TCG_COND_LTU), /* bltu */ - INSTRUCTION_FLG(gen_ldx, MO_UL), /* ldwio */ + INSTRUCTION_FLG(gen_ldx, MO_TEUL), /* ldwio */ INSTRUCTION(rdprs), /* rdprs */ INSTRUCTION_ILLEGAL(), INSTRUCTION_FLG(handle_r_type_instr, 0), /* R-Type */ --=20 2.34.1 From nobody Fri May 17 11:58:55 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1688194624; cv=none; d=zohomail.com; s=zohoarc; b=KkwYS7eiJSdZKkrT0Wo54VTfDOecpO71UG2nGeFOP3II9jz0x3QDiBzMAUTQJT8diXlPJAoUdEOcJBlUhxTqbzDay6Lg0Q3c7DUF/vipOVWyyx41mQwsdWLPSI02PqsnCKOWj3BpGiLPAkx3M4nr7yS9JZGaTbelEhJPjyiJKWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688194624; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H+qtKArYQsrn/b+NQpVzVpVv88M5134YWuGW3InQxAY=; b=YgwfPH7lI0CxHi/9ybHKGIKIZcxD/pQRB5HI/MKw5EPmEf4yVVsoggEM8npKEeAonHdU8z1gWgKnFBayS7Ntw/xpmfth+gEtl3p5fCsE0RO1YfXR6N065FE871ymGzyoGMOEt54XscXeOuab+Ui477nnFrmUjlkLRSfxhjkQlrc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688194624894592.846125664145; Fri, 30 Jun 2023 23:57:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFUVx-0007YD-Bz; Sat, 01 Jul 2023 02:55: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 1qFUVv-0007Wa-Dm for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:23 -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 1qFUVt-0007GD-Hb for qemu-devel@nongnu.org; Sat, 01 Jul 2023 02:55:23 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3fbc0981756so24377305e9.0 for ; Fri, 30 Jun 2023 23:55:21 -0700 (PDT) Received: from localhost.localdomain ([139.47.41.96]) by smtp.gmail.com with ESMTPSA id w10-20020a1cf60a000000b003f9bd9e3226sm20874918wmc.7.2023.06.30.23.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jun 2023 23:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688194520; x=1690786520; 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=H+qtKArYQsrn/b+NQpVzVpVv88M5134YWuGW3InQxAY=; b=cAZnbS3BQNJwY0a1ELCkEpvhj8/hYssPgwQk1GF1cuHbY1XVNqKzy0H6kO7ZyaGDRs tY8le5Ov4apcusKs9G4349GneSyuJ4h7spledhwUMujROPtQI/HQXTN3n0Zk+8THyRlD 5JiPbPK3+btqICAnxTKCt5kUpLUvooJ64G2sPvluAF+gIeWhIhDBZDo5HGunGXbxEylV P0Z8Ti9x6lfbW8eticMphotCT7CP9wHMkfLDfPgpD9MRod7yuQzFg5G8H1Q4012fZk3P du6o0oSPD4+NOo//PvN8z0PiGVQTYjXMVHmS9kp90ZH8ckGO63iT2kGRjqZqwZGh8pUL i1cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688194520; x=1690786520; 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=H+qtKArYQsrn/b+NQpVzVpVv88M5134YWuGW3InQxAY=; b=Diq47pCWTDzuK7NNpQIPbUn9ML+AozOB83H5z/yA7QrvzaLGTLZJVUrvIUcrPsVBT2 XsbhwTeLTR206qLlB7iV3OXXObz5+wRL28Wjay53U4CeSsioVj9vOuQu49gcWiax3ANB jsu2Wxbx+35QA5cTx5QxMHWTajZlPq6DkpTlSQI/mXpNgTAwaUrQsDxwRL/WbyV7u4Uy SiFYjDDPaPP0n5OIwmcjvibv/09zrdD/aeV3AlzXsl/qZLUm3qJ1fIJSXaueL7AUaL8I nZpRL6kGL8xjXg4QZdoPVCNp++4UWA1nqD4Q4aZOiLWww3M0453XYfBbN4laAiOxxfcO pwJQ== X-Gm-Message-State: AC+VfDwZgz5h8mpL+LJPGPk5Qn1BaoWKWMrUVcNguaJAa4UE1PZ1J+aW gbN2Ova6oetr7+42IJ3ecDeMVSxDTXxN4voG7EI1tg== X-Google-Smtp-Source: ACHHUZ6tLHYBTi0aeTx4soXS//fxIqkikatLPTS9jaYnAN+YS14GXa+UGVZaFMIUHNXAJyDDYGf6ZQ== X-Received: by 2002:a1c:7908:0:b0:3f8:fb7c:6793 with SMTP id l8-20020a1c7908000000b003f8fb7c6793mr3248980wme.24.1688194520279; Fri, 30 Jun 2023 23:55:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Michael Tokarev Subject: [PULL 11/11] linux-user: Avoid mmap of the last byte of the reserved_va Date: Sat, 1 Jul 2023 08:55:10 +0200 Message-Id: <20230701065510.514743-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230701065510.514743-1-richard.henderson@linaro.org> References: <20230701065510.514743-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=richard.henderson@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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1688194625474100001 Content-Type: text/plain; charset="utf-8" There is an overflow problem in mmap_find_vma_reserved: when reserved_va =3D=3D UINT32_MAX, end may overflow to 0. Rather than a larger rewrite at this time, simply avoid the final byte of the VA, which avoids searching the final page, which avoids the overflow. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1741 Fixes: 95059f9c ("include/exec: Change reserved_va semantics to last byte") Signed-off-by: Richard Henderson Tested-by: Michael Tokarev Reviewed-by: Michael Tokarev Message-Id: <20230629080835.71371-1-richard.henderson@linaro.org> --- linux-user/mmap.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 0aa8ae7356..2692936773 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -281,9 +281,15 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong star= t, abi_ulong size, /* Note that start and size have already been aligned by mmap_find_vma= . */ =20 end_addr =3D start + size; + /* + * Start at the top of the address space, ignoring the last page. + * If reserved_va =3D=3D UINT32_MAX, then end_addr wraps to 0, + * throwing the rest of the calculations off. + * TODO: rewrite using last_addr instead. + * TODO: use the interval tree instead of probing every page. + */ if (start > reserved_va - size) { - /* Start at the top of the address space. */ - end_addr =3D ((reserved_va + 1 - size) & -align) + size; + end_addr =3D ((reserved_va - size) & -align) + size; looped =3D true; } =20 @@ -296,8 +302,8 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong start= , abi_ulong size, /* Failure. The entire address space has been searched. = */ return (abi_ulong)-1; } - /* Re-start at the top of the address space. */ - addr =3D end_addr =3D ((reserved_va + 1 - size) & -align) + si= ze; + /* Re-start at the top of the address space (see above). */ + addr =3D end_addr =3D ((reserved_va - size) & -align) + size; looped =3D true; } else { prot =3D page_get_flags(addr); --=20 2.34.1