From nobody Fri Dec 19 04:32:34 2025 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1678120456; cv=none; d=zohomail.com; s=zohoarc; b=EIfGiM7SYSI0gS1xPtp1CWlnnxYMPVTe96mYOGCtJ8ZTcxVU2KLNVlLwQk0COXHNjReGdZPGz1HgySYvoUJFD8eFl5iwXPZ3GL7pqSCfkiWpBKDcMqHQfhJUGg4/cLP+c7u4pj2PM0O2RhQrYtJlkY1a7L/Q/oc77p/vfJ9ukTk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678120456; h=Content-Type:Content-Transfer-Encoding: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=eHmyDubzG8vE68B58KfrFN1VX33V9Ex12FkKohFAAaY=; b=GlES2S41q62VbEwcxb5PzN+J9NsudFqbUSzmEqT4VrL3kHJjqGivvjJu9jfgkuo+REitJcUlS3zfEbs3k6V3/VRRIRItqgzgHBCL17wVAAlbYBbCjDMZi6lar8U3wUC3sk6fVIdvTAG/K7u5q3J3YniS74aFaVDmf+1htKC8zUU= 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+importer=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 1678120456856778.7250105636259; Mon, 6 Mar 2023 08:34:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZCrW-0004By-Ty; Mon, 06 Mar 2023 10:34:54 -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 1pZCrU-00046H-QP for qemu-devel@nongnu.org; Mon, 06 Mar 2023 10:34:52 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZCrT-00028L-9G for qemu-devel@nongnu.org; Mon, 06 Mar 2023 10:34:52 -0500 Received: by mail-wm1-x32f.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso5467969wmo.0 for ; Mon, 06 Mar 2023 07:34:50 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id v7-20020a05600c444700b003eb0d6f48f3sm15287432wmn.27.2023.03.06.07.34.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Mar 2023 07:34:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678116890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=eHmyDubzG8vE68B58KfrFN1VX33V9Ex12FkKohFAAaY=; b=OXxTZSsN+9Uq1p+GthgrpcYWolXQ8Uni5ioudhBRcG27bn7Y5ivdYOCa81dTuxhZZk erhRoQEcs91g2ZgsdAG+v+lSCbT1ISaZQD52UpAP/IVB4TFZpLz4pYA9USf8KHIvSNth UFmul2XzotIay2r4yuXMaAghABls9H5HCgHqvNKUrcxzP4RkOrGsLQLXa5Fg3Kn4Uecw ABnn7zZmEwcDlip17FIo9hYuq+SB7J0yiL12H5zVUpobS+/CM6B+s2P0fXqmIv/XH+71 cQJr8Swu1epwlSOqIX6w4K85sLeErwfvdnECVQp3MguG8OpjSJRy5XvDw7WTU63Ar/z1 BFGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678116890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eHmyDubzG8vE68B58KfrFN1VX33V9Ex12FkKohFAAaY=; b=VVL+Na7T60cJgzVYdZ4Y4gVV8TOHaPRhmF4Uvj3RI+gWX90jS/toCPFAuYyTLjRAb3 zXq2sq38Pq1a8jMa7PHNohLLp6RRe6tg2fne+PscP9ZVvKfBf3+P29EGh9Rwn/ovkh6Y PyEKyPFK8xAJdhYHBBAJD50EE2adVjfzbbA02Zp94YHWvOcAnE8Uqef4hoFcFumGrm8i PXm/2igiANAyFfHzz8gx4ve7bh/zZPi13KrJwTghJUP3D9WKBRd+0PUi+R9nnjIzOR7A VumTHkR/dM8wE0nxDbODDwHzvB7NvsvPNKW58pP2UWluEz8IqTT8D0yGJCQ6NZezFR1u +JAg== X-Gm-Message-State: AO0yUKU758Viw3oAHQNMHygPwee/Fv0c9v9yKfoMfdFlZ+55bPjNxdYt gsDLyK1g4rNue3Uj9ur01RVrPC6BXegMHKPtVd8= X-Google-Smtp-Source: AK7set/XqQFCpfnv4NFf3QAbySfAk2t9R40reFtXU8AKlzk51M+fRnx1lFEStrMJX/MRgB48yBNoIg== X-Received: by 2002:a1c:f714:0:b0:3dc:433a:e952 with SMTP id v20-20020a1cf714000000b003dc433ae952mr9368835wmh.33.1678116890580; Mon, 06 Mar 2023 07:34:50 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/21] target/arm: Diagnose incorrect usage of arm_is_secure subroutines Date: Mon, 6 Mar 2023 15:34:31 +0000 Message-Id: <20230306153435.490894-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230306153435.490894-1-peter.maydell@linaro.org> References: <20230306153435.490894-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1678120457831100007 From: Richard Henderson In several places we use arm_is_secure_below_el3 and arm_is_el3_or_mon separately from arm_is_secure. These functions make no sense for m-profile, and would indicate prior incorrect feature testing. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson Message-id: 20230227225832.816605-4-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index ab187012770..c097cae9882 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2384,7 +2384,8 @@ static inline int arm_feature(CPUARMState *env, int f= eature) void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp); =20 #if !defined(CONFIG_USER_ONLY) -/* Return true if exception levels below EL3 are in secure state, +/* + * Return true if exception levels below EL3 are in secure state, * or would be following an exception return to that level. * Unlike arm_is_secure() (which is always a question about the * _current_ state of the CPU) this doesn't care about the current @@ -2392,6 +2393,7 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **e= rrp); */ static inline bool arm_is_secure_below_el3(CPUARMState *env) { + assert(!arm_feature(env, ARM_FEATURE_M)); if (arm_feature(env, ARM_FEATURE_EL3)) { return !(env->cp15.scr_el3 & SCR_NS); } else { @@ -2405,6 +2407,7 @@ static inline bool arm_is_secure_below_el3(CPUARMStat= e *env) /* Return true if the CPU is AArch64 EL3 or AArch32 Mon */ static inline bool arm_is_el3_or_mon(CPUARMState *env) { + assert(!arm_feature(env, ARM_FEATURE_M)); if (arm_feature(env, ARM_FEATURE_EL3)) { if (is_a64(env) && extract32(env->pstate, 2, 2) =3D=3D 3) { /* CPU currently in AArch64 state and EL3 */ --=20 2.34.1