From patchwork Thu Aug 24 09:28:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 716529 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp1237321wrp; Thu, 24 Aug 2023 02:33:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGW0NOkOQbCkobuSbxTGc0osdV7OXfy9AX0r7iV+n2kPUwIiDSju1BEDJA9xT01mziPY+qX X-Received: by 2002:a0c:e3c4:0:b0:649:384f:ed9 with SMTP id e4-20020a0ce3c4000000b00649384f0ed9mr15492267qvl.32.1692869622094; Thu, 24 Aug 2023 02:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692869622; cv=none; d=google.com; s=arc-20160816; b=SmSSc9WW686+BhfKMnslh9Ot/zdtTwvB8tnHP3kSbYj3Y9YkJsyipnav5y7j8srHHw Ipm4cp1qTCIA8lNKr+Ancj20SO412H5sUqPjiZkdgDjJ4IeP/kQfSD10/uUdke2R/TMD 26Q/kcGWPiSDYT9PIWQBhg8JLQV15yHIeTDCjnRzME3a/uC1Bdaak/5zhj+2kFodPqEr yPM4cxG3kcft9hsRdxGHmeKYy3L2HVEvm+lGA3NCmjQgsBbz3amkV7SfmwNooH012vSm VLUvrdsXnb/+StgR8oJyaleLndzYaOQjCNmJuKLb4q3phT1mBCGrJ9uB7RD1a/cL/pMG T0OA== 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:to:from :dkim-signature; bh=skc8U+gA9LdRonLIVM9I21EP6Eo0baS5zBeu/So/Jqk=; fh=bFDrUYhlTVi/QyetgXx/byg2+yO/22Hp9SjwoefyKLk=; b=0fulYwJc/Ab81xFUrsde73CHAQ6gCCzm1o1JIq7Gb9g1tb7NQjbeWYFPrxT6um/iof 3utWcRTzkGoriUxqD9XkbkV/xM4aCrCRXhGEzJ5ij8bKwP6OGbfLwRDX1w6z6MsmLiSF FrORbI4Zq+f/mtOT5J0bKZoVaTm6P2SPw05CO19vvQLLd7nCWr5RPwXNsrXmywnXbdLs TEPhXCLDqJhiX6sgoyUZ4A9HbJVBC6wac98CajXQLT26wpKd074HP/eoBuCXEQul1Li8 adsa3QHIhur8hPf7nktTcwQIDl1crybD7eyuQoB4vdbNHTE3aEMxEUDZdnv97KvizHyi n7Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ws4YU8z9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a2-20020a0c8bc2000000b0063cee148361si3275588qvc.410.2023.08.24.02.33.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Aug 2023 02:33:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ws4YU8z9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZ6eU-0006ui-KI; Thu, 24 Aug 2023 05:29:18 -0400 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 1qZ6eA-00047u-Nw for qemu-devel@nongnu.org; Thu, 24 Aug 2023 05:28:59 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qZ6e3-00050c-Dc for qemu-devel@nongnu.org; Thu, 24 Aug 2023 05:28:58 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31c4d5bd69cso3589459f8f.3 for ; Thu, 24 Aug 2023 02:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692869327; x=1693474127; 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=skc8U+gA9LdRonLIVM9I21EP6Eo0baS5zBeu/So/Jqk=; b=ws4YU8z9Gw/SMOoc17b7bM+UoQmxi2TNckfOUIVJNs0UtCdpKjXD0TbDzsoOVNNHhu AJUNY71NER2ifcTsBUnpJZWUsJoo+P1CAC1Wl1pDLCufjWGGZlu7FCZPEAovigufCx6o Bhvw1Ga5yOJsDBaBF10XmqoG+1SwU6fPBC7346j8fw8QjRBIWokJEjMuOv9goEJ6iOHF z9UwXMlvXi9V7JBZ6J7NXzdnH6LkPWCWndrY+XTApjeeTyU1zD6kYJzjHOSpBzcuWSSw RPobQDF/I2uJbzw8NANCpfkpnYx2C9v10Qpy5LqpydX+l95CmgAfTm+hZbUyEZVoOzu5 Hhvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692869327; x=1693474127; 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=skc8U+gA9LdRonLIVM9I21EP6Eo0baS5zBeu/So/Jqk=; b=B19YEwNLms+GcNMzFHv6tNBhopXKiChef9inHp/UeS4vrNRCdXyrRySzFgNrcSAUN9 o6m9bsDMBpzzjADKxpFni6MeHwi6G1AoBbuUH6N88JjE94NYsA9JdJO3gOdyU89dcDxh /MBIQ0ey5dLHlFCfgB6MJhywRTVgmVSDt7FEXOlQGrhRJv06V6PgG1X8/9Y3l5NRzo2K UHh26koSjbvIoJ18VotUxD0baxye6j3dp8OGW8+X6RkkiS6l2p8MRhNWOsqihBxZLVFQ Ke3TEfiKa8EnIkJT+Izc6fKcRIdy27ld9dHGJ6uSy/+OYNew1bw24+VlJSy4J+EDPrrc ETZA== X-Gm-Message-State: AOJu0YxFjqpMUlRoqJs4+zOgsuWubD4BY0jBBkmsyPZgnv1LWGWWV8+T lKH9Zis5N9Gmpi2lQCaWDetMVBJJ0fH5vbb4U3o= X-Received: by 2002:a5d:45c6:0:b0:319:854a:9ea1 with SMTP id b6-20020a5d45c6000000b00319854a9ea1mr10702410wrs.15.1692869327481; Thu, 24 Aug 2023 02:28:47 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id s12-20020adfeccc000000b00317b5c8a4f1sm21844004wro.60.2023.08.24.02.28.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Aug 2023 02:28:47 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/35] target/arm: Pass an ARMSecuritySpace to arm_is_el2_enabled_secstate() Date: Thu, 24 Aug 2023 10:28:20 +0100 Message-Id: <20230824092836.2239644-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230824092836.2239644-1-peter.maydell@linaro.org> References: <20230824092836.2239644-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Pass an ARMSecuritySpace instead of a bool secure to arm_is_el2_enabled_secstate(). This doesn't change behaviour. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20230807141514.19075-8-peter.maydell@linaro.org --- target/arm/cpu.h | 13 ++++++++----- target/arm/helper.c | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index bcd65a63ca0..02bc8f0e8e0 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2504,17 +2504,19 @@ static inline bool arm_is_secure(CPUARMState *env) /* * Return true if the current security state has AArch64 EL2 or AArch32 Hyp. - * This corresponds to the pseudocode EL2Enabled() + * This corresponds to the pseudocode EL2Enabled(). */ -static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, bool secure) +static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, + ARMSecuritySpace space) { + assert(space != ARMSS_Root); return arm_feature(env, ARM_FEATURE_EL2) - && (!secure || (env->cp15.scr_el3 & SCR_EEL2)); + && (space != ARMSS_Secure || (env->cp15.scr_el3 & SCR_EEL2)); } static inline bool arm_is_el2_enabled(CPUARMState *env) { - return arm_is_el2_enabled_secstate(env, arm_is_secure_below_el3(env)); + return arm_is_el2_enabled_secstate(env, arm_security_space_below_el3(env)); } #else @@ -2538,7 +2540,8 @@ static inline bool arm_is_secure(CPUARMState *env) return false; } -static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, bool secure) +static inline bool arm_is_el2_enabled_secstate(CPUARMState *env, + ARMSecuritySpace space) { return false; } diff --git a/target/arm/helper.c b/target/arm/helper.c index 9862bc73b52..8290ca0aaad 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5778,7 +5778,7 @@ uint64_t arm_hcr_el2_eff_secstate(CPUARMState *env, ARMSecuritySpace space) assert(space != ARMSS_Root); - if (!arm_is_el2_enabled_secstate(env, arm_space_is_secure(space))) { + if (!arm_is_el2_enabled_secstate(env, space)) { /* * "This register has no effect if EL2 is not enabled in the * current Security state". This is ARMv8.4-SecEL2 speak for