From patchwork Tue Jun 7 02:47:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 579299 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp4667583max; Mon, 6 Jun 2022 19:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2VGESyn23rcsazyBOchIAaYygDiZ49npKwwzksYZnIJg8YhromK0kOFD5J4pM5CpPUy7N X-Received: by 2002:ac8:5b51:0:b0:304:f6e3:8b36 with SMTP id n17-20020ac85b51000000b00304f6e38b36mr1738268qtw.522.1654570561070; Mon, 06 Jun 2022 19:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654570561; cv=none; d=google.com; s=arc-20160816; b=QSlUa6YDG0J2DOLADtMueKq9Mp3pwuY7Ppjw3aLL59hi9EqiIdZtqERT13cM77yeU8 jCRGszYZKA9rtV1efYaAypCTgEPzpEaapCnaULp5AWMc5j0IwxC/LLUZ/pqsafQvLzL0 UHBz5y4OyTWLcVX+8AUfRqTRYmzwuwTphctgqkMPk1hFa5kfySBOR5+t2hnJ1a0aV05x COloIeCvMbB/ixSx+2O72I1NRIww8OdXN/di0ULDJCvpTxWadmzD36ElcEsw1sb/7409 T2U7Uo6J0RkQth4pGw6Hdf9QWrNoj0DGIYz8X6Dn4wK3pW1PxtBhFtmL3JC2prL1N57Q XOxA== 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=T8AfpmQwL0+E6fQxm6ojECpdw/9TThJiZv66f6M94Xg=; b=QYXLy5kfA4IShPK5WwkeaYV+KXnqFR/sd33yKCLyaRRgjXbdw9D6CStGR0zbgoLd8N afUMU1mRl8xK5hiMT0xUwExhXl0YpAycMWL9d/iRaGqwqv5vX023QlqFmkiPjE8j1/Eb Mu/NyE4Ixf7r9QRtGnOLaBMQllP+ipRMgBjnuzO+Yd62AM7wqrx25gWICDGjpJNJfulf 8LmfS4FrV6MaEylWl3hxE5fShketXQXg6hcTUSomn/bfX3FS4G8+SDCNpN0U0oBbCFFB 0BjSHAUl4j2HJIOAIFs3JxLGqD1LJD+UMyavLHvqmSrJOanAQmZ8aSf21NGRw54TTW7Q i30w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YTsaaHAY; 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 b2-20020ac85bc2000000b002f920c90f93si8937504qtb.454.2022.06.06.19.56.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Jun 2022 19:56:01 -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=YTsaaHAY; 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]:42762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPNw-00034L-KB for patch@linaro.org; Mon, 06 Jun 2022 22:56:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPFx-0006ee-6Q for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:45 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:43973) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFq-0000Gw-Rt for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:44 -0400 Received: by mail-pl1-x629.google.com with SMTP id b5so13641058plx.10 for ; Mon, 06 Jun 2022 19:47:38 -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=T8AfpmQwL0+E6fQxm6ojECpdw/9TThJiZv66f6M94Xg=; b=YTsaaHAYR0BLZT+M420CbUXR8IC/0ANMMBDZrQ+OedSOF513xc0LHmg0tad5fb4OWw v8xVuOYgfqnMLjuBwnYsAdlWPDBKgSvL5GpNjsNNsFB3K0d5jtmzih4Mrh5d+4tu0DPj ZHPTp+F78A1LuFeaV5VmvHIgSasmiXPVIIYPA4BserO+kLGzqwYigOFkT7lEeD3eNWuq n+6/JRNELAJL34DgUPbSi6susoiAdjUmd+tCGO8GPC7cB00dnqTczc69c6qCg8UQ3+IE 92U5oGzWYCwqt4kI7imXzsYB9quay9rDpnFwDkudS4iOjCe60BTK1RFJDyoCAEjfkIJq MHrw== 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=T8AfpmQwL0+E6fQxm6ojECpdw/9TThJiZv66f6M94Xg=; b=wNQm20frRj2T7tpn7070R22YVByrvB2tgYOOMxOOXi20HT+dzhNBZPWPnnCnn8bdC+ 93PZC/oeB7b24GP6MnVQV+YcYW+SdVpG41e4lNxE0MSkqiOLAZ8ViGHy+MKduib3owb1 6vIBQ8sRyn+9EZddJxUVuhCmIK2kIVh7MM7/STfzmzfcAhdPpj/55mg4fk7TGkg4kJN3 48i2NKnyDhg9Vfga1/hPnPYG197YxpjhdKjXN1RREKU0PCACn24vgeFZypGg3Dh3myZD 82mTlgu7yPygRFKxfJqr72xCDcx7uO+HBkyX3Z7aS2/Ue7ElHiJlsBIxzFmfb4R5pGQl EG/Q== X-Gm-Message-State: AOAM53213AUCWHlnQ3n58TV5JNKyIjoURxaoctrb8pQa9oNXPeUjOBbY SKptTxECuEXpeuoh9FtDN1lKH3ZgXmCYZg== X-Received: by 2002:a17:902:e80b:b0:167:5e77:e697 with SMTP id u11-20020a170902e80b00b001675e77e697mr15713154plg.93.1654570057544; Mon, 06 Jun 2022 19:47:37 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 02/25] target/arm: Add coproc parameter to syn_fp_access_trap Date: Mon, 6 Jun 2022 19:47:11 -0700 Message-Id: <20220607024734.541321-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=unavailable 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. Signed-off-by: Richard Henderson Reviewed-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 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 935e1929bb..14b90a37ea 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; }