From patchwork Fri Jun 10 16:07:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 580598 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp1884326max; Fri, 10 Jun 2022 09:09:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYZhdHfhXYBlSxpC21mskMOLvFuIwDJFrM2UKum3cqTycRP3PSzccuoaZr9fz3yhf61Kh0 X-Received: by 2002:a05:620a:917:b0:6a6:b76b:d6b4 with SMTP id v23-20020a05620a091700b006a6b76bd6b4mr19605123qkv.279.1654877363074; Fri, 10 Jun 2022 09:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654877363; cv=none; d=google.com; s=arc-20160816; b=w0OpGuKXTgLUSBlw8itHsoAQRfZw+MfTeWZ+83DMFwYjVYo3tbuHOBGzftuQimBN+M GnT+O85MSPAIhZSicSSCJJNZSqx7Q4BpPhQt5h2h3NQoT1OMt0MtdvUCEueCAnOCHwo2 OGiycTf+geLzFW/rBX/w/7CmgysirMsV1lXpXC/7LkEYSEdYQZxfrhJRdL6VwpyrjeRb qaBUNk7iAqkizaOG1zGxpOijyCWYsXRvZBX7BvP21XsXZ4IFNAmhuPfhMWaH5ikmi7tk 4hC54e0UwuSn4/8t7hUPHvOaSDPr4A5JWNJewPUNDLrLPge4Bt3CaZadlwxlg2QftQud 9TBQ== 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=nlcnMWx+QO7aCJl1LZ/JfZgTWAgzGNCWH8XM5rMOx9A=; b=ZLmvEWCBqLjiqQtijSBmU4AeDKpxZHxV72Fzxi/XN6qjZKDUe5q1v3ydIQI367SSLE Ednt5gXoBEkU8jo9jyBdnxpXmAJKy3h5alXPwihI+Jv/+Qru8phKlTYi47HKeqMjoPq2 ExFFp/lLZgjvh/DwzH8l7I2Na60N5P5vzOv7+z+nEY9svu9Szds1HHTL0zATG4CkW7+H IEEWMHGU46tBv0idLdSA1BJ+Ss+yjztmD1xegLoLzv3OJWkGOKLO4i/tT8lTN0sIKrXP Kfsr/70uy7E+8Es6b76uDzSisbC96GCNeNTYf83tXrGuVCqe9LO1g1s4RfSpEEqNlV7N JL8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VQomNPZL; 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 e5-20020a0562141d0500b0046468c43858si14814072qvd.530.2022.06.10.09.09.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Jun 2022 09:09:23 -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=VQomNPZL; 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]:52826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzhCM-0007R3-Hz for patch@linaro.org; Fri, 10 Jun 2022 12:09:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzhAp-0007Ne-HT for qemu-devel@nongnu.org; Fri, 10 Jun 2022 12:07:47 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:38240) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzhAn-0007Ej-Mt for qemu-devel@nongnu.org; Fri, 10 Jun 2022 12:07:47 -0400 Received: by mail-wm1-x336.google.com with SMTP id m39-20020a05600c3b2700b0039c511ebbacso1361408wms.3 for ; Fri, 10 Jun 2022 09:07:45 -0700 (PDT) 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=nlcnMWx+QO7aCJl1LZ/JfZgTWAgzGNCWH8XM5rMOx9A=; b=VQomNPZLhE+NW4GwvQazEPlI1l/w7A6FGF4wE/Aq8tD7H8xxIeVeiD29Ae7J6xqAwP 3r84WcnvOWknIbyvTfVf5IEL3pdRyUAzh6r8Q9AIU729qG7WC8dU+W1A4rQfiQaDOIer AYIKOtXq+BPWYkGMxWwiaL8i5mlGP+QIXqyZtTPki2m0p7KQV9wbTq1+glREfHj9G2AR 8+3GA6W74PAKzg9sdTAcd7jmobq2OsGx9YiTAvVX7Q7iEhaNpQSMGtw1PJwZw3z7EqTX Ew/j2I8ZzT22m+lMiiQTKmmajs9Zg2SZ3ufFx4l13W2ivy70eOD2V81tM4zB/6JEz06j ggWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nlcnMWx+QO7aCJl1LZ/JfZgTWAgzGNCWH8XM5rMOx9A=; b=vwTDXTThyDuuk2qGwWM1DLdazASQ5/57iTO57JLvEAMFRPabiigCGQgmiaYVr9jN+x 5AWq9c48cR5ZRw8IIsLhlGA4uQ9MT4NGp1k7e9ObL/EG8c9nz3J1HWEgvFci9nhgV8gu DCkvok5Dfk7WJMbpFwK5VgfIhMA7gxu2j74MRCREyQXqNlTBI78rMP0dvhSUfPLHUgEL AgjGkBiSocjLPKYqr6md8HWF51XdVGcuSXWiTjKGhQLfulkLWOtyqNV6iSMT0Yv4bjWP RUqCUks7GmFxxTI8BenoI5gm4ueupnThnOe57cOCW+ELcxlaJ6d6MjSPh5AfJhJdw7Is hPvw== X-Gm-Message-State: AOAM531oijxmy4EWMpQfN8oxkrKTPVGLxOaaMYnfUVzSTkr4YXEgcvs/ R25VfFbybKtjsIrqLLVeh4Tx89HniFEqDA== X-Received: by 2002:a7b:c392:0:b0:39c:4d27:e698 with SMTP id s18-20020a7bc392000000b0039c4d27e698mr467019wmj.57.1654877263930; Fri, 10 Jun 2022 09:07:43 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bp11-20020a5d5a8b000000b0020c5253d926sm14276053wrb.114.2022.06.10.09.07.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jun 2022 09:07:43 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/28] target/arm: Add coproc parameter to syn_fp_access_trap Date: Fri, 10 Jun 2022 17:07:12 +0100 Message-Id: <20220610160738.2230762-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220610160738.2230762-1-peter.maydell@linaro.org> References: <20220610160738.2230762-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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" From: Richard Henderson With ARMv8, this field is always RES0. With ARMv7, targeting EL2 and TA=0, it is always 0xA. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220609202901.1177572-3-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/syndrome.h | 7 ++++--- target/arm/translate-a64.c | 3 ++- target/arm/translate-vfp.c | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 0cb26dde7d8..c105f9e6ba5 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -185,12 +185,13 @@ static inline uint32_t syn_cp15_rrt_trap(int cv, int cond, int opc1, int crm, | (rt2 << 10) | (rt << 5) | (crm << 1) | isread; } -static inline uint32_t syn_fp_access_trap(int cv, int cond, bool is_16bit) +static inline uint32_t syn_fp_access_trap(int cv, int cond, bool is_16bit, + int coproc) { - /* AArch32 FP trap or any AArch64 FP/SIMD trap: TA == 0 coproc == 0xa */ + /* AArch32 FP trap or any AArch64 FP/SIMD trap: TA == 0 */ return (EC_ADVSIMDFPACCESSTRAP << ARM_EL_EC_SHIFT) | (is_16bit ? 0 : ARM_EL_IL) - | (cv << 24) | (cond << 20) | 0xa; + | (cv << 24) | (cond << 20) | coproc; } static inline uint32_t syn_simd_access_trap(int cv, int cond, bool is_16bit) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index d438fb89e73..e7525890902 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1162,7 +1162,8 @@ static bool fp_access_check(DisasContext *s) s->fp_access_checked = true; gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_fp_access_trap(1, 0xe, false), s->fp_excp_el); + syn_fp_access_trap(1, 0xe, false, 0), + s->fp_excp_el); return false; } s->fp_access_checked = true; diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index 40a513b8221..0f797c56fd8 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -219,8 +219,18 @@ static void gen_update_fp_context(DisasContext *s) static bool vfp_access_check_a(DisasContext *s, bool ignore_vfp_enabled) { if (s->fp_excp_el) { - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_fp_access_trap(1, 0xe, false), s->fp_excp_el); + /* + * The full syndrome is only used for HSR when HCPTR traps: + * For v8, when TA==0, coproc is RES0. + * For v7, any use of a Floating-point instruction or access + * to a Floating-point Extension register that is trapped to + * Hyp mode because of a trap configured in the HCPTR sets + * this field to 0xA. + */ + int coproc = arm_dc_feature(s, ARM_FEATURE_V8) ? 0 : 0xa; + uint32_t syn = syn_fp_access_trap(1, 0xe, false, coproc); + + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn, s->fp_excp_el); return false; }