From patchwork Thu Jun 9 20:28:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 580317 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp1124270max; Thu, 9 Jun 2022 13:30:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgsVlUPCwpeMr0sZRBmMRwDKDdb8SPLu2Y9wmFTrFPFsrc4MAz1rEBPuJEqJlQmRfpA1S4 X-Received: by 2002:ac8:5890:0:b0:305:11be:b84c with SMTP id t16-20020ac85890000000b0030511beb84cmr3275525qta.610.1654806649188; Thu, 09 Jun 2022 13:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654806649; cv=none; d=google.com; s=arc-20160816; b=PQWcrZNQ+5hEx2jadjnHcsnMKNmiOffGKHiL0/x+Sgs6d0G3OZraku4U0na3AhROnq M9T5Ef30GLBt+RRMZkg7ZicNiFY+AdzuFB9KWGxXdVqVexZ2ncgWSkK1OQQndbO0idva 0XYgT6QiyhEhnW2PfDVcTW7Bn0MCgK08NrIPZ4w/uCwXdeOBum/LLlwVqyf1h3Ma9s7U vQyjQQhLxLcTqI1EVdKtvBfPbzSgghwrnQ3pTscSJcXEuQtqaU/gHJinYhan93qco8Jl UNyjafw0rIOksldaOOAEs/vYs80qdJ0sHHCKpJxkDrau2zvGGjONzDS/LpIA4TApaBRg qbFg== 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=45/1OP9sKZiLrriwOZd01nWrvZCCplxvhdpmrJtm+Zo=; b=zVR6yRvPpdUiHUsI+GLjLxcssV7zv50s4/FdK7rALsWe5IK9simRd3OlJNMeX0BIuu 0b9GsZXoXsi6aup2Ocd2wS9IibPQkesHNB5uORKMhXtE/Psh4g6En9ZV58xh8HfxhCgJ tvkFEeuBIqD662o+LjuityqBGI4EwdwoqodR88czrPG4Gjcoq1MB5bt5rxl7rScpNqv9 x6+zdKHmIsIzeOC3gFhg9wWB+ZID6Masu7uOMv1ce3nmAM27E+6S9GipLdmsf7pOnQqn ntQKzEqjAyYplTwMMIvKC57siPRFlubB+yMeNQtpr6Zn/io9hO0NHTtHXVt+d/a5/kZo eT1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YDnrQ2v6; 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 o19-20020a05620a2a1300b006a7254c625bsi2401208qkp.25.2022.06.09.13.30.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Jun 2022 13:30:49 -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=YDnrQ2v6; 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]:33528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzOno-0003Ty-OB for patch@linaro.org; Thu, 09 Jun 2022 16:30:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmB-0003QQ-Ma for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:07 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:52108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOm9-0008QZ-P9 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:07 -0400 Received: by mail-pj1-x1035.google.com with SMTP id cx11so22331417pjb.1 for ; Thu, 09 Jun 2022 13:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=45/1OP9sKZiLrriwOZd01nWrvZCCplxvhdpmrJtm+Zo=; b=YDnrQ2v6WhH/ui7xH/Tg/6xrTudcXNeQLpK5jsqelBYi+1si6d7hFBA+55J5x0Hv9M stTLyJ//uVywXEUGR2x/T0f+nyKQZtMXy1HVjllBCzORjbAzANwrefT619PL/B8Mh2Wv gJQ7tYOcBi6OLbC9BKcqp3uVssOz0eteXzBcOak9whB8eU5OQ1ReSHnnihQPzJP6nZy/ lsOGDa8Slpf2LC5yDRifgAqS+XSVgdhCw1ZWZyoz49DQrtmLI59iv3nfwzz1W82nsPZl j7udzgm+YxOcLDW+DePQk57MVARTYpF3jkTxLuHt9HLpjJXTHn8+tNZnrBk4kEzr+QKz kcWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=45/1OP9sKZiLrriwOZd01nWrvZCCplxvhdpmrJtm+Zo=; b=I9XoLrB3BCniLEekIXfVsYk4ahqnAfrC7IyBrF/7YOwFCmuiRwsmtMAImvpq4Fg9RV peI73bs3p0c9hl8TQFAAWkTQw3+8rF12NOV7565bSxAR/hNLXRfFmI9mrRGPsrlcI7t5 wmXmR/L2XgCyV7e5ms7dXL53U6P6/rvQk1c7yv5BGkcVFzgEU/hHTA86g3Ho3NrF7nVo fD80nKNaWS+v+1cTDCZ2iYQtEBfppvGr9dDH0O3MdSXAmis/lGBOFojkyO940+WLYx22 6tL/8qCdliShWBvE2GFpBF/seRUok0azNgSLcQ8n6Ta7r2+tguZT7gomsglqbNA5wV1X WcgA== X-Gm-Message-State: AOAM533HwCGubb3sv1NYraJdipA61uMd+CS29TFVXYoFeuW//lOr8vi8 wrvJagPH9iT2ZUcgAMLZaaudiccWF25SKQ== X-Received: by 2002:a17:90b:4c88:b0:1e6:71da:5eb0 with SMTP id my8-20020a17090b4c8800b001e671da5eb0mr5048751pjb.185.1654806544397; Thu, 09 Jun 2022 13:29:04 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 02/23] target/arm: Add coproc parameter to syn_fp_access_trap Date: Thu, 9 Jun 2022 13:28:40 -0700 Message-Id: <20220609202901.1177572-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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" 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 --- 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 0cb26dde7d..c105f9e6ba 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 d438fb89e7..e752589090 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 40a513b822..0f797c56fd 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; }