From patchwork Tue Dec 12 12:18:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 753056 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp1869662wrs; Tue, 12 Dec 2023 04:24:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWbWE5IvQTBEyy0RtfC4oMFZLVo9tsIL+rXLWIl0roeTJrRnqf35rp05AVmDtI7F9z4FAg X-Received: by 2002:ac8:5a43:0:b0:425:4043:50e9 with SMTP id o3-20020ac85a43000000b00425404350e9mr9229825qta.120.1702383881359; Tue, 12 Dec 2023 04:24:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702383881; cv=none; d=google.com; s=arc-20160816; b=hla9iC+6t5tBL3DdyvRdGfN3X+4c/LckZ2q0kvwdGtn2lc+oQ/rgeX8oV0/owjJTjJ IvhWOOaXwxR0sdjJomrO9WM0NkKzgc5J66hTZr3Gp7oE7ntJc2iezvo03F07J2VFgOgC c2K10ETKnwAwCJKy7asvVAxY8/xf1X3V2VONe/Fp8nSwYjto7/Ve76MeJFpXFycJ42hn omFm1O7PnvNwxH8B9HffTixYaqEy0gZy6jOms4aRHPF+4CQdNH1DzVn2p7UjAxsXQnVk JPOpWQzOMNVJNnoOplPuaibXt8P1YpnLxD7fxU9aqTHp27xf0DpMC5+JZzcPuDDcNKRT Gg0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=/O7FCHFF/caGJZYThJSsCwxdnGiVZBnov163QNjacEY=; fh=xJ1URYKcMN3TM0/XAv5v+aCN+5tIbzAdcfBx5UNgoLw=; b=e/5lnxZSLSyGkAvjo6V7oyWPJEQA/wfqlZT318siwSG2mR970UGXh1RHfhJkxJodn4 C+R5KRoJMdDOKtnztlhQQzgJvK29UVE4anu9NxDOmsa6A+KVmCVrg0zG3L5eg1V5viyL +i9axZD/NvLii4P0Rs9HE57S9Ck2RnzeJqcmEDQYT7fXWYZS6F8vuccqUPD4KUXB4Rrf pG+gCncBaQG/6PB622xjJ0CdNHAYt+7QuklKaxCBy/qHdFghsLkllHPwUaSlZwpvfk6o /ppKDsnEPDWDz+/hlaNLBxKf+/GTiikHDiwb0ULoeajAFQNWCZEn9y/ahhx9suSUX+5/ A3og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l4-20020ac84a84000000b00425826acab8si9898605qtq.469.2023.12.12.04.24.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2023 04:24:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rD1jx-00067i-7D; Tue, 12 Dec 2023 07:19:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rD1jv-00065Z-7f; Tue, 12 Dec 2023 07:19:55 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rD1jt-0000PP-D7; Tue, 12 Dec 2023 07:19:54 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id DC26F3AF03; Tue, 12 Dec 2023 15:18:49 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id A1EFF3B951; Tue, 12 Dec 2023 15:18:32 +0300 (MSK) Received: (nullmailer pid 1003444 invoked by uid 1000); Tue, 12 Dec 2023 12:18:31 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-8.1.4 15/31] target/arm: Set IL bit for pauth, SVE access, BTI trap syndromes Date: Tue, 12 Dec 2023 15:18:03 +0300 Message-Id: <20231212121831.1003318-15-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell The syndrome register value always has an IL field at bit 25, which is 0 for a trap on a 16 bit instruction, and 1 for a trap on a 32 bit instruction (or for exceptions which aren't traps on a known instruction, like PC alignment faults). This means that our syn_*() functions should always either take an is_16bit argument to determine whether to set the IL bit, or else unconditionally set it. We missed setting the IL bit for the syndrome for three kinds of trap: * an SVE access exception * a pointer authentication check failure * a BTI (branch target identification) check failure All of these traps are AArch64 only, and so the instruction causing the trap is always 64 bit. This means we can unconditionally set the IL bit in the syn_*() function. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20231120150121.3458408-1-peter.maydell@linaro.org Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell (cherry picked from commit 11a3c4a286d5dc603582ea0a1fca62c2ec0a1aee) Signed-off-by: Michael Tokarev diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 62254d0e51..63d0f37a1c 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -214,7 +214,7 @@ static inline uint32_t syn_simd_access_trap(int cv, int cond, bool is_16bit) static inline uint32_t syn_sve_access_trap(void) { - return EC_SVEACCESSTRAP << ARM_EL_EC_SHIFT; + return (EC_SVEACCESSTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL; } /* @@ -234,12 +234,12 @@ static inline uint32_t syn_smetrap(SMEExceptionType etype, bool is_16bit) static inline uint32_t syn_pactrap(void) { - return EC_PACTRAP << ARM_EL_EC_SHIFT; + return (EC_PACTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL; } static inline uint32_t syn_btitrap(int btype) { - return (EC_BTITRAP << ARM_EL_EC_SHIFT) | btype; + return (EC_BTITRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL | btype; } static inline uint32_t syn_bxjtrap(int cv, int cond, int rm)