From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339090; cv=none; d=zohomail.com; s=zohoarc; b=UPyq880c0dEzhbH8pK7zVrQLhPabzCn3irNmoyTwzRIzus7Q8kTZq6hTVpj6Wq0OjjI/VBSPLts7Z8E6n3B/SE0UbTX2/HI5yur5B12/iUBVKHvMylK91HB9m0BYsDkQs5oP1dAwI/dJ60T0BoMFkWSRQJdMI8n/aasFzFmFrII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339090; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oJAaanvQuK73f6LtwZ6AmktcHVIa9UGFP+msm39TbKw=; b=UNhIpnwFzuJJl+PsLvibDrl3ebNpdbs8Y4vCP7BmLAuVTc2y3I+GCR3ZImaW+gDH879GT/XgyP9OIuI/YXreCFN0VqJAZrZLbIwvgKZqMKZKvuDBMWHGDrETPNMTmsWcMnFYi1l87zYxxNBhTQjupEeVc5e9W4X7GHu9RxB/Cpc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165333909041495.49686551429863; Mon, 23 May 2022 13:51:30 -0700 (PDT) Received: from localhost ([::1]:34220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntF1U-0004AC-W0 for importer2@patchew.org; Mon, 23 May 2022 16:51:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntExy-0008De-20 for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:53 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:43756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntExu-0004zB-O5 for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:49 -0400 Received: by mail-pj1-x1035.google.com with SMTP id l7-20020a17090aaa8700b001dd1a5b9965so365542pjq.2 for ; Mon, 23 May 2022 13:47:46 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:44 -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=oJAaanvQuK73f6LtwZ6AmktcHVIa9UGFP+msm39TbKw=; b=KqldvE/25cf1yARueOkRl5RWX6gwhTLo4/xbLytS/mKo40SnWXK/Iq65VuNH6UBrVu xVRDWoM0xBGHiwJ94i7YIN3CYzu0XxTVqlCdGTC95FSdtb+tPUc837xrQOKdiScajD4L Bo9+pReewtraBa9iVexbkcP6GHUTTuEkpRQ5S9907R68La3ozoZz7L8q2RAQUcr61/6D XGTH8zirNSFHzdiOGSpMQ/3K4nj1gpfeyPFIKY9veIu5+a0sgVVg02DFMufMzf3O8pv/ qOFXaOnkJ4ziqi+yQM9GmcGtfYNwDLAn+AhSVaqIXSYziARIDFJqbnFCcs8kzN9fsQVR t9nw== 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=oJAaanvQuK73f6LtwZ6AmktcHVIa9UGFP+msm39TbKw=; b=HQ5YHSM0d+ojBzX7RKJYTr6i/HuImADTnYR1PoNFqdP+cXaJlnJ2GrfkQHXVe9lwQH 2F0WSKH3hVNtV47HwIxJ+EW/LhWmbNKpnukwpWAVV8y919iI/i/i3v+Lp+94SiQ2ZEwA CcY4F2jIj6ccKZjCxUnUbxuuIAnfRmXPzFVk9WdMrxfbRuHrjv5fgWdyteO1QS6cwgMG VM+iUiKY2iR9d9PVFBlXLqm6WJSmdZMm28ReFoRqZWXB7oqhHip45621aU2CT63U7sJ8 yHanq+TR+TXLmWH0IkTwlVdZDt33nAPblLWoNKRMr/1GQmDURtM+CKX3XF589JokSHdW W6TA== X-Gm-Message-State: AOAM532UhB54xkStzotb3q00psjK+w5yvfPozlOu/AaMmZ4GwU2ofPXd a/1wqY3H3zDUfPDC7Z8jViTH57cqSMTqhw== X-Google-Smtp-Source: ABdhPJx1Wc72olL/VTNPsZ5rry6DUnsW1O2SmzdtyiUqlMIQ4R2RBgqKOR5oiwJNNdCT3SKhhKkKpQ== X-Received: by 2002:a17:90a:e7c8:b0:1df:fe28:ceb8 with SMTP id kb8-20020a17090ae7c800b001dffe28ceb8mr827372pjb.193.1653338865037; Mon, 23 May 2022 13:47:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 01/18] target/arm: Allow raise_exception to handle finding target EL Date: Mon, 23 May 2022 13:47:25 -0700 Message-Id: <20220523204742.740932-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339092113100001 Content-Type: text/plain; charset="utf-8" The work of finding the correct target EL for an exception is currently split between raise_exception and target_exception_el. Begin merging these by allowing the input to raise_exception to be zero and use exception_target_el for that case. Signed-off-by: Richard Henderson --- target/arm/internals.h | 11 ++++++----- target/arm/op_helper.c | 13 +++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index b654bee468..03363b0f32 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -111,18 +111,19 @@ FIELD(DBGWCR, SSCE, 29, 1) /** * raise_exception: Raise the specified exception. * Raise a guest exception with the specified value, syndrome register - * and target exception level. This should be called from helper functions, - * and never returns because we will longjump back up to the CPU main loop. + * and the current or target exception level. This should be called from + * helper functions, and never returns because we will longjump back up + * to the CPU main loop. */ G_NORETURN void raise_exception(CPUARMState *env, uint32_t excp, - uint32_t syndrome, uint32_t target_el); + uint32_t syndrome, uint32_t cur_or_target_= el); =20 /* * Similarly, but also use unwinding to restore cpu state. */ G_NORETURN void raise_exception_ra(CPUARMState *env, uint32_t excp, - uint32_t syndrome, uint32_t target_e= l, - uintptr_t ra); + uint32_t syndrome, + uint32_t cur_or_target_el, uintptr_t ra= ); =20 /* * For AArch64, map a given EL to an index in the banked_spsr array. diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index c4bd668870..6b9141b79a 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -28,10 +28,15 @@ #define SIGNBIT (uint32_t)0x80000000 #define SIGNBIT64 ((uint64_t)1 << 63) =20 -void raise_exception(CPUARMState *env, uint32_t excp, - uint32_t syndrome, uint32_t target_el) +void raise_exception(CPUARMState *env, uint32_t excp, uint32_t syndrome, + uint32_t cur_or_target_el) { CPUState *cs =3D env_cpu(env); + int target_el =3D cur_or_target_el; + + if (cur_or_target_el =3D=3D 0) { + target_el =3D exception_target_el(env); + } =20 if (target_el =3D=3D 1 && (arm_hcr_el2_eff(env) & HCR_TGE)) { /* @@ -54,7 +59,7 @@ void raise_exception(CPUARMState *env, uint32_t excp, } =20 void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome, - uint32_t target_el, uintptr_t ra) + uint32_t cur_or_target_el, uintptr_t ra) { CPUState *cs =3D env_cpu(env); =20 @@ -64,7 +69,7 @@ void raise_exception_ra(CPUARMState *env, uint32_t excp, = uint32_t syndrome, * the caller passed us, and cannot use cpu_loop_exit_restore(). */ cpu_restore_state(cs, ra, true); - raise_exception(env, excp, syndrome, target_el); + raise_exception(env, excp, syndrome, cur_or_target_el); } =20 uint64_t HELPER(neon_tbl)(CPUARMState *env, uint32_t desc, --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339380; cv=none; d=zohomail.com; s=zohoarc; b=aH3r5WBveUnuol5MFrcUMJABh5nl+WjjTvBJXfKA2TWfiG9VyFjivdf0nFvuxC9A0U9hDTnk23gXhsXroVGFVYaO9vw5VbkXrthxfXs29XIYC2gheTEVwOXXDXYt5zSAvafQPplEwwbCSHD4DZjuTNM9Zt113eqGKtG+RME9gnw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339380; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CpC+VtE7S33sT1Hdq2TiErLR6SNR00Jn9wFnQN1e6KQ=; b=lFR2MBA4u1rSXMGq1dzLLttW2Vgc6gpQx9tmkbu70obUSGty39GkSuM2HqlrBagmKJG9OyPDJlTAJTxZbNC1QGeCv4OGUQiMWdylSLFIw0YdGN4vMcF3YGhMy4pETm3htJ8eMQYf1iYFfvTQXyhH4uayyr+eMfn0Y5crx5Eakts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653339379967267.4456806796936; Mon, 23 May 2022 13:56:19 -0700 (PDT) Received: from localhost ([::1]:43858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntF68-0002Nq-Vq for importer2@patchew.org; Mon, 23 May 2022 16:56:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntExy-0008Dg-2o for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:53 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:35774) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntExv-0004zM-8x for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:49 -0400 Received: by mail-pg1-x529.google.com with SMTP id c22so14676439pgu.2 for ; Mon, 23 May 2022 13:47:46 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:45 -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=CpC+VtE7S33sT1Hdq2TiErLR6SNR00Jn9wFnQN1e6KQ=; b=iwltIlSJED/FUPBg3jLHZYLn1K7+GjcVSATzYGzChkTGLSWwHSGTcHfSherNfUZyDP 9A/Sk0FeZpaunmk6hQWCBvX5QaPHlHuZtAXjqeRu2aiUbMcl5YQW66GXSL8w58JHsKmS CSKZAW9COQuLXjci3s4GTr683zCW4NBzD2EiDx2nVK5NWgZWCh2x8EvbCgXobQ8yF9bB U8WX4Ed5fbVDfsbLVYxMj/yiYo4rqWJXF4dxRrgHWqGkky0fwJBgT6KwvoSHREKlQIfp vrMiXIvYWJ31Wjtm5sQ+iSKku1qprDo+l6wyA0W3cLbo9c5OS6WNnMyncCA/TfgxXlfz SKHA== 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=CpC+VtE7S33sT1Hdq2TiErLR6SNR00Jn9wFnQN1e6KQ=; b=zJ9YzWzE6nnxG7EC8eQvQ/GgioTwq7v0qj1loTVo0cETa3lFgxGlaYVkgp9BoDnd5P pnIsZQ7oDcwXWECyuW+u3m7CjJIPCq+97sVlCp1H+9kHp6qU7Sb2XmoBDn+atRTh8t7A ZbB/C/aPkjLL2RFc6p1Tx/iuxq9/wsj/V0X8IVDpiXj/MG1Bo7SdQd9kLqoUWeEDlyes zqIA/UV9CpHEUpjJaG14mYSH+e2CQWb5G50IVyraFnnDVuuzGVrrJLZozP8WFrrskRj7 TIyrKDwMN9UDT+4+KqRzXfp4dP1aaR+iQUS9Nto6/klZya65q4z/0IbUU44CGT2EHJM4 gm3A== X-Gm-Message-State: AOAM53267dN6rI1w+7VRfySjmcgAX5t6LupSvCi1P0pTg41GAwuE2F+1 19MLi36dqN1PGQesmldXAkJGIiXisnmXIg== X-Google-Smtp-Source: ABdhPJyAHNunLiP7S0lkDxvv5my2Mwg8InuhVdRga1XiMnZALjvWEaNNAP9wzZ7SFwfBunPBH/K1qw== X-Received: by 2002:a63:ef4e:0:b0:3f9:e8c4:b72d with SMTP id c14-20020a63ef4e000000b003f9e8c4b72dmr11712232pgk.328.1653338865901; Mon, 23 May 2022 13:47:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 02/18] target/arm: Use arm_current_el for simple exceptions Date: Mon, 23 May 2022 13:47:26 -0700 Message-Id: <20220523204742.740932-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339381721100001 Content-Type: text/plain; charset="utf-8" For these cases, the syndrome does not depend on the origin or target EL, so we can simply defer selection of the target EL to raise_exception. Signed-off-by: Richard Henderson --- target/arm/helper-a64.c | 5 +++-- target/arm/helper.c | 10 +++------- target/arm/mte_helper.c | 7 +++---- target/arm/op_helper.c | 13 ++++++------- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 77a8502b6b..22db213aab 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -70,12 +70,13 @@ static void daif_check(CPUARMState *env, uint32_t op, uint32_t imm, uintptr_t ra) { /* DAIF update to PSTATE. This is OK from EL0 only if UMA is set. */ - if (arm_current_el(env) =3D=3D 0 && !(arm_sctlr(env, 0) & SCTLR_UMA)) { + int el =3D arm_current_el(env); + if (el =3D=3D 0 && !(arm_sctlr(env, 0) & SCTLR_UMA)) { raise_exception_ra(env, EXCP_UDEF, syn_aa64_sysregtrap(0, extract32(op, 0, 3), extract32(op, 3, 3), 4, imm, 0x1f, 0), - exception_target_el(env), ra); + el, ra); } } =20 diff --git a/target/arm/helper.c b/target/arm/helper.c index 40da63913c..e0be96b988 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -3232,14 +3232,10 @@ static uint64_t do_ats_write(CPUARMState *env, uint= 64_t value, * Synchronous external aborts during a translation table walk * are taken as Data Abort exceptions. */ - if (fi.stage2) { - if (current_el =3D=3D 3) { - target_el =3D 3; - } else { - target_el =3D 2; - } + if (fi.stage2 && current_el < 2) { + target_el =3D 2; } else { - target_el =3D exception_target_el(env); + target_el =3D current_el; } take_exc =3D true; } diff --git a/target/arm/mte_helper.c b/target/arm/mte_helper.c index d11a8c70d0..98f2a3215d 100644 --- a/target/arm/mte_helper.c +++ b/target/arm/mte_helper.c @@ -540,14 +540,13 @@ void HELPER(stzgm_tags)(CPUARMState *env, uint64_t pt= r, uint64_t val) static void mte_sync_check_fail(CPUARMState *env, uint32_t desc, uint64_t dirty_ptr, uintptr_t ra) { - int is_write, syn; + int is_write, syn, el =3D arm_current_el(env); =20 env->exception.vaddress =3D dirty_ptr; =20 is_write =3D FIELD_EX32(desc, MTEDESC, WRITE); - syn =3D syn_data_abort_no_iss(arm_current_el(env) !=3D 0, 0, 0, 0, 0, = is_write, - 0x11); - raise_exception_ra(env, EXCP_DATA_ABORT, syn, exception_target_el(env)= , ra); + syn =3D syn_data_abort_no_iss(el !=3D 0, 0, 0, 0, 0, is_write, 0x11); + raise_exception_ra(env, EXCP_DATA_ABORT, syn, el, ra); g_assert_not_reached(); } =20 diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 6b9141b79a..61e9c1d903 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -503,7 +503,7 @@ uint32_t HELPER(get_r13_banked)(CPUARMState *env, uint3= 2_t mode) * Other UNPREDICTABLE and UNDEF cases were caught at translate ti= me. */ raise_exception(env, EXCP_UDEF, syn_uncategorized(), - exception_target_el(env)); + arm_current_el(env)); } =20 if ((env->uncached_cpsr & CPSR_M) =3D=3D mode) { @@ -567,8 +567,7 @@ static void msr_mrs_banked_exc_checks(CPUARMState *env,= uint32_t tgtmode, return; =20 undef: - raise_exception(env, EXCP_UDEF, syn_uncategorized(), - exception_target_el(env)); + raise_exception(env, EXCP_UDEF, syn_uncategorized(), arm_current_el(en= v)); } =20 void HELPER(msr_banked)(CPUARMState *env, uint32_t value, uint32_t tgtmode, @@ -697,7 +696,7 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void= *rip, uint32_t syndrome, target_el =3D res & CP_ACCESS_EL_MASK; switch (target_el) { case 0: - target_el =3D exception_target_el(env); + target_el =3D arm_current_el(env); break; case 2: assert(arm_current_el(env) !=3D 3); @@ -808,7 +807,7 @@ void HELPER(pre_hvc)(CPUARMState *env) =20 if (undef) { raise_exception(env, EXCP_UDEF, syn_uncategorized(), - exception_target_el(env)); + arm_current_el(env)); } } =20 @@ -870,7 +869,7 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrom= e) * This handles the very last line of the previous table. */ raise_exception(env, EXCP_UDEF, syn_uncategorized(), - exception_target_el(env)); + arm_current_el(env)); } =20 if (cur_el =3D=3D 1 && (arm_hcr_el2_eff(env) & HCR_TSC)) { @@ -889,7 +888,7 @@ void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrom= e) if (!arm_is_psci_call(cpu, EXCP_SMC) && (smd || !arm_feature(env, ARM_FEATURE_EL3))) { raise_exception(env, EXCP_UDEF, syn_uncategorized(), - exception_target_el(env)); + arm_current_el(env)); } } =20 --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339129; cv=none; d=zohomail.com; s=zohoarc; b=JK4ix4WYqKgTDDLC65rTqSovJ7HoNJicnLzIUnPn+qsiYk4AtzPWSFh4/oqq+RiVYTE0HQ1609x300DgW82Cn70X79SvWpPM0kQtHd4W/k8zQO4Ojk8pxdQHDN6dM7PPB3CBwqhXEVasQJpWIAi4LEWhUyKwsOePLtvC1439rVU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339129; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HJoYOaaLuB8gatH0dOhmGoPETBA6JA7xdiNzavM9zuM=; b=bseFuiN4JNTjhntwUS2s9OxxqvAQxCyfM59HpqYAseaEzAZuHlyTJsVev/1dOfwpPRPf6kgg6vM0H7jMMTLEX1WklQX/IJM781MwCUM2WIip5fqBJhIK/dhvOKVr+Mt7R+H+lFS2aWZ+l4OQeFedtfg8AfaykWeob/Jph0Z3Nzs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653339129115674.7526533534912; Mon, 23 May 2022 13:52:09 -0700 (PDT) Received: from localhost ([::1]:35976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntF27-0005Su-Un for importer2@patchew.org; Mon, 23 May 2022 16:52:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy0-0008Dr-BW for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:53 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:34590) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntExw-0004zY-9u for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:52 -0400 Received: by mail-pl1-x635.google.com with SMTP id n8so14140423plh.1 for ; Mon, 23 May 2022 13:47:47 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:46 -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=HJoYOaaLuB8gatH0dOhmGoPETBA6JA7xdiNzavM9zuM=; b=eFnp1B3RKHuwL1LsRt2UrnvVd39DBqmPiyF2mEAi8wmAZRELqu3C33fewhMTYHm+Yb kwvUBIwbR7zZRn9ro9dJZbM9AzxrAwbBPMAa4WRVSTafvawpuZDiszhGmNt4TvmP/G4h /q6iwzNYcvmmY4lEiw1ksvpe1Lxps1uDXB4QtB/T5IV4yLy8m1c9mAvYSHdY2sD5LtGl C1sFaVZEBI7qjxK6/Fln66PX/5i2AinxDHxBtdKq1bu0rhc4mWh9Cf3gMlehH0Wqte5t 3MSDqKuq2Qo6GMgIMZhe3BmH5vY0ZSY7USgpAGptSW9zcYsyZ5orkOZt5lYA9dYHMaki nmBw== 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=HJoYOaaLuB8gatH0dOhmGoPETBA6JA7xdiNzavM9zuM=; b=Iv8JKGJZUQM5/Knf6z7R8XXB6fM6H/GjbiOe/1sJv2hjgGJuKDWb1Vo9wPgUzgDUkR pDryE+0Xq4yjh9qMTSxWQd+ZVn990gMq9VNXLhcJ9bx828l+egRO6j9lH2fCYtw/l9eX Ml9COWwYWdm1pNIgBWKwvgb0zjquh1Tvr3BvBaCcyxvMEIpX4bFEYObPVUdEqNJTVQdN K8mboUYxOdDAoZ4Gb3XGeXTGmYBmKpQlXbJ4S+VoB8by/E0HVhRFvYNa3yYA/ey4nrJc ETIQjmRkg6L6I0MDO3dhs0B1r202H7H4MpAuBcyApMWdjV2w7hQ5ml6zNlElQP0Gwn05 z4NQ== X-Gm-Message-State: AOAM532c/MkQ4s/sr5+BgLVaUVqZa1ESDmBQqVIga9WeMxqOv1WdomL2 8eIOYtrfyZAqJPpiRgTm7GJ0YwmJ2nZKig== X-Google-Smtp-Source: ABdhPJw5q/l2MlFrRnOsuHAKKssoBkEe7sG5ukLbsgD/Hgi7WKjbjJE7keCK7pzrMDcagdRK01APZw== X-Received: by 2002:a17:902:ea04:b0:161:c283:8c0b with SMTP id s4-20020a170902ea0400b00161c2838c0bmr24393937plg.52.1653338866899; Mon, 23 May 2022 13:47:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 03/18] target/arm: Move and expand parameters to exception_target_el Date: Mon, 23 May 2022 13:47:27 -0700 Message-Id: <20220523204742.740932-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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=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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339130220100001 Content-Type: text/plain; charset="utf-8" Move exception_target_el out of line. Add cur_el parameter, because 2 of 3 users already have that handy. Add psyn parameter in preparation for more code movement. Signed-off-by: Richard Henderson --- target/arm/internals.h | 15 +-------------- target/arm/op_helper.c | 17 ++++++++++++++++- target/arm/tlb_helper.c | 10 ++++++---- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 03363b0f32..a71f795628 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1091,20 +1091,7 @@ typedef struct ARMVAParameters { ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, ARMMMUIdx mmu_idx, bool data); =20 -static inline int exception_target_el(CPUARMState *env) -{ - int target_el =3D MAX(1, arm_current_el(env)); - - /* - * No such thing as secure EL1 if EL3 is aarch32, - * so update the target EL to EL3 in this case. - */ - if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el =3D=3D = 1) { - target_el =3D 3; - } - - return target_el; -} +int exception_target_el(CPUARMState *env, int cur_el, uint32_t *psyn); =20 /* Determine if allocation tags are available. */ static inline bool allocation_tag_access_enabled(CPUARMState *env, int el, diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 61e9c1d903..6858b8980d 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -28,6 +28,21 @@ #define SIGNBIT (uint32_t)0x80000000 #define SIGNBIT64 ((uint64_t)1 << 63) =20 +int exception_target_el(CPUARMState *env, int cur_el, uint32_t *psyn) +{ + int target_el =3D MAX(1, cur_el); + + /* + * No such thing as secure EL1 if EL3 is aarch32, + * so update the target EL to EL3 in this case. + */ + if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el =3D=3D = 1) { + target_el =3D 3; + } + + return target_el; +} + void raise_exception(CPUARMState *env, uint32_t excp, uint32_t syndrome, uint32_t cur_or_target_el) { @@ -35,7 +50,7 @@ void raise_exception(CPUARMState *env, uint32_t excp, uin= t32_t syndrome, int target_el =3D cur_or_target_el; =20 if (cur_or_target_el =3D=3D 0) { - target_el =3D exception_target_el(env); + target_el =3D exception_target_el(env, 0, &syndrome); } =20 if (target_el =3D=3D 1 && (arm_hcr_el2_eff(env) & HCR_TGE)) { diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c index 6421e16202..573e18f830 100644 --- a/target/arm/tlb_helper.c +++ b/target/arm/tlb_helper.c @@ -85,11 +85,13 @@ void arm_deliver_fault(ARMCPU *cpu, vaddr addr, int mmu_idx, ARMMMUFaultInfo *fi) { CPUARMState *env =3D &cpu->env; - int target_el; + int cur_el, target_el; bool same_el; uint32_t syn, exc, fsr, fsc; =20 - target_el =3D exception_target_el(env); + cur_el =3D arm_current_el(env); + target_el =3D exception_target_el(env, cur_el, NULL); + if (fi->stage2) { target_el =3D 2; env->cp15.hpfar_el2 =3D extract64(fi->s2addr, 12, 47) << 4; @@ -97,7 +99,7 @@ void arm_deliver_fault(ARMCPU *cpu, vaddr addr, env->cp15.hpfar_el2 |=3D HPFAR_NS; } } - same_el =3D (arm_current_el(env) =3D=3D target_el); + same_el =3D cur_el =3D=3D target_el; =20 fsr =3D compute_fsr_fsc(env, fi, target_el, mmu_idx, &fsc); =20 @@ -139,7 +141,7 @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr va= ddr, void helper_exception_pc_alignment(CPUARMState *env, target_ulong pc) { ARMMMUFaultInfo fi =3D { .type =3D ARMFault_Alignment }; - int target_el =3D exception_target_el(env); + int target_el =3D exception_target_el(env, arm_current_el(env), NULL); int mmu_idx =3D cpu_mmu_index(env, true); uint32_t fsc; =20 --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339298; cv=none; d=zohomail.com; s=zohoarc; b=XnhlyUrI47NCzLRgpBJU4uCSi0OtwDxCFgfKtlc6v7+9EBYBFbqrmXl3jy3b/VJJzIMvY35evfY7ClpVBPcjTPH3BaysnfZUxTdl3qw0INoGKbcCR23CDY2vyBqLv2Nn3AkyaPPmf1KapndkqErpRUon5P0vS/HTT8fBDr1vaFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339298; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MX1GOuVouWu0Qr0+DdSMTNcH8UOwJjn/VDcrD/8BMow=; b=fagck2IaILuv3Ti85QZoX/lj9pv6ATgi+aR9deCAJs0k8EeX4Faixbn53rzXJ3NySCY11UfxFHo90TELsyHqqGC+h1oI6iTXjCHH4BG9f6boogZELZI3bmzmtg1zbJO+IlHBuGoeKSUM7NPaXOOMQNVB7lc2wPYUqxu6ye8MreE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653339298730601.0308892244711; Mon, 23 May 2022 13:54:58 -0700 (PDT) Received: from localhost ([::1]:41800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntF4r-0000xq-P9 for importer2@patchew.org; Mon, 23 May 2022 16:54:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy0-0008Ds-KJ for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:53 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:39654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntExx-0004zo-5p for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:52 -0400 Received: by mail-pf1-x429.google.com with SMTP id v11so14696327pff.6 for ; Mon, 23 May 2022 13:47:48 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:47 -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=MX1GOuVouWu0Qr0+DdSMTNcH8UOwJjn/VDcrD/8BMow=; b=eLQDQRKBRxW8MeBz6zb6ZMyYdWo+28EiNR0n1eORp186evBDWesuRACOX3Llbjh+XV ztsGcTODkuTm1zLOkPezGWlw4ee09NSa0+EUrj2tY9PD3ylf4JkA2zDjeUItTrz0P7xI s48p4HGqnbhYqbAgm2uxhZoOAJnr3DvH9BwTTGJ83fPPZA7qALKfLNXVcOambYzi3Jmb kPzb6TyrFnku9JxL1nAiDjF+c96Wx9NSeF4K6AeZhD9sXrzvFJkNg4yo0AId8XCHt9Pb /b675T1DLyMQoE9mmrtCQLMvLY2SzHfjFDIs1zuq+QdDfSfp90J9w1xjUxWJoXBvfQZf BDJA== 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=MX1GOuVouWu0Qr0+DdSMTNcH8UOwJjn/VDcrD/8BMow=; b=HX53geZn12DSQ+Oo+Y/hfP+N1UDbkh1Yd8WvOPj7muL6tQpk8WMhTikkP4BpL+Pk+a 4rYRDAD4iTvOILVsmXWmP7NQLYQlDIijj7yvkox/Sl8XfOtUUNOWZe5XYjZv71ZpT4n6 tDmcQi59Rh/5nd25mJvrRwxkUk0RHgkSOzZFLSiGB9e/dvvx8jOhxDbJaLVWZzuH+diK eL/pMN2PEocjEurlD4OLrLuXNXhxCtHAEBJDyar4ZKvJWliDMnunkul8X4VlK1GKBZmN LqvxVTOSAEipJQD+RpiPCSC/2Dl/rTJqq8MKuOFzSTLTRiG5qa2C/MUV8irrJDDJw0Ir EWHQ== X-Gm-Message-State: AOAM531Ra3Oq8PvJW+gMU5jIggEzSzykzGmMiGNAPBbkXlERQa1OLKMy SIIwgZXGUSlVXfOjBCHP5aBKYebJ2lpw6Q== X-Google-Smtp-Source: ABdhPJwlzMgftkojCqJAi6idUU4tz5kwylO0DAKnSBIwufRfGRkDeNZ1zJxHewsVbgG/y2PlQDDVNA== X-Received: by 2002:a63:dd4c:0:b0:3fa:a80e:8ba0 with SMTP id g12-20020a63dd4c000000b003faa80e8ba0mr269410pgj.167.1653338867855; Mon, 23 May 2022 13:47:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 04/18] target/arm: Move HCR_TGE check into exception_target_el Date: Mon, 23 May 2022 13:47:28 -0700 Message-Id: <20220523204742.740932-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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=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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339299062100001 Content-Type: text/plain; charset="utf-8" Move the TGE test from raise_exception into exception_target_el to consolidate tests in one place. Note that this ought to apply only to origin of EL0, but that cannot be confirmed at this time. Update the AdvSIMDFPAccessTrap doc reference to DDI0478H.a. Signed-off-by: Richard Henderson --- target/arm/op_helper.c | 47 +++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 6858b8980d..55440dfa84 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -30,17 +30,39 @@ =20 int exception_target_el(CPUARMState *env, int cur_el, uint32_t *psyn) { - int target_el =3D MAX(1, cur_el); + /* + * FIXME: The following tests really apply to an EL0 origin, + * not to a target of EL1. However, the origin will never be + * EL1 for these cases (no aa32 secure EL1, can't enter EL1 + * with TGE set). Delay fixing this until all places that + * might perform MAX(cur_el, 1) are audited. + */ + if (cur_el >=3D 2) { + return 2; + } =20 /* * No such thing as secure EL1 if EL3 is aarch32, * so update the target EL to EL3 in this case. */ - if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el =3D=3D = 1) { - target_el =3D 3; + if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) { + return 3; } =20 - return target_el; + if (arm_hcr_el2_eff(env) & HCR_TGE) { + /* + * Redirect NS EL1 exceptions to NS EL2. These are reported with + * their original syndrome register value, with the exception of + * SIMD/FP access traps, which are reported as uncategorized + * (see DDI0487 H.a rule RJNBTN). + */ + if (psyn && syn_get_ec(*psyn) =3D=3D EC_ADVSIMDFPACCESSTRAP) { + *psyn =3D syn_uncategorized(); + } + return 2; + } + + return 1; } =20 void raise_exception(CPUARMState *env, uint32_t excp, uint32_t syndrome, @@ -49,21 +71,8 @@ void raise_exception(CPUARMState *env, uint32_t excp, ui= nt32_t syndrome, CPUState *cs =3D env_cpu(env); int target_el =3D cur_or_target_el; =20 - if (cur_or_target_el =3D=3D 0) { - target_el =3D exception_target_el(env, 0, &syndrome); - } - - if (target_el =3D=3D 1 && (arm_hcr_el2_eff(env) & HCR_TGE)) { - /* - * Redirect NS EL1 exceptions to NS EL2. These are reported with - * their original syndrome register value, with the exception of - * SIMD/FP access traps, which are reported as uncategorized - * (see DDI0478C.a D1.10.4) - */ - target_el =3D 2; - if (syn_get_ec(syndrome) =3D=3D EC_ADVSIMDFPACCESSTRAP) { - syndrome =3D syn_uncategorized(); - } + if (cur_or_target_el <=3D 1) { + target_el =3D exception_target_el(env, cur_or_target_el, &syndrome= ); } =20 assert(!excp_is_internal(excp)); --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339170; cv=none; d=zohomail.com; s=zohoarc; b=FQPk2pYD7XhAbWqmlLoop00SShfUzfUzSVlUrXTO1JjfV143Z9NEASL2FubjipkYqHQz4cBhtuJ4ZtPL00Zra3CuUlucMHIjXv4mTNz0z2Y/uZ/gRpZ7j9yrbg+GAw9R2ngae4whkxhHT5Ge1tNz+fTpEQQwA4abuz0fohnf3nE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339170; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vy83GOBaz0c9nFoZWpk3k7JL3LGlXb9nxH3dH76w/MM=; b=dYBxHnx9JWPpdIUOmHfQAeZgxCXbOcz2KrpCeBzZ71NIY6p5o4bI4YDYNN8R1UFHyvG8U2ZxPj9vXep9EnvVHGCI5WNqRqKi+iJeo+iCw0z7Z3WBLiXioXqVfbg98bA2sLDoBSMHLXCVoE+Cmw/7aWzRDm6HUOSpl8F5y9LG/ok= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653339170881557.5284386391047; Mon, 23 May 2022 13:52:50 -0700 (PDT) Received: from localhost ([::1]:37166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntF2n-0006FN-Sj for importer2@patchew.org; Mon, 23 May 2022 16:52:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy1-0008FL-Or for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:53 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:44553) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntExy-00050J-3L for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:53 -0400 Received: by mail-pj1-x1035.google.com with SMTP id pq9-20020a17090b3d8900b001df622bf81dso363199pjb.3 for ; Mon, 23 May 2022 13:47:49 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:48 -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=vy83GOBaz0c9nFoZWpk3k7JL3LGlXb9nxH3dH76w/MM=; b=tvh5ypp1qO+lPVgKSGyu3Qu8nwG1YfW8zb6Y0hePkEeEjpYlLOHf0Dgt1//Po552Wf iMivU0x4pfSRtmqmUbOsiHo1yYLWmWn1DMEBkdBOjtms2nqd5kjfTfpOvN5egAxwbU2k juUHI1LPFc3HcC3uBtA2rUgpTHp0MIYbmAZynOVWhZ4metwn2BG5KBf1JZfL6TvHNAW4 /BcUVbtUJXVBxzYcHzfp2Y+pBZCcKPRQfMQUsFNR192vC65ir74YjRi6bvKUlq8K+yvi 56JKeQ94RQG4nzNmmmkqrYjiMb3oHy1YLRSByLs5ijgq4jilJzOlDkRNKAycoRNbLbjd PqLA== 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=vy83GOBaz0c9nFoZWpk3k7JL3LGlXb9nxH3dH76w/MM=; b=MD546FFarIelKgchwuhoUudIIygM91e0XId6gIz35BNiJ9Lu0uiDxyKglyeQ8SSHOv kQC2Boiks1JJL/XLLl7lM7fuP/iEi7di4PNHTF7SN9ozf1DJNXZpfaJqxH7Tl52usOdJ nT61uni4FGJaKsSvPoQEDKX3wsw22Hwg7QmLsafPL6xafByzdQH5QKYZ4zam2VcEuACl 1Lb4wQrHnmKgCQmT7OExtMl3q5Qlaf79c4KWobCPli11w8lgCLNXk7eL89CDaLLdURZ8 KjdjxMZny5ShL2/02SejxzcVx2Wc7/TSVG/4xdnzpvmPvSSwDY2aUS7TVVmIthnxbgbA YVGg== X-Gm-Message-State: AOAM533aoPRKnITHKCDAc6qsKQ7sZUFnacbJdSvWRfPyK8yvNLzbfvba NAMFBEQrZR3cOkblwhbdFB4Xhzj7xx8Q4w== X-Google-Smtp-Source: ABdhPJxSmDgrnDfKQbfTuxo5v9pC1bj2TXZRgaZ/Z+i8559j+Dro29AAW7zj6LR+0iYT/0FR+jrmBQ== X-Received: by 2002:a17:90b:1808:b0:1e0:4dbc:8781 with SMTP id lw8-20020a17090b180800b001e04dbc8781mr866356pjb.58.1653338868916; Mon, 23 May 2022 13:47:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 05/18] target/arm: Move arm_singlestep_active out of line Date: Mon, 23 May 2022 13:47:29 -0700 Message-Id: <20220523204742.740932-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339172495100001 Content-Type: text/plain; charset="utf-8" Move the function to debug_helper.c, and the declaration to internals.h. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 10 ---------- target/arm/internals.h | 1 + target/arm/debug_helper.c | 12 ++++++++++++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c1865ad5da..2e115a0281 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3087,16 +3087,6 @@ static inline bool arm_generate_debug_exceptions(CPU= ARMState *env) } } =20 -/* Is single-stepping active? (Note that the "is EL_D AArch64?" check - * implicitly means this always returns false in pre-v8 CPUs.) - */ -static inline bool arm_singlestep_active(CPUARMState *env) -{ - return extract32(env->cp15.mdscr_el1, 0, 1) - && arm_el_is_aa64(env, arm_debug_target_el(env)) - && arm_generate_debug_exceptions(env); -} - static inline bool arm_sctlr_b(CPUARMState *env) { return diff --git a/target/arm/internals.h b/target/arm/internals.h index a71f795628..b447d850ae 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1317,5 +1317,6 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu= ); #endif =20 void aa32_max_features(ARMCPU *cpu); +bool arm_singlestep_active(CPUARMState *env); =20 #endif diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 46893697cc..1abf41c5f8 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -11,6 +11,18 @@ #include "exec/exec-all.h" #include "exec/helper-proto.h" =20 + +/* + * Is single-stepping active? (Note that the "is EL_D AArch64?" check + * implicitly means this always returns false in pre-v8 CPUs.) + */ +bool arm_singlestep_active(CPUARMState *env) +{ + return extract32(env->cp15.mdscr_el1, 0, 1) + && arm_el_is_aa64(env, arm_debug_target_el(env)) + && arm_generate_debug_exceptions(env); +} + /* Return true if the linked breakpoint entry lbn passes its checks */ static bool linked_bp_matches(ARMCPU *cpu, int lbn) { --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339750; cv=none; d=zohomail.com; s=zohoarc; b=m3+6AU+iWWgPYtvQAsz9zbXjGmg1w8ArGBkDvgoGxCS6slM54livRnKZZKhEkzws6cnKx0xYi0PoRz+U4xlYPTSAnKEqKCcHdxTrHgKCxMN4Cn0aBUulX0FyCvYhnDtW/SUUA67Nsb1ngC+FRp0SGzdEXLcdI2KINIP+2hHH54I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339750; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=q+QZhQErKHUIz5Yukzx015BIaa2BxFp+5FYfWrFDsdE=; b=Sr8uNLqdMFxkoc6jxpEOJLw3dry7psHi9yeukneeiXryD//bpIM3DN6UVVZun6H7xYeqycEZQFOgPZ6fmU4eW8jTzknQGPpmfj3OkesOrfXEtapTZTpY+uecMZ6wEVgV5zKDsYIukGq9QrLv2LDJcgNMacfENDAT8YPrOQCS0+k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653339750132384.06952615286434; Mon, 23 May 2022 14:02:30 -0700 (PDT) Received: from localhost ([::1]:53488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFC8-0000qU-Bp for importer2@patchew.org; Mon, 23 May 2022 17:02:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy3-0008JP-Aq for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:55 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:53011) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy0-000510-8S for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:54 -0400 Received: by mail-pj1-x102c.google.com with SMTP id l14so15064477pjk.2 for ; Mon, 23 May 2022 13:47:51 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:49 -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=q+QZhQErKHUIz5Yukzx015BIaa2BxFp+5FYfWrFDsdE=; b=qsG06/1Y+v9gX1C590KKpyBfGShtarjOQUjGVGu0PygxKViicjiak5e8G73I1/mFHg yW1gUlw+J42hHa4PEEp2LeL17bxu/JwnTvTdxbp3MUs+8ynuUFF2TI8gprouJOL2Tto9 H52Mo0kKV/2WWJmrPyB3sowlFuwNTpw8yjqSW0t/J8+mEJtdaF4ZgrMpNKprqucUo03u 4DCRurDeRJoX1CZrBLPa0E2PN3xCeZzdzdnzOtfIJhB2KfqxOb4OsD8jpkOUw+/rNNOG bJ19SGjckAxhRIvm/5h+gJRL0XS+c0E7vhF79r8vLYZEwmjfhm8c1FDjqONdPZIwPD5V Talg== 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=q+QZhQErKHUIz5Yukzx015BIaa2BxFp+5FYfWrFDsdE=; b=HEpsHy69XO0rYG1/qoaNAvgeCWFdeACR/EVG1OTvuSLZ4wdWIS04ASXxqiyIlwriNU Fokt6HTsnaI5rU09KISa7d2ivzf62uv7nF6d72caST7aK7QIpq03QU0FVgwPGQgC6nS2 jY0cEJCoiTxIJKOAoXL/xRjYBjSPxS/84DwSDBlO3Elat6NDx5D2mLLNgxYc8ADTZxmY kpyuTOt1jDrHTsYSVr6C4YW2WWCKjpgB5Exth6v1qh8Pyq3l4EoGTIijtKqCDEuaFaKT IY+ud/nneZuqZvtovdxShGyOui5xMd1E2Rpba4mpKV+Ws5DVhWdm2UW1LQ9D32M7ipzd gb2A== X-Gm-Message-State: AOAM531Fa/sAuTHQRzO5E/Arjq6k3+u9pHgEI7Dy4A+RwSU6pQ4nctIJ 1cZvnMGmKOv6gIh+OQrllGKDE1EamjsB/A== X-Google-Smtp-Source: ABdhPJw+C6qr8V+NXZZ9ImQx1wjlhxQZ2RSgdcyRnIuVLXjkVuB2HHVYh2jLmIkT6x9LlCtfcTIrFg== X-Received: by 2002:a17:903:40d2:b0:161:a2d9:3230 with SMTP id t18-20020a17090340d200b00161a2d93230mr24239572pld.57.1653338869913; Mon, 23 May 2022 13:47:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 06/18] target/arm: Move arm_generate_debug_exceptions out of line Date: Mon, 23 May 2022 13:47:30 -0700 Message-Id: <20220523204742.740932-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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=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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339751862100001 Content-Type: text/plain; charset="utf-8" Move arm_generate_debug_exceptions and its two subroutines, {aa32,aa64}_generate_debug_exceptions into debug_helper.c, and the one interface declaration to internals.h. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 91 ------------------------------------- target/arm/internals.h | 1 + target/arm/debug_helper.c | 94 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 91 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2e115a0281..92c9758e86 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2996,97 +2996,6 @@ static inline bool arm_v7m_csselr_razwi(ARMCPU *cpu) return (cpu->clidr & R_V7M_CLIDR_CTYPE_ALL_MASK) !=3D 0; } =20 -/* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */ -static inline bool aa64_generate_debug_exceptions(CPUARMState *env) -{ - int cur_el =3D arm_current_el(env); - int debug_el; - - if (cur_el =3D=3D 3) { - return false; - } - - /* MDCR_EL3.SDD disables debug events from Secure state */ - if (arm_is_secure_below_el3(env) - && extract32(env->cp15.mdcr_el3, 16, 1)) { - return false; - } - - /* - * Same EL to same EL debug exceptions need MDSCR_KDE enabled - * while not masking the (D)ebug bit in DAIF. - */ - debug_el =3D arm_debug_target_el(env); - - if (cur_el =3D=3D debug_el) { - return extract32(env->cp15.mdscr_el1, 13, 1) - && !(env->daif & PSTATE_D); - } - - /* Otherwise the debug target needs to be a higher EL */ - return debug_el > cur_el; -} - -static inline bool aa32_generate_debug_exceptions(CPUARMState *env) -{ - int el =3D arm_current_el(env); - - if (el =3D=3D 0 && arm_el_is_aa64(env, 1)) { - return aa64_generate_debug_exceptions(env); - } - - if (arm_is_secure(env)) { - int spd; - - if (el =3D=3D 0 && (env->cp15.sder & 1)) { - /* SDER.SUIDEN means debug exceptions from Secure EL0 - * are always enabled. Otherwise they are controlled by - * SDCR.SPD like those from other Secure ELs. - */ - return true; - } - - spd =3D extract32(env->cp15.mdcr_el3, 14, 2); - switch (spd) { - case 1: - /* SPD =3D=3D 0b01 is reserved, but behaves as 0b00. */ - case 0: - /* For 0b00 we return true if external secure invasive debug - * is enabled. On real hardware this is controlled by external - * signals to the core. QEMU always permits debug, and behaves - * as if DBGEN, SPIDEN, NIDEN and SPNIDEN are all tied high. - */ - return true; - case 2: - return false; - case 3: - return true; - } - } - - return el !=3D 2; -} - -/* Return true if debugging exceptions are currently enabled. - * This corresponds to what in ARM ARM pseudocode would be - * if UsingAArch32() then - * return AArch32.GenerateDebugExceptions() - * else - * return AArch64.GenerateDebugExceptions() - * We choose to push the if() down into this function for clarity, - * since the pseudocode has it at all callsites except for the one in - * CheckSoftwareStep(), where it is elided because both branches would - * always return the same value. - */ -static inline bool arm_generate_debug_exceptions(CPUARMState *env) -{ - if (env->aarch64) { - return aa64_generate_debug_exceptions(env); - } else { - return aa32_generate_debug_exceptions(env); - } -} - static inline bool arm_sctlr_b(CPUARMState *env) { return diff --git a/target/arm/internals.h b/target/arm/internals.h index b447d850ae..91702b3ff7 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1318,5 +1318,6 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu= ); =20 void aa32_max_features(ARMCPU *cpu); bool arm_singlestep_active(CPUARMState *env); +bool arm_generate_debug_exceptions(CPUARMState *env); =20 #endif diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 1abf41c5f8..20a0e4261a 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -12,6 +12,100 @@ #include "exec/helper-proto.h" =20 =20 +/* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */ +static bool aa64_generate_debug_exceptions(CPUARMState *env) +{ + int cur_el =3D arm_current_el(env); + int debug_el; + + if (cur_el =3D=3D 3) { + return false; + } + + /* MDCR_EL3.SDD disables debug events from Secure state */ + if (arm_is_secure_below_el3(env) + && extract32(env->cp15.mdcr_el3, 16, 1)) { + return false; + } + + /* + * Same EL to same EL debug exceptions need MDSCR_KDE enabled + * while not masking the (D)ebug bit in DAIF. + */ + debug_el =3D arm_debug_target_el(env); + + if (cur_el =3D=3D debug_el) { + return extract32(env->cp15.mdscr_el1, 13, 1) + && !(env->daif & PSTATE_D); + } + + /* Otherwise the debug target needs to be a higher EL */ + return debug_el > cur_el; +} + +static bool aa32_generate_debug_exceptions(CPUARMState *env) +{ + int el =3D arm_current_el(env); + + if (el =3D=3D 0 && arm_el_is_aa64(env, 1)) { + return aa64_generate_debug_exceptions(env); + } + + if (arm_is_secure(env)) { + int spd; + + if (el =3D=3D 0 && (env->cp15.sder & 1)) { + /* + * SDER.SUIDEN means debug exceptions from Secure EL0 + * are always enabled. Otherwise they are controlled by + * SDCR.SPD like those from other Secure ELs. + */ + return true; + } + + spd =3D extract32(env->cp15.mdcr_el3, 14, 2); + switch (spd) { + case 1: + /* SPD =3D=3D 0b01 is reserved, but behaves as 0b00. */ + case 0: + /* + * For 0b00 we return true if external secure invasive debug + * is enabled. On real hardware this is controlled by external + * signals to the core. QEMU always permits debug, and behaves + * as if DBGEN, SPIDEN, NIDEN and SPNIDEN are all tied high. + */ + return true; + case 2: + return false; + case 3: + return true; + } + } + + return el !=3D 2; +} + +/* + * Return true if debugging exceptions are currently enabled. + * This corresponds to what in ARM ARM pseudocode would be + * if UsingAArch32() then + * return AArch32.GenerateDebugExceptions() + * else + * return AArch64.GenerateDebugExceptions() + * We choose to push the if() down into this function for clarity, + * since the pseudocode has it at all callsites except for the one in + * CheckSoftwareStep(), where it is elided because both branches would + * always return the same value. + */ +bool arm_generate_debug_exceptions(CPUARMState *env) +{ + if (env->aarch64) { + return aa64_generate_debug_exceptions(env); + } else { + return aa32_generate_debug_exceptions(env); + } +} + /* * Is single-stepping active? (Note that the "is EL_D AArch64?" check * implicitly means this always returns false in pre-v8 CPUs.) --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339497; cv=none; d=zohomail.com; s=zohoarc; b=C3d6jPPa8+HyKKGlJ/HR/0D7B640OTB18Kkp9dde6PPRWXcTMRhzAHW0zf+0cQKUfdOMrPCBNaoE7dVCNd00SJlO77gB+2f++HQ0/SVOlik/0Cyejxzmu3IVsdpV7Z4sHtp6zwMo/OR7fD3berMcJRbSsHMYDVHbOCq5KbrbJTE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339497; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FY/9m2bfUciW+9b94QolKYkajfJbMNVAwbOW4VNUDuA=; b=nUg8GxOb3icrn/5rnoIcyFAd8ea3p9PEn/+8zenTgCEoa3he/oUuBtZ9eKvdqj115cpUi0ZuPzj4MG3oq79QoRj0K/D4ravvw+d/uk4lsOvir7vsILFIRbxZK9CofnAE4f6Yh22ab3f82vjlRZmnFQVqPmzIWHF+0blpvunk2q0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653339497323689.7444845255375; Mon, 23 May 2022 13:58:17 -0700 (PDT) Received: from localhost ([::1]:46020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntF84-0003tH-4o for importer2@patchew.org; Mon, 23 May 2022 16:58:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy3-0008JS-Bn for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:55 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:46903) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy0-00051M-Lk for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:54 -0400 Received: by mail-pj1-x102c.google.com with SMTP id v5-20020a17090a7c0500b001df84fa82f8so356372pjf.5 for ; Mon, 23 May 2022 13:47:52 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:50 -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=FY/9m2bfUciW+9b94QolKYkajfJbMNVAwbOW4VNUDuA=; b=q2mOQ/7gXRasaJZ0j5wfFTvfn8D7hgG8IkRZxKB0W51H6pRe6PJoe+GKxIKiS4RKUp xA+V8avPrPZe5GbCM67VklBZU8QjeyZh+3a9mh/hDjZg/DD2WVNr/PWGlzvKd8JIEjJ8 yoQ/J5OvUzH/9FWdSNKNP2hx4oP/E1ss4XQwaeM1czWNRu2GMZm5jiagliJXZLBmxjWL 6UImFu5tumloGriaLmmPWrNW6nFyYvMbdlv6ingPACBsmoBklijhNptG4UWGQJ+cwM1p hmlhN74GNhjvYX97yueGBuvRYEWSIT0yMUpSMaRazFlcyrg26lY67hMWTWycQIFVs5Tg 6/ZQ== 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=FY/9m2bfUciW+9b94QolKYkajfJbMNVAwbOW4VNUDuA=; b=uxR070e0fb8NQTFq5/VqV4uxvBnTZYJQM2jUGs+8goSmMZTJVq0UrDoQ0XmTugXDCa aww17IO45TxaCiYczPymaJjbGx5sVEpiXISPprf4N6FJ1KSLJ6rofrbhn2k1IqBrya8n 80KEnIFq5nr19W1D04yz5fwpbf7z1dYfBNwmhY4rb7U/0My4DnzFsBEg9bnu/VE8os7n t41TDFqEJoAzvTr2UUlneTvayt8oGrFSdGpPXpVPWNmmNoJ7i9H+aOveWXmzZcRjMf1d JH42mj+b1CESelQJUs6KT+ukLJ2cAa+aZLqD3GP918vhoGplas9TAHi6VxVoia1Oob2Z JE1Q== X-Gm-Message-State: AOAM532iJXxOmLE5bztjnplLrIztw9CKPheierJU6JAWcQ5IyWuwZ+pJ CXkcq0RPcW4HyMD6HkMS23ey77unlSNhAg== X-Google-Smtp-Source: ABdhPJxf3DVK4Jx/BNmx12Z+1MnZ8StA0Iy4qHtLKOQGDQXZCHA4q678anGULLVWe+ZFiHwSQ/omlw== X-Received: by 2002:a17:90b:4c4d:b0:1df:a164:7055 with SMTP id np13-20020a17090b4c4d00b001dfa1647055mr849515pjb.180.1653338871021; Mon, 23 May 2022 13:47:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 07/18] target/arm: Hoist arm_current_el in arm_generate_debug_exceptions Date: Mon, 23 May 2022 13:47:31 -0700 Message-Id: <20220523204742.740932-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339498038100001 Content-Type: text/plain; charset="utf-8" Read this value once in the main function, and pass it around between the subroutines. Signed-off-by: Richard Henderson --- target/arm/debug_helper.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 20a0e4261a..2bbf065b3a 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -13,9 +13,8 @@ =20 =20 /* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */ -static bool aa64_generate_debug_exceptions(CPUARMState *env) +static bool aa64_generate_debug_exceptions(CPUARMState *env, int cur_el) { - int cur_el =3D arm_current_el(env); int debug_el; =20 if (cur_el =3D=3D 3) { @@ -43,18 +42,16 @@ static bool aa64_generate_debug_exceptions(CPUARMState = *env) return debug_el > cur_el; } =20 -static bool aa32_generate_debug_exceptions(CPUARMState *env) +static bool aa32_generate_debug_exceptions(CPUARMState *env, int cur_el) { - int el =3D arm_current_el(env); - - if (el =3D=3D 0 && arm_el_is_aa64(env, 1)) { - return aa64_generate_debug_exceptions(env); + if (cur_el =3D=3D 0 && arm_el_is_aa64(env, 1)) { + return aa64_generate_debug_exceptions(env, cur_el); } =20 if (arm_is_secure(env)) { int spd; =20 - if (el =3D=3D 0 && (env->cp15.sder & 1)) { + if (cur_el =3D=3D 0 && (env->cp15.sder & 1)) { /* * SDER.SUIDEN means debug exceptions from Secure EL0 * are always enabled. Otherwise they are controlled by @@ -82,7 +79,7 @@ static bool aa32_generate_debug_exceptions(CPUARMState *e= nv) } } =20 - return el !=3D 2; + return cur_el !=3D 2; } =20 /* @@ -99,10 +96,12 @@ static bool aa32_generate_debug_exceptions(CPUARMState = *env) */ bool arm_generate_debug_exceptions(CPUARMState *env) { + int cur_el =3D arm_current_el(env); + if (env->aarch64) { - return aa64_generate_debug_exceptions(env); + return aa64_generate_debug_exceptions(env, cur_el); } else { - return aa32_generate_debug_exceptions(env); + return aa32_generate_debug_exceptions(env, cur_el); } } =20 --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653340064; cv=none; d=zohomail.com; s=zohoarc; b=Cbxzn43rTtpa7kTeshVfUUXCOy03SAz2wXhYm1p9Ej3f5y6u5mW4KnPads27IMBS8gDnDW1twFpN92IUMUS5RbvO/wRQhBrXSk8R/EL+c9QrpZtpYvlaZusknNt/B5n25ImZe2Zr6q+hK+g21IXQYjapDKBoBIWcX0nTQla191g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653340064; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Dt8CbxTVDB+ShnUD/KaNguE181rKbT/m4QnA7xOaLPg=; b=JXlp+eUzooVPCgAw6d0V4EvI7sLQQCkK6EmO00GHO9XES6acnTOvUSajpMvUZNeAaGnC12zAxcQJQh/+YC9d7d/N1HqJfEgBrTTz9m1hdyd//MKPl1oIenxKsNtnRNqU4hQH85bNSMY+ufAgnHLVRXMjQUERX36z241MxDjUTso= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653340064883163.7037490871444; Mon, 23 May 2022 14:07:44 -0700 (PDT) Received: from localhost ([::1]:35024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFHD-00086D-Qq for importer2@patchew.org; Mon, 23 May 2022 17:07:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy3-0008Ly-T6 for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:55 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:55891) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy1-00051m-Pg for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:55 -0400 Received: by mail-pj1-x102a.google.com with SMTP id n10so15049984pjh.5 for ; Mon, 23 May 2022 13:47:53 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:51 -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=Dt8CbxTVDB+ShnUD/KaNguE181rKbT/m4QnA7xOaLPg=; b=fG4pX36Yf8/hRDRO2f5GBI2/9XQPsgkU7OGc21rMw49eRDW8u1QkdRWkx5i51NN4u1 tSfHqKB2ZhBZXRi+fYS4xiJUGvXHtFWLIG8tRdE7UwcSNQJk5YHtjrLQq+mjcYE5TVnt rInEtTwyDsu/+JRHPPHV+cyokdvx+nmdLxk1z+eXCT6HxdgH7mYxky1x52lQmPv0RjR7 KwFskHuL2Dp7UWS+cPIuZx3EIty6yAMRP9YGDSTT/RVwwsxpHRJ93oCQp9oOI2pKo4oC zDIAM+QX0ZEQUw3aYq4Hq7wgyD25k3nO155gpOpB6CujRKXbmDqGKBsgn2MgEWVc6ihH IDew== 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=Dt8CbxTVDB+ShnUD/KaNguE181rKbT/m4QnA7xOaLPg=; b=ajGtOgjbVr+BtvMb3j9+8KSEis0F1BTfF5nWQeJHuGvru3YdwGC8DaKKU58wkVog6s E7Nzim5qmU/T3gFEwHkCdtaXCChnCDung2wty7KZ5bZgw0eAmhknMd+eifvIkNsYrSS5 KZHutNqQ0q+EoxSf6y9IO4CiPcwYeFR2Tu03BhZERzp72rJy2qJNhQgeckYj73R8mIeD 46XQ4AVWNWdi2h5sEI1+D6VSD3b6NMwksZ4rridKS4lHNyhq9PPRVblXxzsUk6s/1MAY CDADiWlvR+jB1bjt7uTQ9oNrL2I1Nd/vXJRXr1GECZCruiSctcl5I3lNPf/goiqN/cfF tttA== X-Gm-Message-State: AOAM531HQuQOS5froym6Fz3dOQQTk6uSQYaVhtuG+f10t2Z69UEVqayN OxmETvD+0bfhhgtW5yP1n5f07m4YQ80PrQ== X-Google-Smtp-Source: ABdhPJyXdnLYJA6fdX3RLB4yt2iZoj2+UJNDd67k9IBskEHvIGsL1BzKDWNTUdEsFRQIZyKPQPf/tw== X-Received: by 2002:a17:902:d2c7:b0:161:9c9f:35b8 with SMTP id n7-20020a170902d2c700b001619c9f35b8mr24474771plc.81.1653338872386; Mon, 23 May 2022 13:47:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 08/18] target/arm: Use is_a64 in arm_generate_debug_exceptions Date: Mon, 23 May 2022 13:47:32 -0700 Message-Id: <20220523204742.740932-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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=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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653340066273100001 Content-Type: text/plain; charset="utf-8" Use the accessor rather than the raw structure member. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/debug_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 2bbf065b3a..3a86901779 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -98,7 +98,7 @@ bool arm_generate_debug_exceptions(CPUARMState *env) { int cur_el =3D arm_current_el(env); =20 - if (env->aarch64) { + if (is_a64(env)) { return aa64_generate_debug_exceptions(env, cur_el); } else { return aa32_generate_debug_exceptions(env, cur_el); --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339512; cv=none; d=zohomail.com; s=zohoarc; b=ecRoM180KdHD1oseYEGeFFIni2QRmOxxWYArjjE5ON6nSjauBuBA2EzJ7ax1proIptvYfP/RdY9jWW2nNDwHdwftk3+Z9vxvSNHSsSCv7WQMs3tEw5qqmJcyFJGnq7xGYNV1lnocrhx/ZZgCmX5h/HSclttC2szx5LM3pOoGoOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339512; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EfHC5sh/pejKXX57jmwQUPJC/F0imk6n0vf48RAawTc=; b=gROy5ZhKcc77HJB+Kc2Ha1vFilrLju7AYDhn2M+7DjDHDjzd8g1zT0D1/66sIjHDari5ZcxOlHHpFypnWqUzLozYZRrXc1kNOZ2PefMPe9caJOPzpV+y49dqKdxH9kVu+pHJ/RJRM2NJQUnv5n+DsVsk2Qy/u7tfEL5GaZMWMVA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165333951208310.504996371387051; Mon, 23 May 2022 13:58:32 -0700 (PDT) Received: from localhost ([::1]:46896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntF8I-0004Zn-Iv for importer2@patchew.org; Mon, 23 May 2022 16:58:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy4-0008O6-Gx for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:00 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:53017) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy2-00052C-Ii for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:56 -0400 Received: by mail-pj1-x1032.google.com with SMTP id l14so15064557pjk.2 for ; Mon, 23 May 2022 13:47:54 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:52 -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=EfHC5sh/pejKXX57jmwQUPJC/F0imk6n0vf48RAawTc=; b=eD9YlSJ/LV1T585l5ykRzRgfChRcnUsqJpUsRBjA2AyjXiKcgB8xpiyASEIVhM6HFj xpbc+MeK21D+OB38BbNLXJag1sBTQtxKOmyzZq2aqrDkVyZgvOGKFsySfAJBDJlayyok +q9brb+s+qo/d+FKE2PbY6QmcZSIwjE5aVSzyhSv7KfskGh8cFVtbs1h/bFK7mZpGj1d Ig79tFeUndaA0InrEFTNgs+BIbbZsxeNonKqRPkXnKqtk9TiH3fUJBCy8ClWEbx8l5pr bhWeCnWq3Yt3c71e2fFAIPx2VoFHDEPh6JFvGFsLO7zqVHk0fnEbMSvDFAmQR8t6ido7 5NCg== 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=EfHC5sh/pejKXX57jmwQUPJC/F0imk6n0vf48RAawTc=; b=2YSHhP9klpAT9dm9RpyfgAa8D5T3Mm4DEn/zrwoHdbd/Vsn+Kcijr5ZCLl49RKxEhK iCOZkenVLSysX5UKdjg0hLpFbzZMg9EapnaiOHd3EP7Ii56KN6Lipco6svO8dCzqTDrf CLgw+sZYwKU8TbTUA5hgFwxrYlfoeZ49G1oPQVeKZbviEkvd8WemxI0Mj9p2lFE5zthL Kqy10gx45br9DapvGA3Ve2OLE32cKkX9qwyJhVo7ExwKzIU2cbUeXcCag1BwsPq9zzJp olPSVmMwnN4Y2EE3Nn/DYEk/YxucdN1QpQ3dIwbzpLz3bOCr12Q+2v1EOhNswy8hY0BO 0GHw== X-Gm-Message-State: AOAM530qnh2NPNPhhT9DYJUhPn85KpzW2dxaLRY3Em6eeZ8GtUDUFU75 fnd482U+KEqbSjOcr5Q+/ZweZDj8ltF7nw== X-Google-Smtp-Source: ABdhPJwm6vsUIubKxoc6ZzaeWrIoevY34XLtGjIfEZ4qHQgEFuszRsXSakBdAayvEjxUxHXcHizx7g== X-Received: by 2002:a17:902:9b94:b0:161:5a74:aa6c with SMTP id y20-20020a1709029b9400b001615a74aa6cmr24005748plp.108.1653338873311; Mon, 23 May 2022 13:47:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 09/18] target/arm: Move exception_bkpt_insn to debug_helper.c Date: Mon, 23 May 2022 13:47:33 -0700 Message-Id: <20220523204742.740932-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339514165100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson --- target/arm/debug_helper.c | 31 +++++++++++++++++++++++++++++++ target/arm/op_helper.c | 29 ----------------------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 3a86901779..bdcd5f36d6 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -429,6 +429,37 @@ void arm_debug_excp_handler(CPUState *cs) } } =20 +/* + * Raise an EXCP_BKPT with the specified syndrome register value, + * targeting the correct exception level for debug exceptions. + */ +void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) +{ + int debug_el =3D arm_debug_target_el(env); + int cur_el =3D arm_current_el(env); + + /* FSR will only be used if the debug target EL is AArch32. */ + env->exception.fsr =3D arm_debug_exception_fsr(env); + /* + * FAR is UNKNOWN: clear vaddress to avoid potentially exposing + * values to the guest that it shouldn't be able to see at its + * exception/security level. + */ + env->exception.vaddress =3D 0; + /* + * Other kinds of architectural debug exception are ignored if + * they target an exception level below the current one (in QEMU + * this is checked by arm_generate_debug_exceptions()). Breakpoint + * instructions are special because they always generate an exception + * to somewhere: if they can't go to the configured debug exception + * level they are taken to the current exception level. + */ + if (debug_el < cur_el) { + debug_el =3D cur_el; + } + raise_exception(env, EXCP_BKPT, syndrome, debug_el); +} + #if !defined(CONFIG_USER_ONLY) =20 vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 55440dfa84..0a50dbf274 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -413,35 +413,6 @@ void HELPER(exception_with_syndrome)(CPUARMState *env,= uint32_t excp, raise_exception(env, excp, syndrome, target_el); } =20 -/* Raise an EXCP_BKPT with the specified syndrome register value, - * targeting the correct exception level for debug exceptions. - */ -void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) -{ - int debug_el =3D arm_debug_target_el(env); - int cur_el =3D arm_current_el(env); - - /* FSR will only be used if the debug target EL is AArch32. */ - env->exception.fsr =3D arm_debug_exception_fsr(env); - /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing - * values to the guest that it shouldn't be able to see at its - * exception/security level. - */ - env->exception.vaddress =3D 0; - /* - * Other kinds of architectural debug exception are ignored if - * they target an exception level below the current one (in QEMU - * this is checked by arm_generate_debug_exceptions()). Breakpoint - * instructions are special because they always generate an exception - * to somewhere: if they can't go to the configured debug exception - * level they are taken to the current exception level. - */ - if (debug_el < cur_el) { - debug_el =3D cur_el; - } - raise_exception(env, EXCP_BKPT, syndrome, debug_el); -} - uint32_t HELPER(cpsr_read)(CPUARMState *env) { return cpsr_read(env) & ~CPSR_EXEC; --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653340407; cv=none; d=zohomail.com; s=zohoarc; b=JPN0iNmNwX8qPARWstlvsr++p3x5lkTjXCTjelfzhZG+Qj+vnPCGMuy6dsECSMKeTVQJr5ySw+2f8PfAV/oMVj+NfvhQwjr9EWkjXRqbAplcP/lqmyrMwScN+KMemDusRjEYEK1iKd6jc/BQ8JFOjtbd7A/oMGNQHT6aefMdZzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653340407; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CpJpY6Zi7IyphD262mZyPHWMPDsMk1fOKGRcuezpDcQ=; b=Gg4aeFVHAn3KquChuF9Mid4QrQTRQBwG18vKdB7zHQNuXrETmO2d3NegaQXcOeUpp0ArAbJ/oGhk6I3dAO5UYfC3Bkbbdp71yT9HNkmGaJf4p+ErgXrh4Kwx4VcA7gkqWjRtUOmep5PNRl0LaoRmYbDMm29Q1fajjQpEB1HNzII= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653340407205992.4308819183285; Mon, 23 May 2022 14:13:27 -0700 (PDT) Received: from localhost ([::1]:46492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFMj-0007XA-KK for importer2@patchew.org; Mon, 23 May 2022 17:13:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy8-0008OW-F0 for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:00 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:53019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy3-00052T-JP for qemu-devel@nongnu.org; Mon, 23 May 2022 16:47:56 -0400 Received: by mail-pj1-x1034.google.com with SMTP id l14so15064576pjk.2 for ; Mon, 23 May 2022 13:47:55 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:53 -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=CpJpY6Zi7IyphD262mZyPHWMPDsMk1fOKGRcuezpDcQ=; b=sb3JFY4untB5UH6tbCKZ3cy4DNgG4NsQc8o+H1jbfWmha1FpENkxiCP8raRPaNkrNJ W07/0JJ6/nUnPKmdSV8kdsdo7htnD27B4YcsYDKkNW9E+dA1YcZmMFjhUZC6qpdj+60F X4a40AMezszzDlYGL9zlMUu9toT9PQO+povnGwHhVPc9/kXQgCbkBaIDVKWjJ975u+hV HdnLff27A6/eoiR74sQ390waqrgRqK2sbbqg3BKrcvHAS6wzFCOeiSO8hC1m+sWdzm+7 VNw2oNZG8/N4q/3dDEld1sjMKxhxlajz/bEtOtmsVmBLO9lw4xmJZAdkmeHBAwYNtds/ yq4A== 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=CpJpY6Zi7IyphD262mZyPHWMPDsMk1fOKGRcuezpDcQ=; b=y1ZxxnpSLhUoiXJ4YIP91mc6+ccEdo7fhz3rma7HZAc+sW8C740ojGtTh65pLDz5jR Q4k9A1RgsCGR56U0h4rgG/weRvcdCyHsA3kPqvKL81diCBOFrJKbb9WiUxmmYcsj8apb Ho9+YSy1pKpv4CbU02ZcVThypq5lKJlh22WA63DNRpWf/a71/GgDOmWfxEt/mtpRjRHK ZIMLLJd11bbPpLjtRuWLIuTxtOP65g9WY+TuheQwLPwFr2qUxhr/HYVnSv+mYKbX2vw8 n7NpP1B+IG0SY8rSTatuANadujv9DvztS2e3Sry3p2e4Q8soGy0qnFDPTKJOlLB/vn7a TI3w== X-Gm-Message-State: AOAM532esf62kblzWvizNSeotxJV0BulBvhJGyeiI7J8jLy9Ij5uBxOT 7nJOcDcJz+z/gC191NdWmkomNgkIr3G4hA== X-Google-Smtp-Source: ABdhPJyBwQqQDznd9OQOUJfkXPLtyJ/pS7TUaR9A7nSVeVy1LJ6KUyogFIAJ6pLhVJBAzaIKCuKFZQ== X-Received: by 2002:a17:902:dad1:b0:161:a5b5:c8f4 with SMTP id q17-20020a170902dad100b00161a5b5c8f4mr23724510plx.169.1653338874207; Mon, 23 May 2022 13:47:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 10/18] target/arm: Move arm_debug_exception_fsr to debug_helper.c Date: Mon, 23 May 2022 13:47:34 -0700 Message-Id: <20220523204742.740932-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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=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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653340408537100001 Content-Type: text/plain; charset="utf-8" This function now now only used in debug_helper.c, so there is no reason to have a declaration in a header. Signed-off-by: Richard Henderson --- target/arm/internals.h | 25 ------------------------- target/arm/debug_helper.c | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 91702b3ff7..bb45100f06 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -794,31 +794,6 @@ static inline TCR *regime_tcr(CPUARMState *env, ARMMMU= Idx mmu_idx) return &env->cp15.tcr_el[regime_el(env, mmu_idx)]; } =20 -/* Return the FSR value for a debug exception (watchpoint, hardware - * breakpoint or BKPT insn) targeting the specified exception level. - */ -static inline uint32_t arm_debug_exception_fsr(CPUARMState *env) -{ - ARMMMUFaultInfo fi =3D { .type =3D ARMFault_Debug }; - int target_el =3D arm_debug_target_el(env); - bool using_lpae =3D false; - - if (target_el =3D=3D 2 || arm_el_is_aa64(env, target_el)) { - using_lpae =3D true; - } else { - if (arm_feature(env, ARM_FEATURE_LPAE) && - (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) { - using_lpae =3D true; - } - } - - if (using_lpae) { - return arm_fi_to_lfsc(&fi); - } else { - return arm_fi_to_sfsc(&fi); - } -} - /** * arm_num_brps: Return number of implemented breakpoints. * Note that the ID register BRPS field is "number of bps - 1", diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index bdcd5f36d6..08d461fd19 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -378,6 +378,32 @@ bool arm_debug_check_watchpoint(CPUState *cs, CPUWatch= point *wp) return check_watchpoints(cpu); } =20 +/* + * Return the FSR value for a debug exception (watchpoint, hardware + * breakpoint or BKPT insn) targeting the specified exception level. + */ +static uint32_t arm_debug_exception_fsr(CPUARMState *env) +{ + ARMMMUFaultInfo fi =3D { .type =3D ARMFault_Debug }; + int target_el =3D arm_debug_target_el(env); + bool using_lpae =3D false; + + if (target_el =3D=3D 2 || arm_el_is_aa64(env, target_el)) { + using_lpae =3D true; + } else { + if (arm_feature(env, ARM_FEATURE_LPAE) && + (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) { + using_lpae =3D true; + } + } + + if (using_lpae) { + return arm_fi_to_lfsc(&fi); + } else { + return arm_fi_to_sfsc(&fi); + } +} + void arm_debug_excp_handler(CPUState *cs) { /* --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339898; cv=none; d=zohomail.com; s=zohoarc; b=NvcwzUbLIPg+R4OmE71vx9OXB8fWNkxRlc/8tquWPZqNFZpCqE5+YAY7pBbR9HoiWL0vOGi/MUVgQ2mSEsS3N9FVpWRRTbZ1tZqXSLxJ5Rm3XakocfgEhZX6WebaRuXy9Gba4xDIdOGMsloW5EZ9XjcmcW+fZgSLj0rbQVEJQnk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339898; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3bqX2hAe2Sjw2v5YRDxIGUXWsq30Bbv7KtpnLqEB4zE=; b=E5VWvQ5MQccQMWEwnp7M3qGpyGi9jC++RnXCmryN6HlmyiQsy1LaXuixWTzudjI+03eKPu7H9kfR5xei2QCDBg93HVoM5T614exgpad86nI1KQ/+zcky39t9JC4VlKHB55IEsP4JT5qBcL9XMRphfPphXShsOb6zPEVbzz2/d+0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653339898082794.0992394365586; Mon, 23 May 2022 14:04:58 -0700 (PDT) Received: from localhost ([::1]:56404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFEX-0002wk-2Z for importer2@patchew.org; Mon, 23 May 2022 17:04:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy9-0008Ug-Uv for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:01 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:42932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy8-000539-3q for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:01 -0400 Received: by mail-pj1-x1032.google.com with SMTP id a23-20020a17090acb9700b001df4e9f4870so368820pju.1 for ; Mon, 23 May 2022 13:47:56 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:54 -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=3bqX2hAe2Sjw2v5YRDxIGUXWsq30Bbv7KtpnLqEB4zE=; b=FYGDDMhS5YogglGyw3rxUdVX5dAu2do5oDVC6igkJVyMjGeUhXjyRpgjHZfeRHR4+m uOx5zG5xlvucSfTPaf9YaUEJ/OYpmDToDdEylLIfvOUcrCthrWoUkli1nL9mKYjR8oN/ f8Xi08CQY+Xaa9d1dAEkWdxQuQD6awGmxxc7czwYkBGFeD+giw708ZSrPHaxvJ1Z1hsZ 6rKcNmq74Ku9YyGM3xQE7vngN2HVjSHUfFm3405kaCjROG6DDukVZWv6RShVfwl1c5qp 1c4SQGt13VR7HPVwaYC2n707oBHeL8yab61oP0YaY8VSyK0nWhhDxyk86I3r5mVZCKHQ +tVw== 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=3bqX2hAe2Sjw2v5YRDxIGUXWsq30Bbv7KtpnLqEB4zE=; b=UHcKqXJZSXKWxpH0WGOeuBBkjT1VAknNp1SpBsPm8TdrS1MU81QAQm76BYvPWIGELl GE8FrZ6GJhVgMwRpw3FXBjptTU00IuYctSr/KBp8iJUhQkjnQ3SKL5x26F5OeHliUWQg Cuu5CGWW6K1xdQNPRovJLRE03MtBVT3ldNh93+TqWZ9UFbufdVg1FD9HSe60lYVKV1Gx sKVINM+hG71hFCfdR5+B7tZevqZWwJ3mtk05dGBp0/61Adu7lsIgVnykDERqNi0MYIp5 vszfb7lmekvFr71B8vm2FZHtBoRlaMZjooRqmd1WZ69FJUqSIzE6Q7NB15++M7auwJQr vlMg== X-Gm-Message-State: AOAM5338zhli6OWzYs8z+plZ7/oK0q352n5MTrqQTmrVJ+/u7EF7EAP8 U8ZmRx7BMuO/uyjPoOvKw+NdDVEU1fHlcw== X-Google-Smtp-Source: ABdhPJwIHXMFvuYdtCbMHK9zlrhdVd8OSviCFmQoJUf5fbKR19ZSwMwA5YlozlhhcJQiXC9+Gwka1w== X-Received: by 2002:a17:90b:3e8d:b0:1e0:3d95:a0e1 with SMTP id rj13-20020a17090b3e8d00b001e03d95a0e1mr834551pjb.61.1653338875464; Mon, 23 May 2022 13:47:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 11/18] target/arm: Move arm_debug_target_el to internals.h Date: Mon, 23 May 2022 13:47:35 -0700 Message-Id: <20220523204742.740932-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339898768100001 Content-Type: text/plain; charset="utf-8" This function is private to the implementation. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 21 --------------------- target/arm/internals.h | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 92c9758e86..90cdc7b1de 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2967,27 +2967,6 @@ typedef enum ARMASIdx { ARMASIdx_TagS =3D 3, } ARMASIdx; =20 -/* Return the Exception Level targeted by debug exceptions. */ -static inline int arm_debug_target_el(CPUARMState *env) -{ - bool secure =3D arm_is_secure(env); - bool route_to_el2 =3D false; - - if (arm_is_el2_enabled(env)) { - route_to_el2 =3D env->cp15.hcr_el2 & HCR_TGE || - env->cp15.mdcr_el2 & MDCR_TDE; - } - - if (route_to_el2) { - return 2; - } else if (arm_feature(env, ARM_FEATURE_EL3) && - !arm_el_is_aa64(env, 3) && secure) { - return 3; - } else { - return 1; - } -} - static inline bool arm_v7m_csselr_razwi(ARMCPU *cpu) { /* If all the CLIDR.Ctypem bits are 0 there are no caches, and diff --git a/target/arm/internals.h b/target/arm/internals.h index bb45100f06..685214503b 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1068,6 +1068,27 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env,= uint64_t va, =20 int exception_target_el(CPUARMState *env, int cur_el, uint32_t *psyn); =20 +/* Return the Exception Level targeted by debug exceptions. */ +static inline int arm_debug_target_el(CPUARMState *env) +{ + bool secure =3D arm_is_secure(env); + bool route_to_el2 =3D false; + + if (arm_is_el2_enabled(env)) { + route_to_el2 =3D env->cp15.hcr_el2 & HCR_TGE || + env->cp15.mdcr_el2 & MDCR_TDE; + } + + if (route_to_el2) { + return 2; + } else if (arm_feature(env, ARM_FEATURE_EL3) && + !arm_el_is_aa64(env, 3) && secure) { + return 3; + } else { + return 1; + } +} + /* Determine if allocation tags are available. */ static inline bool allocation_tag_access_enabled(CPUARMState *env, int el, uint64_t sctlr) --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653340095; cv=none; d=zohomail.com; s=zohoarc; b=dFyrrvB1SyKNXReMklWUSodVTkmjmMuD4sFjrNXF2LFfOXZ7u8mWuOtNX7W5qWrzdzhBsOpvihqXJoY/fstpspbLlyEMvopX79D68i/TxtnNjd1/qBx3MBC2/RAtGlzTIWVteHbQwdFfpkHYw7+yy/ey5uK5pig7P/PIeCfrhQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653340095; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YgXeFZJ++svyGxcNWIu+V+WtRKFzNHxuY5DM2JGZ0B0=; b=kJIwxYvDJ0mW+PB2sOhWGZmta8wLl9XVEpfBa52RzBo8GiD7k2H9O5KC1bCqe3dgwYStEw4Xi7AFZAxZN4Cm73Yse3X1HO1lhVEPcPUQ0XFAe4run4Ss1zTsp27CticKvf2F7opXAR28EPeNynHU2eR5iteT6LJe/Q+KMad6JzM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165334009594078.38546050660307; Mon, 23 May 2022 14:08:15 -0700 (PDT) Received: from localhost ([::1]:35964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFHi-0000I4-QD for importer2@patchew.org; Mon, 23 May 2022 17:08:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEyG-0000Kb-FL for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:08 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:33572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy8-00053i-89 for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:07 -0400 Received: by mail-pl1-x636.google.com with SMTP id 10so10694254plj.0 for ; Mon, 23 May 2022 13:47:57 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:56 -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=YgXeFZJ++svyGxcNWIu+V+WtRKFzNHxuY5DM2JGZ0B0=; b=nOpxxtlZ82NIBSeSHYtbSiGQY+olxw6hPaKO0+mEwOvHxpCCWe/zRQRoQuthEue8Dl 44knTcjYfidnYE//c2UKTBXvuAFdBK9I5RXV/mw3LwiajN+QCYVMCcUBoWiTcJtoYMhQ Rl1NAJ8H+NT4FyRdYo3e183od2LhAqOGNr2rHgmga7dXAyRygb4r7oV2dL7UIjPD+Q7P rFEW/EYPSH0GLqPoQQnC/tLasd+zCuhnnG/rtGTW2LGqvKH+khbC/pJw4hnhgpLRZ9TJ w35iphH/gjHvB1JXJKHWfCfHj25U6ZqTagycRZp3W5wiYJNOp+RLoJB13qwa4ngx8kiE M2ow== 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=YgXeFZJ++svyGxcNWIu+V+WtRKFzNHxuY5DM2JGZ0B0=; b=YX7plkLXHQm0fRJoRMeX42fOW28Wt02PYpZj7+0xdZV29Z4JbrRgLdRLqeLj2kgFjA T5ug++B8YceGH72bOmtlfT53286US9nNHbH/p6BHx/2ioYfoyRQOIS7cEJgVmIn0PHg3 oHwPyv+w2GQFD6IjAsgPnDMMrFDNsLoeW2fPSGhsflpCDAdKRUlPtvO3gpgzUUfEtZlM HHPINkg84sdsRycqHsVcN5ak+Ji0TQCy54ddusdjnS261tODdSEssftXVZ8c3N7fykP8 jgpNKZP6KcNxAMSDZhZFjo1IQ/vjOXlsHpXj6OYSWUcboeYprj7xA2TZxfWVnjXzTnSb LSFw== X-Gm-Message-State: AOAM533MCu7QzXcIPXuTGSPJsxtVNlaSARoWSfRRK6BEQVlUWT3ylxy7 KVfuFE/yyBnAbSlBttuS+tV/FNmlUwVT4g== X-Google-Smtp-Source: ABdhPJxaykZi3Yx01upm/1nfWujgepEmiO+0eTyr2nRnUDr+azeN8p7ojn9wLcjpL8UrI8DZhCfOLg== X-Received: by 2002:a17:90b:1e50:b0:1e0:3a08:9b12 with SMTP id pi16-20020a17090b1e5000b001e03a089b12mr826455pjb.119.1653338876559; Mon, 23 May 2022 13:47:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 12/18] target/arm: Create raise_exception_debug Date: Mon, 23 May 2022 13:47:36 -0700 Message-Id: <20220523204742.740932-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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=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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653340096471100001 Content-Type: text/plain; charset="utf-8" Handle EL testing for debug exceptions in a single place. Split out raise_exception_int as a common helper. Signed-off-by: Richard Henderson --- target/arm/internals.h | 8 ++++++++ target/arm/debug_helper.c | 27 ++++-------------------- target/arm/op_helper.c | 43 ++++++++++++++++++++++++++++++++------- 3 files changed, 48 insertions(+), 30 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 685214503b..6df38db836 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -125,6 +125,14 @@ G_NORETURN void raise_exception_ra(CPUARMState *env, u= int32_t excp, uint32_t syndrome, uint32_t cur_or_target_el, uintptr_t ra= ); =20 +/** + * raise_exception_debug: + * Similarly. If @excp !=3D EXCPBKPT, modify syndrome to indicate + * when origin and target EL are the same. + */ +G_NORETURN void raise_exception_debug(CPUARMState *env, uint32_t excp, + uint32_t syndrome); + /* * For AArch64, map a given EL to an index in the banked_spsr array. * Note that this mapping and the AArch32 mapping defined in bank_number() diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 08d461fd19..181ba7b042 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -417,19 +417,16 @@ void arm_debug_excp_handler(CPUState *cs) if (wp_hit) { if (wp_hit->flags & BP_CPU) { bool wnr =3D (wp_hit->flags & BP_WATCHPOINT_HIT_WRITE) !=3D 0; - bool same_el =3D arm_debug_target_el(env) =3D=3D arm_current_e= l(env); =20 cs->watchpoint_hit =3D NULL; =20 env->exception.fsr =3D arm_debug_exception_fsr(env); env->exception.vaddress =3D wp_hit->hitaddr; - raise_exception(env, EXCP_DATA_ABORT, - syn_watchpoint(same_el, 0, wnr), - arm_debug_target_el(env)); + raise_exception_debug(env, EXCP_DATA_ABORT, + syn_watchpoint(0, 0, wnr)); } } else { uint64_t pc =3D is_a64(env) ? env->pc : env->regs[15]; - bool same_el =3D (arm_debug_target_el(env) =3D=3D arm_current_el(e= nv)); =20 /* * (1) GDB breakpoints should be handled first. @@ -449,9 +446,7 @@ void arm_debug_excp_handler(CPUState *cs) * exception/security level. */ env->exception.vaddress =3D 0; - raise_exception(env, EXCP_PREFETCH_ABORT, - syn_breakpoint(same_el), - arm_debug_target_el(env)); + raise_exception_debug(env, EXCP_PREFETCH_ABORT, syn_breakpoint(0)); } } =20 @@ -461,9 +456,6 @@ void arm_debug_excp_handler(CPUState *cs) */ void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) { - int debug_el =3D arm_debug_target_el(env); - int cur_el =3D arm_current_el(env); - /* FSR will only be used if the debug target EL is AArch32. */ env->exception.fsr =3D arm_debug_exception_fsr(env); /* @@ -472,18 +464,7 @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uin= t32_t syndrome) * exception/security level. */ env->exception.vaddress =3D 0; - /* - * Other kinds of architectural debug exception are ignored if - * they target an exception level below the current one (in QEMU - * this is checked by arm_generate_debug_exceptions()). Breakpoint - * instructions are special because they always generate an exception - * to somewhere: if they can't go to the configured debug exception - * level they are taken to the current exception level. - */ - if (debug_el < cur_el) { - debug_el =3D cur_el; - } - raise_exception(env, EXCP_BKPT, syndrome, debug_el); + raise_exception_debug(env, EXCP_BKPT, syndrome); } =20 #if !defined(CONFIG_USER_ONLY) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 0a50dbf274..c4988b6c41 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -65,15 +65,11 @@ int exception_target_el(CPUARMState *env, int cur_el, u= int32_t *psyn) return 1; } =20 -void raise_exception(CPUARMState *env, uint32_t excp, uint32_t syndrome, - uint32_t cur_or_target_el) +G_NORETURN static +void raise_exception_int(CPUARMState *env, uint32_t excp, + uint32_t syndrome, uint32_t target_el) { CPUState *cs =3D env_cpu(env); - int target_el =3D cur_or_target_el; - - if (cur_or_target_el <=3D 1) { - target_el =3D exception_target_el(env, cur_or_target_el, &syndrome= ); - } =20 assert(!excp_is_internal(excp)); cs->exception_index =3D excp; @@ -82,6 +78,39 @@ void raise_exception(CPUARMState *env, uint32_t excp, ui= nt32_t syndrome, cpu_loop_exit(cs); } =20 +void raise_exception(CPUARMState *env, uint32_t excp, uint32_t syndrome, + uint32_t cur_or_target_el) +{ + int target_el =3D cur_or_target_el; + if (cur_or_target_el <=3D 1) { + target_el =3D exception_target_el(env, cur_or_target_el, &syndrome= ); + } + raise_exception_int(env, excp, syndrome, target_el); +} + +void raise_exception_debug(CPUARMState *env, uint32_t excp, uint32_t syndr= ome) +{ + int cur_el =3D arm_current_el(env); + int debug_el =3D arm_debug_target_el(env); + + /* + * Most kinds of architectural debug exception are ignored if + * they target an exception level below the current (in QEMU + * this is checked by arm_generate_debug_exceptions()). + * Breakpoint instructions are special because they always generate + * an exception to somewhere: if they can't go to the configured + * debug exception level they are taken to the current exception level. + */ + if (excp =3D=3D EXCP_BKPT) { + debug_el =3D MAX(cur_el, debug_el); + } else { + assert(debug_el >=3D cur_el); + syndrome |=3D (debug_el =3D=3D cur_el) << ARM_EL_EC_SHIFT; + } + + raise_exception_int(env, excp, syndrome, debug_el); +} + void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome, uint32_t cur_or_target_el, uintptr_t ra) { --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653340849; cv=none; d=zohomail.com; s=zohoarc; b=EyG70k20Ch1UmM6CWClCZmj1eTVhZyLBJyJR18UdQkYmch8bejBp3FM043inT1EPaRid+A8MhfeNZ40K3WtDs9R2cW+rsikOJrGFLWSs95DJkLPmf53GBBvIr/FVnSNipfjCwJpLe4zJ0qxviGLdKHRLa+q1dtN3srqg2h5nTCg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653340849; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0l/HYM1MzYvxmgSMUeS6CVNkTdoldvUQuoyQcBcw45w=; b=OtKYEJpIKDFFH8It5pKWxk6kjKXi5cTan1MhcZcwiAhww2PsQ5Bd79Pd+4BBMJYiuNrBm7iQJ+MJ2pB9rXeHXQbrcxrLguGgLtIMrU0bghLx7fANR3ed+DqDRi4ft0SirQZNvQAMSh4FR8QcDO7FOS6XV3Bxhv/hPHulTSE+F5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653340849689816.4042851556735; Mon, 23 May 2022 14:20:49 -0700 (PDT) Received: from localhost ([::1]:38966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFTs-0003N0-9z for importer2@patchew.org; Mon, 23 May 2022 17:20:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEyG-0000MJ-D0 for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:08 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:33266) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy8-00053v-7s for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:08 -0400 Received: by mail-pj1-x1032.google.com with SMTP id fw21-20020a17090b129500b001df9f62edd6so687549pjb.0 for ; Mon, 23 May 2022 13:47:58 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:57 -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=0l/HYM1MzYvxmgSMUeS6CVNkTdoldvUQuoyQcBcw45w=; b=WuVnQgDb21KqtZ4yCnf/Bpo8Krip0O8t+gZUkhcig5+eoChj3Dlav8LH3+vRDtNSfo 389AUc+QEsQuiAJXReaQtSWq6m11v8EP9xnur0hqGvSPPFzLrHBKRzBRyF667xc5FyhS picFLUIpzYgwFLLT0H++7JB1e4zIr4IHl/fvHPyxr2dYTD0QuDU9ieZkkrSdRxn/0rnP 1lpavh4o+SYcB36XJBNZ4WpsgF4zXUVfTSMPeUxQqNLM3GBiWtHkrq0rYDK+g/4xurNu U6HUnASCihbvme6RhQvspgC0wKQgZBq5JdL4nknI9aZsvhS8oeWvhgGiful1K2bYLhfF jRnQ== 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=0l/HYM1MzYvxmgSMUeS6CVNkTdoldvUQuoyQcBcw45w=; b=DetrEx7chbt3yJ2T5XDjpuh0zKxYnjeno0PwfM1M60kvbB3Vx5IgTW6WcT4/snfPzy 7/fh99ImwnXJOZEggpov3gugn8qJ71GlwpG0yMh6oUBR94ikcVRLgOA9ALXgw4aT6tK8 t2vwL3sPnsTn00tayaB/Jl5P2o4kJwcCU05nA/nuaydig5jfPfUvrCcNKn/iwPAoKWwY nIhSq7JzZU+KkPGq6SfLF92p3KnlnQuBLKY5Wcx4Y2H4/Tuzljdb8otuIJ8QW5QzbAQz oV9taF7P2rhZji85HeJyAze22QAhJ78YYKElJeDfyEcx626/HC6VGSuTiAUPuxBBp0XI 9knA== X-Gm-Message-State: AOAM530ziJ0l6vvuBtmj12yueG5H6EPNCM06r7U4g1hkV4bG3I6qpnkh 6p1Dnm/pkpib616iPv+tDocbGBRA1QTDFQ== X-Google-Smtp-Source: ABdhPJzBvcUwJb3O9H1H4nh4UUcQmsLNDbVVeJdIuLG1kbAj0cCfvw1QiOUkzcjeGX/TGJ2GdTa4HA== X-Received: by 2002:a17:90a:4e4f:b0:1df:6e40:ef22 with SMTP id t15-20020a17090a4e4f00b001df6e40ef22mr837850pjl.105.1653338877540; Mon, 23 May 2022 13:47:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 13/18] target/arm: Move MDCR_TDE test into exception_target_el Date: Mon, 23 May 2022 13:47:37 -0700 Message-Id: <20220523204742.740932-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653340851183100001 Content-Type: text/plain; charset="utf-8" Add a debug parameter, and when true test MDCR_EL2.TDE. Use this in arm_debug_target_el. Signed-off-by: Richard Henderson --- target/arm/internals.h | 20 +++----------------- target/arm/op_helper.c | 12 ++++++++++-- target/arm/tlb_helper.c | 4 ++-- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 6df38db836..fbb69e6919 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1074,27 +1074,13 @@ typedef struct ARMVAParameters { ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, ARMMMUIdx mmu_idx, bool data); =20 -int exception_target_el(CPUARMState *env, int cur_el, uint32_t *psyn); +int exception_target_el(CPUARMState *env, int cur_el, + uint32_t *psyn, bool debug); =20 /* Return the Exception Level targeted by debug exceptions. */ static inline int arm_debug_target_el(CPUARMState *env) { - bool secure =3D arm_is_secure(env); - bool route_to_el2 =3D false; - - if (arm_is_el2_enabled(env)) { - route_to_el2 =3D env->cp15.hcr_el2 & HCR_TGE || - env->cp15.mdcr_el2 & MDCR_TDE; - } - - if (route_to_el2) { - return 2; - } else if (arm_feature(env, ARM_FEATURE_EL3) && - !arm_el_is_aa64(env, 3) && secure) { - return 3; - } else { - return 1; - } + return exception_target_el(env, 0, NULL, true); } =20 /* Determine if allocation tags are available. */ diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index c4988b6c41..9fc9ab3d20 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -28,7 +28,8 @@ #define SIGNBIT (uint32_t)0x80000000 #define SIGNBIT64 ((uint64_t)1 << 63) =20 -int exception_target_el(CPUARMState *env, int cur_el, uint32_t *psyn) +int exception_target_el(CPUARMState *env, int cur_el, + uint32_t *psyn, bool debug) { /* * FIXME: The following tests really apply to an EL0 origin, @@ -62,6 +63,12 @@ int exception_target_el(CPUARMState *env, int cur_el, ui= nt32_t *psyn) return 2; } =20 + if (debug + && (env->cp15.mdcr_el2 & MDCR_TDE) + && arm_is_el2_enabled(env)) { + return 2; + } + return 1; } =20 @@ -83,7 +90,8 @@ void raise_exception(CPUARMState *env, uint32_t excp, uin= t32_t syndrome, { int target_el =3D cur_or_target_el; if (cur_or_target_el <=3D 1) { - target_el =3D exception_target_el(env, cur_or_target_el, &syndrome= ); + target_el =3D exception_target_el(env, cur_or_target_el, + &syndrome, false); } raise_exception_int(env, excp, syndrome, target_el); } diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c index 573e18f830..3bf4107faa 100644 --- a/target/arm/tlb_helper.c +++ b/target/arm/tlb_helper.c @@ -90,7 +90,7 @@ void arm_deliver_fault(ARMCPU *cpu, vaddr addr, uint32_t syn, exc, fsr, fsc; =20 cur_el =3D arm_current_el(env); - target_el =3D exception_target_el(env, cur_el, NULL); + target_el =3D exception_target_el(env, cur_el, NULL, false); =20 if (fi->stage2) { target_el =3D 2; @@ -141,7 +141,7 @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr va= ddr, void helper_exception_pc_alignment(CPUARMState *env, target_ulong pc) { ARMMMUFaultInfo fi =3D { .type =3D ARMFault_Alignment }; - int target_el =3D exception_target_el(env, arm_current_el(env), NULL); + int target_el =3D exception_target_el(env, arm_current_el(env), NULL, = false); int mmu_idx =3D cpu_mmu_index(env, true); uint32_t fsc; =20 --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653340624; cv=none; d=zohomail.com; s=zohoarc; b=Zp6shzV25xmy/kL20GkrZYEHn90mTgx0VfDKsUdlvqXshXf9hEL+vzk9aMaaNw4RrJi7X8lXLZokGlBkcEe6XxYbZw+JP96gHBmON1JHVwbpSe9cwlBS0bBdRVAbyFdiEl3pRHS2vkyVqtS33Eon0w0ogZKwbseIm/PtLjCVCvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653340624; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XRiK/19DWWGa+NhpLf6AkOpMmSAQF90yzy5A4YWSxoA=; b=Nbhjt/NaYcqjjO8d3TB2KxAJ//yvMUsLrq7quXIqilXnAgCO56i4vFkjTNi2X4dU29WMfC7zZHD3hTwWRuPXWNk31+xRGyZP/MhyRSYO4C4W2qQ2z11+QOnyWUMVHFWED3Utfm22umiMPY8DXb0XMpYqLZFxwwg1InTtjxMGY20= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653340624597991.4138831986429; Mon, 23 May 2022 14:17:04 -0700 (PDT) Received: from localhost ([::1]:55576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFQF-00053D-7r for importer2@patchew.org; Mon, 23 May 2022 17:17:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEy9-0008UA-Qv for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:01 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:38777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy8-000548-5F for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:01 -0400 Received: by mail-pj1-x102a.google.com with SMTP id o13-20020a17090a9f8d00b001df3fc52ea7so289785pjp.3 for ; Mon, 23 May 2022 13:47:59 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:58 -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=XRiK/19DWWGa+NhpLf6AkOpMmSAQF90yzy5A4YWSxoA=; b=bV1DuWmDQX1KtqbaHwYK5B8unjJu2sgSW46SqRdrxw1aicb3i+5xmfABZ5X5y4pro+ F67JlpL8zNt9W6ibowHIaMvHlTxLAurv7+yaSLzemOSp570hBwBUmDnLQJwUKbXzl9/2 cpVwtNzkjja/GvjS5tnbfpJu2BtZvNtDJ9lnNUBQXJEghxxnqnin2wW8u4dxO9IURHKl JXgOLNqEnXMVXoYlLT8XayYcYjt0UvQtgX9QNNjj8TlIJaMmCfEQFgJRIbjbNtVvxRiZ vSvvQY28lFzonPHBG1dM7nOEbNCm7dz4pfRg7tjY/0CoyKh7f7yNu+qGXxfKhpAOW2Co diiQ== 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=XRiK/19DWWGa+NhpLf6AkOpMmSAQF90yzy5A4YWSxoA=; b=UNCNP2jcezAO7vfEg4Y2iLibrLkxtC95TDuGI+x1E7pJjhIBxvroz6KhFj/uCvcPtt EVukv71ZLurLRjPpmy8e7elksDUp9wNDvzo6ZALu/TduZ9Y2iuK2NVCMXwufR2kECofF 6mWSAd4wuDV2mSHAyBfO9e0Uauk2bymivKuSQJlw4aAkvR+GVvG8CURYGVNv9rjnJ7nY E5IL9sSKiGEqj/BQMOw6GJbeqr2YlBSxa1ZEwC0wVCjjLsWvogAJgk1hcKx+IJSVQGo/ fL9Xa5qajruvqxaa4gx9NXzdfINHl+Ak6P+U9Bwh+4RDVaCVhHh6SWgLwrgZq7xeiu1/ 1QfA== X-Gm-Message-State: AOAM532ifA6SwG0qtB/n5sXiHYTZejHS4ooeEIJwr7pp3Arpl3RAqDxC 2vHtInCpYbO9b1Naty5kLhXwN6TO8ZGRuA== X-Google-Smtp-Source: ABdhPJw/Ynw0rz0FEHnmlL4EyqlsMY0zuhy8kla5zJU2zCLIsRPj/1nRlivmRShWxnrhpINMvb0zLA== X-Received: by 2002:a17:902:dad1:b0:161:9abb:fb75 with SMTP id q17-20020a170902dad100b001619abbfb75mr24319653plx.135.1653338878604; Mon, 23 May 2022 13:47:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 14/18] target/arm: Mark exception helpers as noreturn Date: Mon, 23 May 2022 13:47:38 -0700 Message-Id: <20220523204742.740932-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653340625642100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index b1334e0c42..5161cdf73d 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -44,9 +44,9 @@ DEF_HELPER_FLAGS_2(usad8, TCG_CALL_NO_RWG_SE, i32, i32, i= 32) =20 DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) -DEF_HELPER_2(exception_internal, void, env, i32) -DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) -DEF_HELPER_2(exception_bkpt_insn, void, env, i32) +DEF_HELPER_2(exception_internal, noreturn, env, i32) +DEF_HELPER_4(exception_with_syndrome, noreturn, env, i32, i32, i32) +DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32) DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) DEF_HELPER_1(setend, void, env) DEF_HELPER_2(wfi, void, env, i32) --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653339744; cv=none; d=zohomail.com; s=zohoarc; b=Vqc+Phvk+nJPpn1C86EryzMw9sUHjg075WA5O+cn2cmas9BKq3TQhEPiKKZYCvZ9TmIAV+Q+tjWgQUvMFP4Hn6ILWjmzeLhsvtSx1kB5w+bXFRvwm0X511zGeYsG/6OlyO80fZO4BQoM+b9qumMhKuSFUHbBQcaQCjCfCWmI5SU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653339744; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jD6P95boxWaFHWGjo6mmW0PDhuVHQHt7cpvcaNfyIzM=; b=n5Imq3KpevN0aRgjJXSrSIBkoII98I/+eljwPhBcfYKCt9oeP3xiQ4QUYhAAGxCZZZSS0xV7Mkqx5W0NO/PAeaW85hdoiFDEt+liQEFc56j1fmaQTdQlAXcDQ4BEjB6x5Pnn3GC7PSWJSzCzIp72WqNfSt9kpB0DDgp7E7IArRM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653339744118290.18503743592134; Mon, 23 May 2022 14:02:24 -0700 (PDT) Received: from localhost ([::1]:52978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFC2-0000UU-WE for importer2@patchew.org; Mon, 23 May 2022 17:02:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEyI-0000TC-Ja for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:10 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:36666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy9-00054H-70 for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:10 -0400 Received: by mail-pf1-x432.google.com with SMTP id f21so2348782pfa.3 for ; Mon, 23 May 2022 13:48:00 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:47:59 -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=jD6P95boxWaFHWGjo6mmW0PDhuVHQHt7cpvcaNfyIzM=; b=AGLnsTiuOea8q9OM9vQ8LQN5rvwKktk8ok0EGJyznLa4ht4voMoryoVz3zVTDd7fyE +ryzjM9jlZqzWBEzIWRMe1Viba4OTHCMnUnSVUgftIoGsWtg8OsMHAumxEfHu0nfu5Aw +zgtToE8a9eF8sfu0qeeZG2Y7Ai9Wtg08BZScM/fm5C8KfilkFdtYkEZbCOmpBsJkS7z Ifp1f+u/3UutB3Z7VHMV5pDSPRxMMOrcvJi9H2XYxtzcCMq3i6iZ8+dlarjsVt+31PTg W/V2QRdjNKzxifOnoX39Nw0cTKCp8k9WNw7CTk15c4Es+bGt0WArpDDuT9Z818D3ONRs iKaw== 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=jD6P95boxWaFHWGjo6mmW0PDhuVHQHt7cpvcaNfyIzM=; b=yhRA1SeoecbrhCYprjx7kJe8+jAt60s+Zeexc6BFEc5ITtOXIjzXqVNF4P1pIwju9B WiY1EmBtWYt+yxuqof6T/xPCHOeIl4yNLPrLTSRZ9tFh0H5MNHOpSw8CvRFeo2asZMjt 4wvBusW5QFoMQ3ucUK5miA5jg4D0voPIPwPMgqU1ssbGGws4F68m9kqA1sS23groJMXT 21cldbQ8k0DUIHmcCsSSaYYfw8AKvi4aYQvzsU7esyFfMDFIemye0b1VDwOUtO5Z+mhG JKxjXGtbbQKJuXbwoE9xNwzWpqyguBtbQovWLPh6TDovCBHQ3Xz9IddEwa4ZJ9bJ71F4 5R/Q== X-Gm-Message-State: AOAM532MRR6HKrj3h9QXNKfynQJs4VQ7hmun3h7QV7V2xxhOVwtc7+hN jd6or75ypYO1Pdr9XUMDlorHJ8eRBGr9hw== X-Google-Smtp-Source: ABdhPJyiIvOt+NUZu4ymMxbKY7xNr7Q77kkk7uvN8zTR1ATMp5UsOvcnA7DeGtVSjdJouT5T/VNABA== X-Received: by 2002:a63:d211:0:b0:3fa:8733:73a with SMTP id a17-20020a63d211000000b003fa8733073amr2963634pgg.606.1653338879602; Mon, 23 May 2022 13:47:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 15/18] target/arm: Create helper_exception_swstep Date: Mon, 23 May 2022 13:47:39 -0700 Message-Id: <20220523204742.740932-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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=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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653339746060100001 Content-Type: text/plain; charset="utf-8" Move the computation from gen_swstep_exception into a helper. The assert removed here is present in raise_exception_debug. Signed-off-by: Richard Henderson --- target/arm/helper.h | 1 + target/arm/translate.h | 12 +++--------- target/arm/debug_helper.c | 5 +++++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 5161cdf73d..f3fd53f3f9 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -47,6 +47,7 @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, DEF_HELPER_2(exception_internal, noreturn, env, i32) DEF_HELPER_4(exception_with_syndrome, noreturn, env, i32, i32, i32) DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32) +DEF_HELPER_2(exception_swstep, noreturn, env, i32) DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) DEF_HELPER_1(setend, void, env) DEF_HELPER_2(wfi, void, env, i32) diff --git a/target/arm/translate.h b/target/arm/translate.h index 6f0ebdc88e..c03dbfb618 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -340,15 +340,9 @@ static inline void gen_exception(int excp, uint32_t sy= ndrome, /* Generate an architectural singlestep exception */ static inline void gen_swstep_exception(DisasContext *s, int isv, int ex) { - bool same_el =3D (s->debug_target_el =3D=3D s->current_el); - - /* - * If singlestep is targeting a lower EL than the current one, - * then s->ss_active must be false and we can never get here. - */ - assert(s->debug_target_el >=3D s->current_el); - - gen_exception(EXCP_UDEF, syn_swstep(same_el, isv, ex), s->debug_target= _el); + /* Fill in the same_el field of the syndrome in the helper. */ + uint32_t syn =3D syn_swstep(false, isv, ex); + gen_helper_exception_swstep(cpu_env, tcg_constant_i32(syn)); } =20 /* diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 181ba7b042..8d87b65a8d 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -467,6 +467,11 @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uin= t32_t syndrome) raise_exception_debug(env, EXCP_BKPT, syndrome); } =20 +void HELPER(exception_swstep)(CPUARMState *env, uint32_t syndrome) +{ + raise_exception_debug(env, EXCP_UDEF, syndrome); +} + #if !defined(CONFIG_USER_ONLY) =20 vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len) --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653340409; cv=none; d=zohomail.com; s=zohoarc; b=YSRedsgE/Bv0FjZ/3uyM0KpiZARwBcTGIjfmib+l6thnm7tCIwv3REAHmu8B8CNbMuKJtpa939iCD03foXIDLQzWKKTaMXV95lstGOHsef801LUFPHykPJJCmRIZO3fizepVRk4di0ldfc9UYaTPKpG27BtKiE9oiKfJFcEqnrY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653340409; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UXDNe7UAiSjLL81qtpI/xgpK//7QQXPJ6zCsJfDQpFw=; b=M8LyaF+MgQC4HRvruoHkq9iLIiw/n77Y03lSbliqWN4vzO3st9ox/o3PaSfz4bFcmlSdWLy1QOjwp/ZgiexwJMH038XMj4gq3USfRlEUBOomgEptrmadqZ3+lrfyiRB84rZVIcAc9YW+AN2PIwEa+WoRgPWyZg2GirQM9Y9EhqU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653340409558704.8536696187939; Mon, 23 May 2022 14:13:29 -0700 (PDT) Received: from localhost ([::1]:46560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFMm-0007aT-Ay for importer2@patchew.org; Mon, 23 May 2022 17:13:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEyL-0000ay-Dc for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:13 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:41488) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEy9-00052D-CV for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:13 -0400 Received: by mail-pl1-x635.google.com with SMTP id s14so14123662plk.8 for ; Mon, 23 May 2022 13:48:00 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:48:00 -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=UXDNe7UAiSjLL81qtpI/xgpK//7QQXPJ6zCsJfDQpFw=; b=z3petxkLcmX5NT0SjAkaCua/Q0ApUEU+obVhXuzm0SROUzOqf8yGRYKMyz6de9v9jn UUWd650fHNfWFeEBl900PV7jqTTHj9SCGKRN8QKmfnwPvDnbzJtLT+hknA/aMGLVVQZH jBC1JlH7d+LdNq88A3o9eTRs07v/FNV4y1IDi0ctjzePQhfq5KCYH8x6NfGWhwu+5s8E 4CVzcHpLaUN56XsCNhZXHERj2lm/dd6AdcspNq11FNhq2w5NhMbGFY2pa4t1TRfGCo26 WNbN03CToneEYArKuB4IHY6LANuZGeFRa1d8tPX8nXUxbY0zFFD4101t/bUnf8/uNXYy ysSw== 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=UXDNe7UAiSjLL81qtpI/xgpK//7QQXPJ6zCsJfDQpFw=; b=FHJIHb+Q6VSNFO/y9h6hkrmAUAlGB1+MewPMo/5NFeES7MSamQ1mAymMWRsSkH86vs 5xuWmy8Br/mwwxjvlAOCdjBpiMTFXlh/xUDosPfXOQSO5Q5Lh0+0ZAYlTdKCpSaynwEa Lq46WmIIF3n/ulehjCmXizVgoh04cZkhE4oL94dcodUfv4bs2h8iYpDKtt/5kK28MdWz joZxMY4s/+GsMqQcii41/7OEMHeWrIGmA5/9J7VjaqrVlwlWBQ/PTc7WDQh9kimd9tG6 vz0mrMDlRy64Vv4mZxbdWJCK5YvU/RxMtylqRafdCDOJHzzqn+CNn+0ino7ll/peob9L ayCQ== X-Gm-Message-State: AOAM530zIOcXRdUQnV64wAdJnn0ZFdUzbHdq5w0bR0qsugvVaELMZyjx Q9Q1gsG+iD5zMCnO44jGzHoXC6A+PtY0oQ== X-Google-Smtp-Source: ABdhPJzaQLMxff7hwF2njaRzeNduRlXNX/6/JIL+prsMNyzrlEcRyFJ14c7Zl9v58Db5OvvOK7RWpg== X-Received: by 2002:a17:903:2d0:b0:14d:8a8d:cb1 with SMTP id s16-20020a17090302d000b0014d8a8d0cb1mr24329246plk.50.1653338880568; Mon, 23 May 2022 13:48:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 16/18] target/arm: Remove TBFLAG_ANY.DEBUG_TARGET_EL Date: Mon, 23 May 2022 13:47:40 -0700 Message-Id: <20220523204742.740932-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=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=no 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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653340410514100003 Content-Type: text/plain; charset="utf-8" We no longer need this value during translation, as it is now handled within the helpers. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 6 ++---- target/arm/translate.h | 2 -- target/arm/helper.c | 12 ++---------- target/arm/translate-a64.c | 1 - target/arm/translate.c | 1 - 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 90cdc7b1de..5bc6382fce 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3064,11 +3064,9 @@ FIELD(TBFLAG_ANY, BE_DATA, 3, 1) FIELD(TBFLAG_ANY, MMUIDX, 4, 4) /* Target EL if we take a floating-point-disabled exception */ FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) -/* For A-profile only, target EL for debug exceptions. */ -FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 10, 2) /* Memory operations require alignment: SCTLR_ELx.A or CCR.UNALIGN_TRP */ -FIELD(TBFLAG_ANY, ALIGN_MEM, 12, 1) -FIELD(TBFLAG_ANY, PSTATE__IL, 13, 1) +FIELD(TBFLAG_ANY, ALIGN_MEM, 10, 1) +FIELD(TBFLAG_ANY, PSTATE__IL, 11, 1) =20 /* * Bit usage when in AArch32 state, both A- and M-profile. diff --git a/target/arm/translate.h b/target/arm/translate.h index c03dbfb618..cd9ee41bbd 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -59,8 +59,6 @@ typedef struct DisasContext { */ uint32_t svc_imm; int current_el; - /* Debug target exception level for single-step exceptions */ - int debug_target_el; GHashTable *cp_regs; uint64_t features; /* CPU features bits */ bool aarch64; diff --git a/target/arm/helper.c b/target/arm/helper.c index e0be96b988..63c3fee5ff 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -13626,18 +13626,10 @@ static CPUARMTBFlags rebuild_hflags_m32(CPUARMSta= te *env, int fp_el, return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); } =20 -static CPUARMTBFlags rebuild_hflags_aprofile(CPUARMState *env) -{ - CPUARMTBFlags flags =3D {}; - - DP_TBFLAG_ANY(flags, DEBUG_TARGET_EL, arm_debug_target_el(env)); - return flags; -} - static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, ARMMMUIdx mmu_idx) { - CPUARMTBFlags flags =3D rebuild_hflags_aprofile(env); + CPUARMTBFlags flags =3D {}; int el =3D arm_current_el(env); =20 if (arm_sctlr(env, el) & SCTLR_A) { @@ -13663,7 +13655,7 @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState= *env, int fp_el, static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_e= l, ARMMMUIdx mmu_idx) { - CPUARMTBFlags flags =3D rebuild_hflags_aprofile(env); + CPUARMTBFlags flags =3D {}; ARMMMUIdx stage1 =3D stage_1_mmu_idx(mmu_idx); uint64_t tcr =3D regime_tcr(env, mmu_idx)->raw_tcr; uint64_t sctlr; diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index f502545307..cc9344b015 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14645,7 +14645,6 @@ static void aarch64_tr_init_disas_context(DisasCont= extBase *dcbase, dc->ss_active =3D EX_TBFLAG_ANY(tb_flags, SS_ACTIVE); dc->pstate_ss =3D EX_TBFLAG_ANY(tb_flags, PSTATE__SS); dc->is_ldex =3D false; - dc->debug_target_el =3D EX_TBFLAG_ANY(tb_flags, DEBUG_TARGET_EL); =20 /* Bound the number of insns to execute to those left on the page. */ bound =3D -(dc->base.pc_first | TARGET_PAGE_MASK) / 4; diff --git a/target/arm/translate.c b/target/arm/translate.c index 87a899d638..59d7542a48 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9354,7 +9354,6 @@ static void arm_tr_init_disas_context(DisasContextBas= e *dcbase, CPUState *cs) dc->v7m_lspact =3D EX_TBFLAG_M32(tb_flags, LSPACT); dc->mve_no_pred =3D EX_TBFLAG_M32(tb_flags, MVE_NO_PRED); } else { - dc->debug_target_el =3D EX_TBFLAG_ANY(tb_flags, DEBUG_TARGET_EL); dc->sctlr_b =3D EX_TBFLAG_A32(tb_flags, SCTLR__B); dc->hstr_active =3D EX_TBFLAG_A32(tb_flags, HSTR_ACTIVE); dc->ns =3D EX_TBFLAG_A32(tb_flags, NS); --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653340042; cv=none; d=zohomail.com; s=zohoarc; b=JEydwTfxyKGMcoqtY1Z5erXSXjB5RApwjVdav7gEnWE55nBm/WPJTDo01OOEVa+8tPLZMt9Ue6Mnc6z/BWEZ/ZmtSGlIWaEdriMmIvDMkfFTBgkM1cStCL+oKfJC+oGZd/dMYPZRMelPcEM68oysIpY4LCOB4CgdVrbcHnMFMXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653340042; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ob+JyjaA3mDDf+b8simoocWpP1x20nWcpANbzQ0uZBM=; b=AQmPBkXtcP19J4/C1AdWKDlMUSBU82hFqDlGThn0+3hfWxzRhlkfO9Fbw+01kfp6uPwpvPMkx+1ujUPwFeS9BM4lGlwd6oKBYeL1u+ldPv9d0pFEeO6qYff1UKATYmrzqw4TFlIfB6R3UN7i2M5Sv1jS5bKcm6ojMN775XlhVLo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653340042311940.4211110483726; Mon, 23 May 2022 14:07:22 -0700 (PDT) Received: from localhost ([::1]:33122 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFGr-0006nb-9r for importer2@patchew.org; Mon, 23 May 2022 17:07:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEyI-0000Tb-Os for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:10 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:42932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEyA-000539-D0 for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:10 -0400 Received: by mail-pj1-x1032.google.com with SMTP id a23-20020a17090acb9700b001df4e9f4870so368820pju.1 for ; Mon, 23 May 2022 13:48:01 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:48:01 -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=Ob+JyjaA3mDDf+b8simoocWpP1x20nWcpANbzQ0uZBM=; b=VnGdZIAfsxGX2A4Styl41yxY6YhZFwHIPel9299tBkUrkLEJiN68NpTefiUc84oPBp Dvi7YAVa4afGw44WCtsyBAPi/R1AxIKMOIzlmZHuPAZFkIe21ZQQgumLaJ7OnCLXZNcg nmdRErpC6cdNXm/Nz7Il7MtklrC4SxUKl/bqh2IOwnsnjEGyKpCzXQ3QIHbImOQIpgiC 0mge07PpBSkekU9y8LHEFIENHBgIGSvnQrw+/wdiTH8S7JkJKm921MRvcp1E26Z+Ctde 6W1uFLE1q19ZNHmuU4v1nm8YW6Lz/f8j40tg8J5zhRGjLQPwdqXZgzumWGHf/eqHLuwQ WJ3Q== 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=Ob+JyjaA3mDDf+b8simoocWpP1x20nWcpANbzQ0uZBM=; b=LeWY3MUd6letBShLFk5WMQ8U5/TkVjEKYOZlrET5V7G0rR/67WuZgH4ofyetDwH6O1 I9tuWxWrtN34YGkZrBiNLwrksnxBttTeBV/YBpdmvcHvrPwI4EhOqYVuaFFjae2dMvDn 2G1+q3NpzYSy6Qkmq8b4Mt4tI/x9qYoKv5iGaVzTdsMPP+n20NRsnda3CV6pkYC7NkrF sOkLGHYmJTOaMtHDRqBU6vQ/lxZV7QhfOJAKEedVaXKvZgiNidkHN6xkivP9Xy3nzS/l daIWOffIJu4obzlBjpU+LKs8P/jvlPA0gxsKt/8dxOhjNM0PdwkRw7bocQaN5pGxhUwy 7eDg== X-Gm-Message-State: AOAM5310GEpubNJk9rgFWCjFnbLSAvt0OcI4mK+pTZP+2rQecaxenOmV q00GUQouokk1L0CDjz8nsFRpMHxX86Qr5g== X-Google-Smtp-Source: ABdhPJxLSRbv2litK+FWAe+1OX2naLbIYof4XMuW8fF/6YDQ9V+YhMu+HOKGNsMpkBkFV9VfJn5RQw== X-Received: by 2002:a17:902:e80c:b0:161:9b73:3908 with SMTP id u12-20020a170902e80c00b001619b733908mr24367791plg.54.1653338881549; Mon, 23 May 2022 13:48:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 17/18] target/arm: Add cur_el parameter to arm_generate_debug_exceptions Date: Mon, 23 May 2022 13:47:41 -0700 Message-Id: <20220523204742.740932-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653340043870100001 Content-Type: text/plain; charset="utf-8" We often have this value already handy in the caller. Signed-off-by: Richard Henderson --- target/arm/internals.h | 2 +- target/arm/debug_helper.c | 11 +++++------ target/arm/helper-a64.c | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index fbb69e6919..09d25612af 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1308,6 +1308,6 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu= ); =20 void aa32_max_features(ARMCPU *cpu); bool arm_singlestep_active(CPUARMState *env); -bool arm_generate_debug_exceptions(CPUARMState *env); +bool arm_generate_debug_exceptions(CPUARMState *env, int cur_el); =20 #endif diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 8d87b65a8d..a5363a5048 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -94,10 +94,8 @@ static bool aa32_generate_debug_exceptions(CPUARMState *= env, int cur_el) * CheckSoftwareStep(), where it is elided because both branches would * always return the same value. */ -bool arm_generate_debug_exceptions(CPUARMState *env) +bool arm_generate_debug_exceptions(CPUARMState *env, int cur_el) { - int cur_el =3D arm_current_el(env); - if (is_a64(env)) { return aa64_generate_debug_exceptions(env, cur_el); } else { @@ -111,9 +109,10 @@ bool arm_generate_debug_exceptions(CPUARMState *env) */ bool arm_singlestep_active(CPUARMState *env) { + int cur_el =3D arm_current_el(env); return extract32(env->cp15.mdscr_el1, 0, 1) && arm_el_is_aa64(env, arm_debug_target_el(env)) - && arm_generate_debug_exceptions(env); + && arm_generate_debug_exceptions(env, cur_el); } =20 /* Return true if the linked breakpoint entry lbn passes its checks */ @@ -309,7 +308,7 @@ static bool check_watchpoints(ARMCPU *cpu) * exceptions here then watchpoint firings are ignored. */ if (extract32(env->cp15.mdscr_el1, 15, 1) =3D=3D 0 - || !arm_generate_debug_exceptions(env)) { + || !arm_generate_debug_exceptions(env, arm_current_el(env))) { return false; } =20 @@ -333,7 +332,7 @@ bool arm_debug_check_breakpoint(CPUState *cs) * exceptions here then breakpoint firings are ignored. */ if (extract32(env->cp15.mdscr_el1, 15, 1) =3D=3D 0 - || !arm_generate_debug_exceptions(env)) { + || !arm_generate_debug_exceptions(env, arm_current_el(env))) { return false; } =20 diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 22db213aab..fe2a0aa261 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -924,7 +924,7 @@ void HELPER(exception_return)(CPUARMState *env, uint64_= t new_pc) * We check 1 here and 2 after we've done the pstate/cpsr write() to * transition to the EL we're going to. */ - if (arm_generate_debug_exceptions(env)) { + if (arm_generate_debug_exceptions(env, cur_el)) { spsr &=3D ~PSTATE_SS; } =20 --=20 2.34.1 From nobody Fri Apr 19 22:54:14 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1653340131; cv=none; d=zohomail.com; s=zohoarc; b=dBTVUGRCKzbxBLc9XA9ZM/5vIjIkT6vbHJ0l8Qg9aM904LcVkJI3X22ipaHyQ+FCcAUW35g8TC0zdNpEz9XZC1Yb7LmejMvsaZy8cEViiSntGMypGWE7rtWLK4HrZknXCtT0lzMmhMFHg0s/WdJC+AgEqteZUtHOpubSOETzd2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653340131; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WRIXhi2sPFQ8say7R+yvzgVuvHNeZiRuu0E48iydKNc=; b=hxQXHRd3f6KucMQ6GlKv0K7lIqynmeYv9dEXOWk8B0/ugXgSPPmVAwo9kfLf3KnksMc0dmj//H6BNtdUx4QBSEvBuVmLwH/eW0oFBCFZeGHXd9l8aofpgB0fIPKV3U0Yrdhs6lrkPgzMWHgvElweemI55lp0i/1GV7nJMlyOFsE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1653340131675235.4453225288171; Mon, 23 May 2022 14:08:51 -0700 (PDT) Received: from localhost ([::1]:37820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFII-0001YY-3L for importer2@patchew.org; Mon, 23 May 2022 17:08:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEyJ-0000Y4-Ro for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:11 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:36672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEyB-00055J-Qq for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:11 -0400 Received: by mail-pl1-x635.google.com with SMTP id m1so14134386plx.3 for ; Mon, 23 May 2022 13:48:03 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:48:02 -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=WRIXhi2sPFQ8say7R+yvzgVuvHNeZiRuu0E48iydKNc=; b=HoP9xXt9ns/Yk0SV5YLFE5ofm3YCZH0KWprZPNrv7GAxLZ2L3CZCjRoQhiSz1VeiQb qPqA3j/Dw6N4gGZMPy/Xlzr7ZKXYwYE+WKI3Ktrs/Wc4kH/ALyReQ/HQzHOj9WuefuNk nI5Pdd2ylB3QqIKLHb2ay+pdoS8mxU1Y2KgprJyJ3+0pBSmwjocWudckOkq1wrabmzDs PmO3foPGNjqPIHYzTqHX2gTdQaG/7nL0uK+1Zj0QR/BEkX3M8k9y4ymYgpz+9cQsoFcZ X0doRrxW0GEo8uhGO0dibsy2jNMNpeGtFQyXGuVpF4coVz9J3+csqIbzqUmtABPBB35B 6MDg== 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=WRIXhi2sPFQ8say7R+yvzgVuvHNeZiRuu0E48iydKNc=; b=NInIegEJJ8K57vgr9g72OpNE59xCUzG2umKyJfWBPwIPSvZm5rlZHdzcdA2vmc6QT7 Qx7oxZramzNmxcQb06aNYjtzKWpGzq7Rn/qnMxFa7Vsx1fsi/CK/rjm424x3pfuySjLQ t807rA4Y5KdF/1lsf004WWY5ubJcYaSaqEItwW7lfsSRjmp/tg+39qvQ4fYtPpG1kz3a 1bURKkfxwA3JtcUO21g/CsqdlNwOm/KpQiujoJe0wlHZkvRoGM4vxggNbfmTkKkdbr9Z BTENJxPUi4NmtnETBuJQ6m5p345hw6+5OH/HkIstRbT1h0p9S++t9DVythcUhZTgn6YY y6NQ== X-Gm-Message-State: AOAM531FqZMEqNJvh0NWmshbE1yiWIEw5DodHsDg+pR6flWra6Q5XcIs Dr1UXsQ4rMF3z8DwvY4klnUpUVltvRh4DA== X-Google-Smtp-Source: ABdhPJw8dZMAywnbAlJMva70+HtCsU9Jaxygh8m8CJhl9QOFYyj9TYkf82PD8r1m+Q3NYBi4NmjqCw== X-Received: by 2002:a17:903:310a:b0:162:3809:a002 with SMTP id w10-20020a170903310a00b001623809a002mr2398990plc.5.1653338882605; Mon, 23 May 2022 13:48:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 18/18] target/arm: Remove route_to_el2 case from sve_exception_el Date: Mon, 23 May 2022 13:47:42 -0700 Message-Id: <20220523204742.740932-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1653340132522100001 Content-Type: text/plain; charset="utf-8" This adjustment is handled by exception_target_el. Signed-off-by: Richard Henderson --- target/arm/helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 63c3fee5ff..5c875927cf 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6155,8 +6155,7 @@ int sve_exception_el(CPUARMState *env, int el) /* fall through */ case 0: case 2: - /* route_to_el2 */ - return hcr_el2 & HCR_TGE ? 2 : 1; + return 1; } =20 /* Check CPACR.FPEN. */ --=20 2.34.1