From patchwork Tue May 28 14:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 799465 Delivered-To: patch@linaro.org Received: by 2002:adf:e110:0:b0:35b:5a80:51b4 with SMTP id t16csp255906wrz; Tue, 28 May 2024 07:10:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXKaaD/+iLdQyeRPx2xz7zC0jvmaUwvtAxsv+iKroOWPyD+KFr5FOJ14m2RnC0kJhJgJf65OZmpxmqvvDgpIj8v X-Google-Smtp-Source: AGHT+IFbcB4eedIkMmFOQavLlXXg9BnBHUUXfi8xdDlrD3tZq3oQJn3efnNpH3yuXql96ltn3qTY X-Received: by 2002:a05:6214:4981:b0:6ab:76a2:593d with SMTP id 6a1803df08f44-6abccfa64e1mr120982136d6.45.1716905438693; Tue, 28 May 2024 07:10:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716905438; cv=none; d=google.com; s=arc-20160816; b=wwzEauWsPBnpEau+T52aaU8t4+M38wBtxAs1qaLWjxQpugk0jnbrGcSPVPEpXmAeJB 2SFwjgmv8pEKQv9XSfromZMGxMBeJr+OXX4xpbWV083GharMWvrQotbOgC3w8MtU/dcY 91p+9DPw5gEqCKBtSyR7aw45D2GvPgRVMfmF2rEtgX8ndONQj8eJM7P2kwTWWXdgLGZ6 50WhDo0hK4vdsJKa2QwGJdrk710KnaCt5b0Zz4suAw5CYi9uNKRHw3m1fESuMgTyip2m C17J2M1KK8M5hIDC0AB2kVBAcvSKfU5dbhOPLTNvqRIK1M8K6z8W9/1YMVJpdjmvqC5p I+LA== 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:to:from :dkim-signature; bh=7mmWhNodKbmTLVdPuiuTCYlFcWsuhcev1rLaRhnWvpU=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=vFo/RmUr5DWYOs8nJ0QEUSA9G4b+h5Y+VKljRc6rNgVxbIzzbzIgSfdMlrtOEnxBSA LWj2Jv2JnklLVc5ty1zUhA/XokbXaOiAsylFwYDWi/KBIVz0tlGvOW4Io+Jo2ARCOXAY 4C6W9ISW7ImVYsFs6obhn7xR/i2ZIIjnvm9oLZexWKBQLmAm3rP02i5TIa8t39UtEB/f RRmSFie+KfLA31wrPEt5vVlZtuwXbzD9KFuUPmi5hsnNT53PBsOB9FRGsSpYnMwL2NMh 19xpCbxANT3Ibx9WGPvebjVKvOB7yNumwXheT9H/KRJXYiyJ+HLOoEeb6ELYOKJksj8H d88g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PtUL9w1j; 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 6a1803df08f44-6ad76dbe991si66673136d6.153.2024.05.28.07.10.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 May 2024 07:10:38 -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=PtUL9w1j; 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 1sBxUk-0001Yw-MR; Tue, 28 May 2024 10:08:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sBxUi-0001WK-It for qemu-devel@nongnu.org; Tue, 28 May 2024 10:08:04 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sBxUg-00072i-Ld for qemu-devel@nongnu.org; Tue, 28 May 2024 10:08:04 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42101a2ac2cso6923375e9.0 for ; Tue, 28 May 2024 07:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716905281; x=1717510081; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=7mmWhNodKbmTLVdPuiuTCYlFcWsuhcev1rLaRhnWvpU=; b=PtUL9w1jIYyYZoccIPB2P6ENWUhQKBcYY+hOc+awKoF+Pi1MgtnAploO2f5FtzDYJb 7L+KhJyGQC1b88nyX7e3kj4yhbTQK3ltCYX2Jc1vlVDg2vL8+bYcUXD/h01cg6pv/uaU jHGIUvwoCQtS/HlZ7oZsJFGFc1OCuZgXTOcww3YFa+L180RO+HatXdwNhzV4EHDj0SUF pwfDTXRkw1lWV4VnS2o1RzUNuD6ToqIXksbrNnwr/s1HIeHrlmBelRsMJ6xBRs/3sGVS sZOSwYrghEt7Y0Grbis3IcNhl3TyP25vI7DkXAb+0pWX4OdJ1rRwi0ub4r/SGCr+TmGt qbKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716905281; x=1717510081; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7mmWhNodKbmTLVdPuiuTCYlFcWsuhcev1rLaRhnWvpU=; b=iPOnxzUv/KTKa06NvA278Ycu3XjAaGiBqOeNQXeQb2iudxTZ9YPlHnDapQDwhbxDVV Z+r1hy8/1WpWGY6ZZCvIPnu59EXvXbcchjpb9cmkjwfxQs9r+yGWIMGo1yhsMe0UTMNA IIUKtt/dC7BUhZ8QRjNYCHWvy9LAbtOFfU+r/PNe8h0ZHDW4wYpZdiCr2iwh9Tz2vgqm wS8lmPYoW0Tk7Dt40okjgtXXEIJ7OCc42NgJ2NPSB+ekwviQw91IegobRGAjAnQETuJH QukNcMkfd4wBDrHGSNhJSMXY/risXGzJIuAW09uts5oDHI9RU83mrE20vI3zPS7m7MBb cDtw== X-Gm-Message-State: AOJu0YxZvLErENYs7cRmv55v2LnXZ7PTWotSNEVEAT7lJUcAxza4z7Mv FriXHUvJqbsChclEhKrZ/fij+etDsVdaBm9meCRq6NheAToD+qKP8XX6Jr5vlGmLN0zlNvBx0VE w X-Received: by 2002:a5d:54cf:0:b0:357:73ca:9c00 with SMTP id ffacd0b85a97d-35773ca9de0mr5997579f8f.32.1716905281275; Tue, 28 May 2024 07:08:01 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3564afc3577sm11361473f8f.102.2024.05.28.07.08.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 07:08:00 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/42] target/arm: Use PLD, PLDW, PLI not NOP for t32 Date: Tue, 28 May 2024 15:07:20 +0100 Message-Id: <20240528140753.3620597-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240528140753.3620597-1-peter.maydell@linaro.org> References: <20240528140753.3620597-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.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: Richard Henderson This fixes a bug in that neither PLI nor PLDW are present in ARMv6T2, but are introduced with ARMv7 and ARMv7MP respectively. For clarity, do not use NOP for PLD. Note that there is no PLDW (literal). Architecturally in the T1 encoding of "PLD (literal)" bit 5 is "(0)", which means that it should be zero and if it is not then the behaviour is CONSTRAINED UNPREDICTABLE (might UNDEF, NOP, or ignore the value of the bit). In our implementation we have patterns for both: + PLD 1111 1000 -001 1111 1111 ------------ # (literal) + PLD 1111 1000 -011 1111 1111 ------------ # (literal) and so we effectively ignore the value of bit 5. (This is a permitted option for this CONSTRAINED UNPREDICTABLE.) This isn't a behaviour change in this commit, since we previously had NOP lines for both those patterns. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-id: 20240524232121.284515-3-richard.henderson@linaro.org [PMM: adjusted commit message to note that PLD (lit) T1 bit 5 being 1 is an UNPREDICTABLE case.] Signed-off-by: Peter Maydell --- target/arm/tcg/t32.decode | 25 ++++++++++++------------- target/arm/tcg/translate.c | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/target/arm/tcg/t32.decode b/target/arm/tcg/t32.decode index f21ad0167ab..d327178829d 100644 --- a/target/arm/tcg/t32.decode +++ b/target/arm/tcg/t32.decode @@ -458,41 +458,41 @@ STR_ri 1111 1000 1100 .... .... ............ @ldst_ri_pos # Note that Load, unsigned (literal) overlaps all other load encodings. { { - NOP 1111 1000 -001 1111 1111 ------------ # PLD + PLD 1111 1000 -001 1111 1111 ------------ # (literal) LDRB_ri 1111 1000 .001 1111 .... ............ @ldst_ri_lit } { - NOP 1111 1000 1001 ---- 1111 ------------ # PLD + PLD 1111 1000 1001 ---- 1111 ------------ # (immediate T1) LDRB_ri 1111 1000 1001 .... .... ............ @ldst_ri_pos } LDRB_ri 1111 1000 0001 .... .... 1..1 ........ @ldst_ri_idx { - NOP 1111 1000 0001 ---- 1111 1100 -------- # PLD + PLD 1111 1000 0001 ---- 1111 1100 -------- # (immediate T2) LDRB_ri 1111 1000 0001 .... .... 1100 ........ @ldst_ri_neg } LDRBT_ri 1111 1000 0001 .... .... 1110 ........ @ldst_ri_unp { - NOP 1111 1000 0001 ---- 1111 000000 -- ---- # PLD + PLD 1111 1000 0001 ---- 1111 000000 -- ---- # (register) LDRB_rr 1111 1000 0001 .... .... 000000 .. .... @ldst_rr } } { { - NOP 1111 1000 -011 1111 1111 ------------ # PLD + PLD 1111 1000 -011 1111 1111 ------------ # (literal) LDRH_ri 1111 1000 .011 1111 .... ............ @ldst_ri_lit } { - NOP 1111 1000 1011 ---- 1111 ------------ # PLDW + PLDW 1111 1000 1011 ---- 1111 ------------ # (immediate T1) LDRH_ri 1111 1000 1011 .... .... ............ @ldst_ri_pos } LDRH_ri 1111 1000 0011 .... .... 1..1 ........ @ldst_ri_idx { - NOP 1111 1000 0011 ---- 1111 1100 -------- # PLDW + PLDW 1111 1000 0011 ---- 1111 1100 -------- # (immediate T2) LDRH_ri 1111 1000 0011 .... .... 1100 ........ @ldst_ri_neg } LDRHT_ri 1111 1000 0011 .... .... 1110 ........ @ldst_ri_unp { - NOP 1111 1000 0011 ---- 1111 000000 -- ---- # PLDW + PLDW 1111 1000 0011 ---- 1111 000000 -- ---- # (register) LDRH_rr 1111 1000 0011 .... .... 000000 .. .... @ldst_rr } } @@ -504,24 +504,23 @@ STR_ri 1111 1000 1100 .... .... ............ @ldst_ri_pos LDRT_ri 1111 1000 0101 .... .... 1110 ........ @ldst_ri_unp LDR_rr 1111 1000 0101 .... .... 000000 .. .... @ldst_rr } -# NOPs here are PLI. { { - NOP 1111 1001 -001 1111 1111 ------------ + PLI 1111 1001 -001 1111 1111 ------------ # (literal T3) LDRSB_ri 1111 1001 .001 1111 .... ............ @ldst_ri_lit } { - NOP 1111 1001 1001 ---- 1111 ------------ + PLI 1111 1001 1001 ---- 1111 ------------ # (immediate T1) LDRSB_ri 1111 1001 1001 .... .... ............ @ldst_ri_pos } LDRSB_ri 1111 1001 0001 .... .... 1..1 ........ @ldst_ri_idx { - NOP 1111 1001 0001 ---- 1111 1100 -------- + PLI 1111 1001 0001 ---- 1111 1100 -------- # (immediate T2) LDRSB_ri 1111 1001 0001 .... .... 1100 ........ @ldst_ri_neg } LDRSBT_ri 1111 1001 0001 .... .... 1110 ........ @ldst_ri_unp { - NOP 1111 1001 0001 ---- 1111 000000 -- ---- + PLI 1111 1001 0001 ---- 1111 000000 -- ---- # (register) LDRSB_rr 1111 1001 0001 .... .... 000000 .. .... @ldst_rr } } diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c index d605e10f110..187eacffd96 100644 --- a/target/arm/tcg/translate.c +++ b/target/arm/tcg/translate.c @@ -8765,12 +8765,12 @@ static bool trans_PLD(DisasContext *s, arg_PLD *a) return ENABLE_ARCH_5TE; } -static bool trans_PLDW(DisasContext *s, arg_PLD *a) +static bool trans_PLDW(DisasContext *s, arg_PLDW *a) { return arm_dc_feature(s, ARM_FEATURE_V7MP); } -static bool trans_PLI(DisasContext *s, arg_PLD *a) +static bool trans_PLI(DisasContext *s, arg_PLI *a) { return ENABLE_ARCH_7; }