From nobody Wed Apr 16 02:28:55 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550171648084181.7795192948106; Thu, 14 Feb 2019 11:14:08 -0800 (PST) Received: from localhost ([127.0.0.1]:53604 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guMSJ-00057e-O4 for importer@patchew.org; Thu, 14 Feb 2019 14:13:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1guMKp-0007i2-Ey for qemu-devel@nongnu.org; Thu, 14 Feb 2019 14:06:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1guMKo-0004dS-IU for qemu-devel@nongnu.org; Thu, 14 Feb 2019 14:06:11 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:40083) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1guMKo-0004cs-CO for qemu-devel@nongnu.org; Thu, 14 Feb 2019 14:06:10 -0500 Received: by mail-wr1-x433.google.com with SMTP id q1so7704181wrp.7 for ; Thu, 14 Feb 2019 11:06:10 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id n184sm7798471wmf.5.2019.02.14.11.06.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=uswL4c0TTMXFNz1N3f9daDRaiHb4sJ9+vjiHGwN6Hj0=; b=FIHFKlEAq/Xg5zCvveQcKvJLaecc9XPTatCZP/bBBRWbQPAkGDAvxa91fAECx4VM9+ qM3rCFOiTN/NreazFL2J6EZm7VE+fplK2UC6DIC9Sz71Z2gzwjbtMGWBN8EzukQzX4hu ka9xefpDWPSZmR09JsJfvRwzqcPJr0cFIU6/nO5SNvcpBD1OzhqgQlxYlh9cmCatPlLd oca9sHxkdwCM5qmb6nrPutyNHfXFZ7T4CFKhWOQx/jH1kVrI3Eb4QlABU96K4Jt1bciQ tDCAJkxmqwct0s+av8eQnaD9KGRjtRgVo01Tns5n8JrJkcaWcRInX/IIpslbHsGGnwrd /eMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uswL4c0TTMXFNz1N3f9daDRaiHb4sJ9+vjiHGwN6Hj0=; b=NeoCQGSOH+Sw4PpVXA72tvNlN67fFBk8DmdJgxLsAajlffRGlXR7aw6/t77RrzjmP1 rgFgThO8o4zbos2HI7Q62NLeFb09p0CBvDWJ2i8q107OO2nBfezbKa5siv8Ta4b4VrQz UA/+iobLziG0W5Ao0ZsZBwx2W91TNgB4ZIR+SgvdXUADwh7tcULbKOAqDYD68KtgoUex g7JWY8gcCOYBPWiRHZDLWJN46rLN+Mn8rlV6Qr5bx+9Elw8tB6lIzCF2LfggQSCGTEfv 16JJHm/ZnSM88J60va3LDwONnrcp1X+2ZVbH8UX4idzCaNzpQNEF5yy9uQeA59gh0jkR Ak0Q== X-Gm-Message-State: AHQUAubXfahwbBZy0BARGe21EXbASySSaNeQWjjJoFUGoJuvsRaVsGOz XQvB16QkP4xmcxJdItx3UA8Cg46XC2r/kw== X-Google-Smtp-Source: AHgI3IYisjfI6fCrTX4/8RFWPjEQeVeW8Vhsx7UiFNnJIRpsmCi4U0NzK6hwV8XPBhUjOAApSNOhgQ== X-Received: by 2002:a5d:4fc5:: with SMTP id h5mr3901676wrw.84.1550171169133; Thu, 14 Feb 2019 11:06:09 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 14 Feb 2019 19:05:39 +0000 Message-Id: <20190214190603.25030-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214190603.25030-1-peter.maydell@linaro.org> References: <20190214190603.25030-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 Subject: [Qemu-devel] [PULL 03/27] target/arm: Fix int128_make128 lo, hi order in paired_cmpxchg64_be X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Catherine Ho The lo,hi order is different from the comments. And in commit 1ec182c33379 ("target/arm: Convert to HAVE_CMPXCHG128"), it changes the original code logic. So just restore the old code logic before this commit: do_paired_cmpxchg64_be(): cmpv =3D int128_make128(env->exclusive_high, env->exclusive_val); newv =3D int128_make128(new_hi, new_lo); This fixes a bug that would only be visible for big-endian AArch64 guest code. Fixes: 1ec182c33379 ("target/arm: Convert to HAVE_CMPXCHG128") Signed-off-by: Catherine Ho Reviewed-by: Richard Henderson Message-id: 1548985244-24523-1-git-send-email-catherine.hecx@gmail.com [PMM: added note that bug only affects BE guests] Signed-off-by: Peter Maydell --- target/arm/helper-a64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 101fa6d3eaa..70850e564d3 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -583,8 +583,8 @@ uint64_t HELPER(paired_cmpxchg64_be)(CPUARMState *env, = uint64_t addr, * High and low need to be switched here because this is not actually a * 128bit store but two doublewords stored consecutively */ - Int128 cmpv =3D int128_make128(env->exclusive_val, env->exclusive_high= ); - Int128 newv =3D int128_make128(new_lo, new_hi); + Int128 cmpv =3D int128_make128(env->exclusive_high, env->exclusive_val= ); + Int128 newv =3D int128_make128(new_hi, new_lo); Int128 oldv; uintptr_t ra =3D GETPC(); uint64_t o0, o1; --=20 2.20.1