From patchwork Sat Jul 1 06:55:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698311 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813181wrs; Fri, 30 Jun 2023 23:56:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6tlP2ZPVqiiVsleMLFHFma6TpXVsVKuqdkVQ+x1ZebyVbhUEV7WNPzVJcPQUvLDuqpo9PP X-Received: by 2002:ac8:5d8a:0:b0:403:2dfd:1fdf with SMTP id d10-20020ac85d8a000000b004032dfd1fdfmr6004588qtx.23.1688194587929; Fri, 30 Jun 2023 23:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194587; cv=none; d=google.com; s=arc-20160816; b=f2cu1BxUcPVmRi1r8rgi8Oqs30Vc0rRgqOEGHOm8Yaa8XLpex1F6VqUwr5dYPPQYsD WijPTHpd+XnBNkHAPPVPraWIag+RgAy86e9uZAmD6R6+HCWT/2P7RRsG7RUaeEqrFAbU h3cCtvNmcxSJR1+l8UTQD5frISYKKPB4RoMZAxWW8HqZHdnQBSUFbVqW9SK0GgtkIDvb PTdneGT4MjGpcZneJjiOo0rUDt7mEtObaCNmlEo6kvRH9Icg93mE9ivUyAXOdyp1d35k FilS3X2gcP87Jl1IMLiw8NP9hBbm63C3P6XVXld1jnyD3twNlC+OWpWDyT5ChlgpJAls xkqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=R6W2wZouwSAQes85QIyt+CMmBwG3afd8TW13hztwuFc=; fh=D1j2pdWvo2mvjOI8LoamvmL4nL96dKib4VtmD702CtA=; b=CMB5rIgJtjBDgcPul4l3xsFn19mWuoABHLFe/UoQOvy5Cs+HqUqC21AY+z6ykLlC1S Vcjxobb5VsMiHH8eK4iHCwTb5lSAZGkSG4F53ACeecrVE00bDh6l4FIB0mZYEKFrx1mj bHYLfUGVXSHbk8CmebQmLak8gQqQHDosfB8AGLVpUylqLa1L3wmI6VyaKpMCBxMGb67d GfXamKybGOx54Xz71SyJfueOlNTX+QxpSxdjx25yj+/pPnU4avKPHXuibGcndJV49YVc ECQP24AiBcK4G/43BiE69KZ20oLXHKGfjwNyOXG04CLIe3Wc47fmd1WYtuRnV8N1FeT6 fLJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FUVbFDLB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n7-20020a05622a040700b004021ce498c7si6875242qtx.803.2023.06.30.23.56.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:56:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FUVbFDLB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 */ +#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 static void dbus_call_update_gl(DisplayChangeListener *dcl, int x, int y, int w, int h) { +#if defined(CONFIG_GBM) || defined(WIN32) DBusDisplayListener *ddl = container_of(dcl, DBusDisplayListener, dcl); +#endif trace_dbus_update_gl(x, y, w, h); From patchwork Sat Jul 1 06:55:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698307 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813168wrs; Fri, 30 Jun 2023 23:56:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4aSM+WfHOA3D89F9hGlAh8KUBzcr20VGychZPE19FLOKLciYxFOv6hOC5Tk5YzEGw+WHoW X-Received: by 2002:a05:622a:1894:b0:400:926d:4674 with SMTP id v20-20020a05622a189400b00400926d4674mr6881692qtc.22.1688194584487; Fri, 30 Jun 2023 23:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194584; cv=none; d=google.com; s=arc-20160816; b=l6jGOLLzyxtUPWVkVRUpSrMr4U7P8DF3WqCu+JxIGaEaIKvrmLvDapJFmQDF7t9jLf /KR74c5USbA6MjMVTLpL5VGIevT9kQdaOvgjIfIpbKFTbHsniLJkCavOgdAY8OFgUcsz xwJZRZygHlPkb6j9GL23pJwGFqIQOKLexIQ+Gg4b+wF6F/x0ch3Ue0UZJdGgVySgq4cd lvrU8ZrzOkLIf8w+ayvwBa/2HB58Yi3zYfU+38AIwnOK5ftx/klfZ3e3LYmevR7286XJ 27yb7Z606JrQzNVWeR+yAdygF75tr9ob0RokDmsW0r+cJaM41OYNYFgbvbJ/PcDFlapx XQOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pcc6HB+1pxARPpW2OAO7nKJmZp3YAW//z7LTAV54n+o=; fh=tfEje4Ht2aBpo4HMBfoER0+NqeUrm38NbHXmt421kNg=; b=y1anzMcoyOkBp1wBXY7yHTNzbhmUHfpke5f3k0icuqeWKl7BZS1sCMUrt44TUvtR8l pFxevcKgxMADAMKL9BAP5Lz/i/ZWk/a/bxCoUg9/o3XR/wCaqO2H2hJyt0lAF3227WBj tv+qDy7J1kC7SlS/eFuTskP64IHPKACicFL+UuqQqSCy6fdBpAz5m7aYEhN8XdLmTQJj CkDOFchMcPuVqdQywFriD5hHAaf/sa7GwdY1uQpWnp3iOCegi/qIZefnHPiY87xq4Z+J Z8O8NC0ITSS2yB45D03Wshg/7oabmAOPIoa38vyN0P/tdqJ/xMuAWeRLqMYrwE/HzE3D 6GEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DNIRUitm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p17-20020a05622a049100b003f956866873si8846124qtx.212.2023.06.30.23.56.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:56:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DNIRUitm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Marc-André 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é 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 if dbus_display module_ss = 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 += {'dbus': module_ss} endif From patchwork Sat Jul 1 06:55:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698308 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813170wrs; Fri, 30 Jun 2023 23:56:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yiCtzDD3NcNvHcJZ6MOzfbuLo5R3G1v8cG7L2f1et8FjbFYdvVzI2tVORr9rFOXzxexIw X-Received: by 2002:a05:620a:b57:b0:765:ada8:e939 with SMTP id x23-20020a05620a0b5700b00765ada8e939mr4920242qkg.28.1688194584733; Fri, 30 Jun 2023 23:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194584; cv=none; d=google.com; s=arc-20160816; b=jRztaccHTvnDRCyXPe32RgfF9zWYBpXTiJpJQ2uow8F5gJ7zPUVKolkQP+/pR4j+Wk s4EFh6YNatxU26Yt2mIZpZLhVCgT53CL2C6hFgToPZ4kfppgDNicIkK186JkGg1H7w9w lRwQ0kpE1K0MgsKGRhyUGr00u6OgDVDXek2/9uXE2jxdXmFOeItXIN6ZvL0w98jaiirZ M3ZMH5IkNhSE+Kf0StlSIFbitIHbYQE2hrDikzOqTSsMstGU0UuANbRISa9l+jx/upvA w/+hbS0P71L/Vlpk83EQqTI4Or+ZW2zXUUGXpUZ9G3QkbAHBGBY9uiNirAs5gKvmkisJ whlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Fh8ll0z1/lWAw6IZ8VRZwP3jq46crriqiBekj/aaK3E=; fh=rYI8DiHAAFX3O5g969KmOAQ7d45Sb8OxQX1+DywGDk4=; b=Y+izgFOlXrvLxNvXC3BeM0FfT31rgyjkyEVvYHuOieGXk5n+nTY71dI1plO4hfiaL+ Ru1zdf08Lwc25BVGYmRNlh/P6TFSYbuoI11C3ZvvRctpsVc7KlToDnje784qinBcFH4j Vt8Yb+mtoLOoF9msF/evZl2Poy3k4W3G22mqjdJgr9bwUdNJ4cUhtv2wryMl6MmrJfC0 xDyP+koojh8lWOtUo4E/DO0py5uKn4xFE9+Lll6YrdBDw24lXvqfltYB/qF82I/CEZRE rv8YMwVDzIINvf4HQlyIlKdlSW7cxMexXUdZn2eJhNUjM1lJDnCZsHJT0mrn+Qvoorot fLmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mj4XliJD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o18-20020a05620a2a1200b007672ac73968si5174243qkp.519.2023.06.30.23.56.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:56:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mj4XliJD; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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_range") 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 = last >> TARGET_PAGE_BITS; for (index = start >> TARGET_PAGE_BITS; index <= index_last; index++) { PageDesc *pd = page_find(index); - tb_page_addr_t bound; + tb_page_addr_t page_start, page_last; if (pd == NULL) { continue; } assert_page_locked(pd); - bound = (index << TARGET_PAGE_BITS) | ~TARGET_PAGE_MASK; - bound = MIN(bound, last); - tb_invalidate_phys_page_range__locked(pages, pd, start, bound, 0); + page_start = index << TARGET_PAGE_BITS; + page_last = page_start | ~TARGET_PAGE_MASK; + page_last = MIN(page_last, last); + tb_invalidate_phys_page_range__locked(pages, pd, + page_start, page_last, 0); } page_collection_unlock(pages); } From patchwork Sat Jul 1 06:55:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698313 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813227wrs; Fri, 30 Jun 2023 23:56:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlGHD552dcBydTSYtSkcLwUVhfdecOVZolNECdfhyUc289D+cz8wdHHqdWQFkmCskgbQkmLO X-Received: by 2002:a05:6214:124c:b0:5f7:a9e1:bbbf with SMTP id r12-20020a056214124c00b005f7a9e1bbbfmr6842151qvv.44.1688194603402; Fri, 30 Jun 2023 23:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194603; cv=none; d=google.com; s=arc-20160816; b=zIMuplRb772J/CPqs45oRFAmL6iYV6mjTd3HaXa1cgUlD1TsMRHTPlhQAL/ri/pBbV YNfed5jfuqWLy2S6O3NS8mSKinIMGhiM6uNIdtIJTneDOZKlPUwWd+A+dq2aokGa1/nt f3ELsNCjFKQTi78acGMVGwSkphM5hVfRCHg0ml/Y5XmyPyR5r6+xKJ3P4P/yUlIMgtum C0fcfcBAne2Kel2mj4fSuVYsNh2HU51ulder2JmVNoq8Fe+mHRtdR8e4TFzELaV5GFPh 9OJ3Ojsof43aZD/oKKrcFewBbYBZKaeEpDGklRRMI77qTN/FIG+2EfrwhvUsV5r5ROrM 9HrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=guLrkyvnxpE2Di61jdSFFK1pil20iWnpknoQn5xGxP4=; fh=J4M4Z4TZxvAT8lkmK1LtxqMjpO7Qiod4IMBL2bk0hxA=; b=QQaK3lqat656+qb85CaWTnAgq98m9gN3oCBOxuz5hLWzpuiR8AGmMgYbNoTTPKi0la hZgpiyTFUO2+0k1UK6fdq25HAjv9kcsG+tXFuLAXWYdMpEb0z1cuPKBEeuWLUdv8ASpM eG8CIBFbLwK0rmB63kXx0YgZz+tNKlWQP/CAuoB74ZPXlWgIkeJYG90UEtvNKTD87M2e 1vTdiXWtExSZRUZZanky6WDxTn4ljnA2/HCNEsZfQiIlPHyceBI759vUwOcNt64S45Kd M0gAmfuQcNzOV5Oxg7AjAmmsZJg6QGD+8eMYtHowzGwyOX2W/DFaXHs5qyDHKv/uJ7pF KQcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FvKPMtka; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dv4-20020ad44ee4000000b0057104cd4825si9139498qvb.68.2023.06.30.23.56.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:56:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FvKPMtka; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Mark Cave-Ayland , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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_collection *pages, TranslationBlock *current_tb = retaddr ? tcg_tb_lookup(retaddr) : NULL; #endif /* TARGET_HAS_PRECISE_SMC */ + /* Range may not cross a page. */ + tcg_debug_assert(((start ^ last) & TARGET_PAGE_MASK) == 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 From patchwork Sat Jul 1 06:55:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698312 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813214wrs; Fri, 30 Jun 2023 23:56:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlHktdG5Fty2ypl0vmtZ2qVPxu/dsnMNH6xu+oo2UbPLNZNBh9d8jbnhCmIWU230WTrGp2N2 X-Received: by 2002:a05:6214:2502:b0:636:14d4:447f with SMTP id gf2-20020a056214250200b0063614d4447fmr7361253qvb.2.1688194599065; Fri, 30 Jun 2023 23:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194599; cv=none; d=google.com; s=arc-20160816; b=O/lHmabrOE/Bf/9zOMcjIWQwJN5+URilwCD8b2h5NbolBMVs40LbkU1WuPUHbELq1p 08btZCMaT6pLMor+FGXx8LKRJdlCWdQgwumq4OH+eqhWNpMU1oHyhd+QaLUlz5u+B1Aj kkeVXyTPyP5LZPA29k7JztDw9ZAADy2F1YynlZUHssqgcVzQGdzMSPfsNUQfljL6Usjg EN3A9gAJz9bhqOlWEAuK1pGlurN7BpqQ+gz8mJKe1pCkhc/6id8zMIEKqxqX3qq766Ss susbxLqVeTjOXXHFeRmx1zqSpC97PxBdXJLwApC2F97oDoVRSiqyBSRUIr7jG/9l3wka zhYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+mRZecGlk4y92NOTZCV4Vh1o10DfSN55KRLfHTObE+8=; fh=qarTHLiEbnGtZEZJETElgHcKhoRKM3RRmnug4p4nzno=; b=EOubonMaWlMJO2JbaE3LI4CCS+ZHXp5irZCHHLEGabi5kEfdRbSOVJKgSZn9FgmRYl SnuFapRsjaJIuZGP8KyD2plO6a1zPOSOtWvO9/Z8ETR+GQbkAdVwwiIE2U3PJiW+Zlcv xOPqPr7ZwydBV8o9oPhkDsSt/LF5CPctu9kSjESqQT3WTWits+/g+xzpZB2oGFAnR6Hg Q17Nzz1ljJHW1LMC1vR+4nLbPDp1jvYMrYYQsNCXVLQ+ONd6niK9VLyB7srKeri7O/q+ VhpCaizDSuY40ZDzGs8ER+EU58AokJNqwWTXtYJfSdXIadLXNJWqEdKsnmKnqCIYxkmy tjdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zm3ru0H7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fq7-20020a056214258700b00626291257a6si8960085qvb.305.2023.06.30.23.56.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zm3ru0H7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Christoph Muellner , =?utf-8?q?Alex_Benn?= =?utf-8?q?=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée 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_status *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); +int32_t float64_to_int32_modulo(float64, FloatRoundMode, float_status *status); +int64_t float64_to_int64_modulo(float64, FloatRoundMode, float_status *status); + uint16_t float64_to_uint16_scalbn(float64, FloatRoundMode, int, float_status *); uint32_t float64_to_uint32_scalbn(float64, FloatRoundMode, int, float_status *); uint64_t float64_to_uint64_scalbn(float64, FloatRoundMode, int, float_status *); 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) +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); +#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) @@ -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); } +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; } +/* + * 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 = 0; + uint64_t r; + bool overflow = false; + + switch (p->cls) { + case float_class_snan: + flags |= float_flag_invalid_snan; + /* fall through */ + case float_class_qnan: + flags |= float_flag_invalid; + r = 0; + break; + + case float_class_inf: + overflow = true; + r = 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 = float_flag_inexact; + } + + if (p->exp <= DECOMPOSED_BINARY_POINT) { + /* + * Because we rounded to integral, and exp < 64, + * we know frac_low is zero. + */ + r = p->frac_hi >> (DECOMPOSED_BINARY_POINT - p->exp); + if (p->exp < bitsm1) { + /* Result in range. */ + } else if (p->exp == bitsm1) { + /* The only in-range value is INT_MIN. */ + overflow = !p->sign || p->frac_hi != DECOMPOSED_IMPLICIT_BIT; + } else { + overflow = true; + } + } else { + /* Overflow, but there might still be bits to return. */ + int shl = p->exp - DECOMPOSED_BINARY_POINT; + if (shl < N) { + frac_shl(p, shl); + r = p->frac_hi; + } else { + r = 0; + } + overflow = true; + } + + if (p->sign) { + r = -r; + } + break; + + default: + g_assert_not_reached(); + } + + if (overflow) { + flags = float_flag_invalid | float_flag_invalid_cvti; + } + float_raise(flags, s); + return r; +} + /* * Integer to float conversions * From patchwork Sat Jul 1 06:55:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698309 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813169wrs; Fri, 30 Jun 2023 23:56:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jMzR2B0iVtKraB3QHN8/GLZdeOX6ZEMyoAMAA6X2uzmXeDi8BEfw205D8UN1yD5H1k1NK X-Received: by 2002:a05:620a:458d:b0:75d:4757:f492 with SMTP id bp13-20020a05620a458d00b0075d4757f492mr6324553qkb.1.1688194584517; Fri, 30 Jun 2023 23:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194584; cv=none; d=google.com; s=arc-20160816; b=bjgPvScPKynFu9CnHsJgSzpBC+qP6eyp4oOwam8Z3IFGpLybvJ/Q0991ltNCjyk41o LYbi90uJYflk/c/IebeC87ZxmxZzZNoZ1vryaC0oS2ZFixhsEk2rWITbANcmTnuGYfGb T5NTkN2DAn5M0mR5aYoW/N4rs44Vn5Fr0mNCQpfLCrCUkQPMeAxmcLATSr8r9+hp3Z2f TEWSkDe7eSjoGtqTua8uy+djvQYA34ASBHQ31J7akCYueMGY9rAL8cDcl0WMDLnapX4z THPJsCx5kK4z2jvGIgvJkbXRZqC2ezDs3X4SrcXE/SEfsQko/lruLaUek01ctVoqWktf 0cew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mV8nHx5xU3W2QWS3dGtP3xyCoVtszahnj86o5dz8D9I=; fh=eu2DY09p+eeddYDiV+DalJS3Vr0kxK5BujclYkgWvDw=; b=XovaO8p030IiaQvKndf6zbiQ351D9UHt/gVqbjLZkPZCqj0srZ6Izo0+QeUNoDyeTN lfGrV0GhIOCMsOCtLWdfpUQAAeo5yk5H45wRrOUZaYUTNgdUp6KEKop87r/ey14rAvU8 9MwcqXeK/gUcCmdGOGsWZjhkHv76FNt0XuEl41yQt+ERtcBmm9aa3awNoP21rTMpBZLZ rq1MJH2YRsnow6dhpCRQVcpZ2rP+DeX9fIxhSgYsD9KQ5u1xb95nXVlDgOpkOm4yL6kj eMOBDwA8xFZxyi1sfoCe15eu/M5Z9/dTmyFwpWjXo69H8eaeEGTIocjVm9XQemSlPSE8 upkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AnxN3oqO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w28-20020a05620a095c00b00765acf7ff28si7647296qkw.123.2023.06.30.23.56.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:56:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AnxN3oqO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Test for invalid, integer overflow, and inexact. Test for proper result, modulo 2**64. Signed-off-by: Richard Henderson Acked-by: Alex Bennée 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 = (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" + : "=f"(r), "=f"(e) + : "f"(d), "f"(reset)); + + *ret_e = e & FPCR_STATUS_MASK; + return r; +} + +int main (void) +{ + static const struct { + double d; + long r; + long e; + } T[] = { + { 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 = 0; + + for (i = 0; i < sizeof(T)/sizeof(T[0]); i++) { + long e, r = test_cvttq(&e, T[i].d); + + if (r != T[i].r || e != 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 = 1; + } + } + return err; +} diff --git a/tests/tcg/alpha/Makefile.target b/tests/tcg/alpha/Makefile.target index a585080328..b94500a7d9 100644 --- a/tests/tcg/alpha/Makefile.target +++ b/tests/tcg/alpha/Makefile.target @@ -5,7 +5,7 @@ ALPHA_SRC=$(SRC_PATH)/tests/tcg/alpha VPATH+=$(ALPHA_SRC) -ALPHA_TESTS=hello-alpha test-cond test-cmov test-ovf +ALPHA_TESTS=hello-alpha test-cond test-cmov test-ovf test-cvttq TESTS+=$(ALPHA_TESTS) test-cmov: EXTRA_CFLAGS=-DTEST_CMOV From patchwork Sat Jul 1 06:55:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698315 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813307wrs; Fri, 30 Jun 2023 23:57:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ668DSykQn/4yBvdHGrWKR5/JFWzf2/fc0/EGKLfmeaSXG+BS1AdqjXXy8QFzfMGKxjkf6I X-Received: by 2002:ac8:5a42:0:b0:3f9:bffb:d477 with SMTP id o2-20020ac85a42000000b003f9bffbd477mr5372595qta.68.1688194631545; Fri, 30 Jun 2023 23:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194631; cv=none; d=google.com; s=arc-20160816; b=eB1KojRWuvRFBSYRLxqEHB8Ut/9Egc+RoZDE9JTJ0gvq8T9BzQABXap1MjjoOGAwXN KStR8WPxaL0Sd6Cy/ycx7mSEcLRlct3eFahqp8AxATNt6jYgralTx7KhEmJRmCXT5tbl qqMs/mzZbH99koBSO7mHoYzP/q9VxuXI/EmxfacSIPL4tw2ao2z6r2V0byr8Z63bZSez OK5VAAfN1YognZLNkxXf424B9XzwQ3D0jy8txvVXTi7HDVFmpvqr7hq6+b81ja/umgPZ ECAWw0rzOsgQMhtc5sw0LgriJ3yrxHm5N0j9jXJsOMyZBcscAOslHDjLOeczY+XUrYWX Wq5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zw6bQp1/aPCTHVB9O6SX0clKjc4ibzsmP+nMY0H68OE=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=Px0wpIjl6w3l1WJJF0++ihPGazx9VDsKJuUbTkFcxF0IAeb1AXUVhAgDOeTtxpgcmZ PLCLAAPOIG8R8hykgXQB26MhQ/dbY3HCLhZpX+xLp0tt0s2j9k0+Kl13NZy4GedJXrmv /Wd9+uoF3OdgqwbkD8lb2zvkbZoXW8vvSWwwAJkXmrjW2IbX1Ww5Su4q26PrOyda7Lke z9r3W3ZbQJdGZ01NlPvwureAQDJcV2/jdBdWM2CuYh4v5rAToEIQoRzx1ANOtxvo93nA 3QrRGJj0L5KXkKK2MdnEo5wgyYnucdm5JJtny1IrmySDabgyu4Uu/+duIqGAlo2zSxvp 2jzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B46m4tOq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 7-20020ac85707000000b003f9056c111esi9027289qtw.670.2023.06.30.23.57.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:57:11 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B46m4tOq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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) static uint64_t do_cvttq(CPUAlphaState *env, uint64_t a, int roundmode) { - uint64_t frac, ret = 0; - uint32_t exp, sign, exc = 0; - int shift; + float64 fa; + int64_t ret; + uint32_t exc; - sign = (a >> 63); - exp = (uint32_t)(a >> 52) & 0x7ff; - frac = a & 0xfffffffffffffull; + fa = t_to_float64(a); + ret = float64_to_int64_modulo(fa, roundmode, &FP_STATUS); - if (exp == 0) { - if (unlikely(frac != 0) && !env->fp_status.flush_inputs_to_zero) { - goto do_underflow; - } - } else if (exp == 0x7ff) { - exc = FPCR_INV; - } else { - /* Restore implicit bit. */ - frac |= 0x10000000000000ull; + exc = get_float_exception_flags(&FP_STATUS); + if (unlikely(exc)) { + set_float_exception_flags(0, &FP_STATUS); - shift = exp - 1023 - 52; - if (shift >= 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 = frac << shift; - } - /* Check for overflow. Note the special case of -0x1p63. */ - if (shift >= 11 && a != 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 = FPCR_INV; + } else { exc = 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 = -shift; - if (shift < 63) { - ret = frac >> shift; - round = frac << (64 - shift); - } else { - /* The exponent is so small we shift out everything. - Leave a sticky bit for proper rounding below. */ - do_underflow: - round = 1; - } - - if (round) { - exc = FPCR_INE; - switch (roundmode) { - case float_round_nearest_even: - if (round == (1ull << 63)) { - /* Fraction is exactly 0.5; round to even. */ - ret += (ret & 1); - } else if (round > (1ull << 63)) { - ret += 1; - } - break; - case float_round_to_zero: - break; - case float_round_up: - ret += 1 - sign; - break; - case float_round_down: - ret += sign; - break; - } - } - } - if (sign) { - ret = -ret; + } else if (exc & float_flag_invalid) { + exc = FPCR_INV; + } else if (exc & float_flag_inexact) { + exc = FPCR_INE; } } env->error_code = exc; From patchwork Sat Jul 1 06:55:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698317 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813372wrs; Fri, 30 Jun 2023 23:57:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WQiK69lCLaKS7Drfw2wA491+NV6PaX7u+ex09Qv8WO1RudEghUL8ZEXBkyPaqPZuuLJnS X-Received: by 2002:ac8:58d0:0:b0:3f9:bb66:6947 with SMTP id u16-20020ac858d0000000b003f9bb666947mr5193219qta.14.1688194651367; Fri, 30 Jun 2023 23:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194651; cv=none; d=google.com; s=arc-20160816; b=yQUHvvJBT+8KC9tg/jnDT1qXMauolWMQLPfnMQTIWrk0SAJkUJJguCoqRSa99P+XSv j7Lxd1PrNM27Zw9mYEF28Y9gwwGFZ/enIJnokb0Rdzk2w5tJ20RIxGv/Kn26Cxlaq9M/ THoJpFeP5ffYpipLerFBBnHvu1H1ycTTOmaUT8BL6ffpzQGGD6JE/SBLbqaguzrJkxMG tb3HJ068+ZfJSTWUQgZvY6c0BayZXPqF5FjZgfKKbsQD/DGjvPTkzB1sBQDC4c0AhknF yX/jCtEqQVa4mSy4v5m75OUtY5T5c8pCuJMsgxkQ49xyZUBepWtY7JwpDW0NODEACsiC ugwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vWBYX+czO68YBn+sruZR19OlwAnKUpeq8kLfDlKJ0tE=; fh=eu2DY09p+eeddYDiV+DalJS3Vr0kxK5BujclYkgWvDw=; b=s0Jj5h6QN3vvSvQ7qETQohs0GLZ5bvLgcRfyHkmgf2YyXfZ5uVZimtw2vNvaHXncAb h2GLf8o+lUXi0TiBz/ShS5TF9EhBN2W/9UzIc+I0EfA7XXs1nFik44nORB3qTbHw8EFh 8k//FMTHvQBm7y1YkzEJv08+3zqnEiGbKy39uK+dRyYs0gH2aEujLXQtfdZWsLPKzLYI JHMzYOGyQRLjwTu7cON3NGQFcHsA5OnPSNcBWWAuoXMfpBLLTWisG/UgJoctOwEk2sPu Ligc7xRl72PF2lC4iuVACxI2iJ+Mc2mz5m1+YdXVJOAc+3ULs8myzr/Z7KgC8KPle7eT ht1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XrH4ZjkZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d19-20020ac85d93000000b003f86c1b625asi8940408qtx.58.2023.06.30.23.57.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:57:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XrH4ZjkZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée 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[] = { uint64_t HELPER(fjcvtzs)(float64 value, void *vstatus) { float_status *status = vstatus; - uint32_t exp, sign; - uint64_t frac; - uint32_t inexact = 1; /* !Z */ + uint32_t inexact, frac; + uint32_t e_old, e_new; - sign = extract64(value, 63, 1); - exp = extract64(value, 52, 11); - frac = extract64(value, 0, 52); + e_old = get_float_exception_flags(status); + set_float_exception_flags(0, status); + frac = float64_to_int32_modulo(value, float_round_to_zero, status); + e_new = get_float_exception_flags(status); + set_float_exception_flags(e_old | e_new, status); - if (exp == 0) { - /* While not inexact for IEEE FP, -0.0 is inexact for JavaScript. */ - inexact = sign; - if (frac != 0) { - if (status->flush_inputs_to_zero) { - float_raise(float_flag_input_denormal, status); - } else { - float_raise(float_flag_inexact, status); - inexact = 1; - } - } - frac = 0; - } else if (exp == 0x7ff) { - /* This operation raises Invalid for both NaN and overflow (Inf). */ - float_raise(float_flag_invalid, status); - frac = 0; + if (value == float64_chs(float64_zero)) { + /* While not inexact for IEEE FP, -0.0 is inexact for JavaScript. */ + inexact = 1; } else { - int true_exp = exp - 1023; - int shift = true_exp - 52; - - /* Restore implicit bit. */ - frac |= 1ull << 52; - - /* Shift the fraction into place. */ - if (shift >= 0) { - /* The number is so large we must shift the fraction left. */ - if (shift >= 64) { - /* The fraction is shifted out entirely. */ - frac = 0; - } else { - frac <<= shift; - } - } else if (shift > -64) { - /* Normal case -- shift right and notice if bits shift out. */ - inexact = (frac << (64 + shift)) != 0; - frac >>= -shift; - } else { - /* The fraction is shifted out entirely. */ - frac = 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 = 1; - } else if (inexact) { - float_raise(float_flag_inexact, status); - } - - /* Honor the sign. */ - if (sign) { - frac = -frac; - } + /* Normal inexact or overflow or NaN */ + inexact = e_new & (float_flag_inexact | float_flag_invalid); } /* Pack the result and the env->ZF representation of Z together. */ From patchwork Sat Jul 1 06:55:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698310 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813172wrs; Fri, 30 Jun 2023 23:56:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5sdFqhpNwFQ5l2W6vbU4BukUeP3reMNTTWvIUHryXw9NFj+O+KcLcAmp8gEYD3A3dVvM+e X-Received: by 2002:ac8:5bd1:0:b0:403:399b:c7e6 with SMTP id b17-20020ac85bd1000000b00403399bc7e6mr5637644qtb.23.1688194585434; Fri, 30 Jun 2023 23:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194585; cv=none; d=google.com; s=arc-20160816; b=PM2faNTf5UsYQsgNpH+XRF0J3jRw3C6YZb8AE8YpjRSJbTgJ0d+TXnx3Ds0gzSXBp4 eY3VWNIlA4zqh8/7E9yoDlDBvazNlmlOuZjV62wxELX302SQQH9mfzkJxgkpk/8mzyHl 65l10+rktshW5uryOlZrv/JjCjgdvZ/fG+ciYI1BD1sD88uu6zNYHkO4NT2+2FuomO1J KcHWYy9j2Mq28W37wPxXd4hhJL506F5nRG7EaLFh4yO/sYIjiT3/HgNiYFLhv46zYVwz iPsXlimRrn/Ax/f4qRaWZczWzvScJfGN0zGG4/CBFT9cSF5K1Yb/s9EsEvLK4zVw2554 slHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/ebwpgVZtFJocO+oyA17J6u/jt74rZXaJP0shDH6azA=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=tGZQZjvv7VYKYtu2qo0EWBrvpd2R5ZYmGiI5A4+dFeoSVBAZBJpXlx5hMvM7/knAcP BXiUrKRWwNmu9I5XymoaLOREkMejStE1Q7YIQQVd2/5nB3eyeUDmRZ4PBXOqr6Dasl7Q BlPiAA+9rOue704Pnypr7jbUY/Nh8Aiz1rq7UA8VDKgErJhsMx+5JihurvzFpoGHCGi6 AT91lfy9EjFPdxcxNPIiVZ4KAX00pkKhJAFLk8H1VuU4Oq7u8CKXVlPK1Ug+JbwGkjHA ew8f7KcPvJZzA3FJHSymCPsvXYHmsAqu5s+r0xXGS0U/WJk1XiPtTJak8hb69Ywcz/Ud RCPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FofdKOAm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n17-20020ac85a11000000b003f9c53b7d70si8405580qta.703.2023.06.30.23.56.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:56:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FofdKOAm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé tcg_assert_listed_vecop() is only used in tcg-op-vec.c. Signed-off-by: Philippe Mathieu-Daudé 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)) -#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 = 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 +} bool tcg_can_emit_vecop_list(const TCGOpcode *list, TCGType type, unsigned vece) From patchwork Sat Jul 1 06:55:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698316 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813317wrs; Fri, 30 Jun 2023 23:57:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4IXzVnyYU2mhqQJdCo4aayBRAZXTcQA9WO21T2avgmiCWLyrX3jLluoCqXGJy0HoQAucdg X-Received: by 2002:ac8:7f15:0:b0:400:a5de:172 with SMTP id f21-20020ac87f15000000b00400a5de0172mr5514391qtk.4.1688194633705; Fri, 30 Jun 2023 23:57:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194633; cv=none; d=google.com; s=arc-20160816; b=X6u505qdpnCs5nLvrOe/M+MYo1Rb3C8siUdBKrPeyEwc1N7GZrvgxrefl0GZc4EQWm WYHDEhth078jneIC4F5mS0HU4L8qxtqvq5I8pVW6nYBkfo2w6cS7O8/quADMwvWFTiE8 E8SsdzujXB9WOIEI1/oBYUt6tcuAzN8Y3G9XR//Tnjn1OxSQwNqwhpLUhjIaphncD9kg Sgnf423v1MHQRUgWCLqeikuO0Xe91EnISchzTsyAuAhNCkVWnnBcc/4bJTyLg+HoYvrA KZu95se+ZopNLHB1LsuSBPvNPhNSM6khzKjL1pmRPSSxQh4k/zNapdUZFLY60nKodjdV Z92A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aeKcGtvpiTjSJLKdv4xRCsQ244TAR26gRApECngoPiQ=; fh=alZCUczDNtN4yFLy44SM1yTUliPrh8AgZa0GP8izqo4=; b=dbs0/D7cg85ULpGJp5WU96P5hci7r3wLlRm36NTZ1OSCVAJAncirVelPsOTASp3jfb u+LFn//4036w8HdfPDEr9xXuFiUixvgn2p/rSvTe+J9vT0cD+UwXVYJ30QcWKbU+QH9s oI8+TjIyDWweulak+Jg6VQeb8gEsKO0EMxnnVoulodvWMZoAdxVX7UdkSD3qPM84S32T 84QpD+dNGa7S3ff/weDkJxttcSPNfLPB22fSMeLTGePp45xfb3oQZ/RDf1EtU318gFt5 HdIcsj1QcbH0TvUrLCyHZ+WV0RfZroW0SJyvYgvJKHJTGaSPShcNBeajeBUVB5JzrZLO CT0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CsRY+JEx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x10-20020a05622a000a00b003f4eb7108c6si6853485qtw.229.2023.06.30.23.57.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:57:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CsRY+JEx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é 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[] = { 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[] = { 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 */ From patchwork Sat Jul 1 06:55:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 698314 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp813283wrs; Fri, 30 Jun 2023 23:57:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlHyQScGn8aY9aq7HLa3OfLaCMiVzCjczkYPtgzGNqmw6c2Pf3wgXpSiJEXVel5swf1kxSqo X-Received: by 2002:a05:620a:4096:b0:765:a6a1:94b3 with SMTP id f22-20020a05620a409600b00765a6a194b3mr7066937qko.73.1688194624523; Fri, 30 Jun 2023 23:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688194624; cv=none; d=google.com; s=arc-20160816; b=HvLsRMnIKf4irh52vPxoVP1xQhXPuGqBhGl5Npa3OSn1EdbhLe4FUXwpwRo+aA3Gh8 q1sxOEc2TMF6bzxLnMwMKoK4MnpZP8YMH2YoFNfcNzhGHclp8tgfycdXvba+qWai9JB+ cG0CSMUpHSUP6oFrF7R3R/Ry6fpSFWw5yWSWSWM5psL7FxJOj+EOhHqbVGIYu9DaBooa tUXTx6bKnCq755S+KM2MZCbKjr4zettiImM+N3rd+DKHyLhT9tZyV1in6VIIlEA/hiCf vrInwTVt8dstuFX8/lUDqgMQUkyhgCb2QjFh2GodrlfGgbkP45cYdvJK0bR/1JHrZX0J uhjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H+qtKArYQsrn/b+NQpVzVpVv88M5134YWuGW3InQxAY=; fh=L7empYteKoZwGFCGMlp9qDTgHTnX02hHuViDUGZLQvE=; b=xDwhWc3UIIwszrCnZhhQBeYxzsaTKEY8EiFlsyKVzsp+mj9s3GbQZNEk1BDn61GRUd oT+OelEZTr8+14YsSpSzaorNziy7MqrTfxLVk7okKLr1RGr1Ag7b0zkReemViAGxgunP MChyMqxTBkm/wxeo54aQcDOg0J/7TUujclH6++O5E9kAGdp7FlH8OHbVkmiHAe2DAm4F V1WNuAh8RtdgMcTV+iC2eie9JUoApIZAjQUXKZUEigIytyUYXCRcvL28Yu/jn0ePSXEF J6CmAgvEISI7RoJKEMlAR7zTay9f3R2BfJTz09z5eq0HnuUZo5yeXplEVJ7z3ytDxMrs w9SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cAZnbS3B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id tn8-20020a05620a3c0800b007655a4d2ab0si7083334qkn.85.2023.06.30.23.57.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Jun 2023 23:57:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cAZnbS3B; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org There is an overflow problem in mmap_find_vma_reserved: when reserved_va == 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 start, abi_ulong size, /* Note that start and size have already been aligned by mmap_find_vma. */ end_addr = start + size; + /* + * Start at the top of the address space, ignoring the last page. + * If reserved_va == 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 = ((reserved_va + 1 - size) & -align) + size; + end_addr = ((reserved_va - size) & -align) + size; looped = true; } @@ -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 = end_addr = ((reserved_va + 1 - size) & -align) + size; + /* Re-start at the top of the address space (see above). */ + addr = end_addr = ((reserved_va - size) & -align) + size; looped = true; } else { prot = page_get_flags(addr);