From patchwork Tue Mar 5 16:50:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10839689 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 106AD180E for ; Tue, 5 Mar 2019 16:52:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F157A2CCAB for ; Tue, 5 Mar 2019 16:52:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFD602CCAE; Tue, 5 Mar 2019 16:52:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 86A6E2CCBA for ; Tue, 5 Mar 2019 16:52:39 +0000 (UTC) Received: from localhost ([127.0.0.1]:45742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1DJ0-0002m4-Px for patchwork-qemu-devel@patchwork.kernel.org; Tue, 05 Mar 2019 11:52:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1DHO-0001VG-Te for qemu-devel@nongnu.org; Tue, 05 Mar 2019 11:50:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1DHO-0000fS-1Y for qemu-devel@nongnu.org; Tue, 05 Mar 2019 11:50:58 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:35634) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1DHN-0000d8-Pl for qemu-devel@nongnu.org; Tue, 05 Mar 2019 11:50:57 -0500 Received: by mail-wm1-x330.google.com with SMTP id y15so3281726wma.0 for ; Tue, 05 Mar 2019 08:50:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=R0bJ16NhzI6cadc49jsaVQWgfkenQWAzMf4NJfNfRpY=; b=fR5qzyidtUmswLZ5w9tqEGbA1ZiH56iU2ygLgKvHEFAJgbnnUbgR9WjWVCw8ZIeTQ1 0CQesPJXqbpHzPzCTL8U0oygFt645TZenfGqMfSp92FEcYFSogUzPu0MogvKfE8GxR41 RCbdXoKxqbeM4pDMF4VdkW60JtxJNiW++IF64rBBTGR8bEreoZpszbNEPbAknPJRp8/H IcZQivtN1unI+U5BzSi0oDee/6BG6Lc0fTuNFAVtiIeMjSx+5TSbv7lpAAJ6X+SW8YK4 REMnc0qHhYe/yc0no8fW00kbS6IC13ePialv6Ta8VyUxVSe5lK7NwEBof7Q2LmSbYtm4 xwYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R0bJ16NhzI6cadc49jsaVQWgfkenQWAzMf4NJfNfRpY=; b=rWqHGDxIG0CvrWYx9eg3I+jnVbsYcUlN9WWXnCg78i2PLNnufMAqfPrzQDSGCRcSLH XJjUSAwE9Hfpd2bCc7+IfPPUku1y/pSobHRQNuxJ5grSY6//mkVtvmUtAoxiqentquIb wbFLIzu9lS7+SiLZXQXcCBtxTWCfM+t2t/09b0p25cWj3mkKdjLuHbHnXVXDMI5ae2Nj z2dZn1lxEEjJrEZTTjd0JQHFLvwHrJ8EMVa5s1VuTTCrGkS48scLxuM8VzUbIDPQPSBH rGTOGMXiCFz1F/EBkZ0jS1CM/QCatU2w16z9SA1zeTb3lJeDsbQtSnYLJY5rUkI7GOKg SXEw== X-Gm-Message-State: APjAAAW0xWhx2MeMwpaIVhIYjv+crew9qHGOD5RMJa5bCEpGp1H/Cv1s DRHd4rYnViGS6CFcOzCsPq0/9vOPQQ8= X-Google-Smtp-Source: APXvYqx6s4eipiPmEv9h0jugBVRuHFVkcxPbXa5Ae9Xlw/eKm6OrQulXiI7x2aGiP1hAFJYu7I3g3w== X-Received: by 2002:a1c:a98b:: with SMTP id s133mr3157202wme.129.1551804656501; Tue, 05 Mar 2019 08:50:56 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id 2sm10071495wrg.89.2019.03.05.08.50.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 08:50:55 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 5 Mar 2019 16:50:31 +0000 Message-Id: <20190305165051.26860-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190305165051.26860-1-peter.maydell@linaro.org> References: <20190305165051.26860-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PULL 02/22] target/arm: Split out arm_sctlr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Richard Henderson Minimize the number of places that will need updating when the virtual host extensions are added. Signed-off-by: Richard Henderson Message-id: 20190301200501.16533-2-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/cpu.h | 26 ++++++++++++++++---------- target/arm/helper.c | 8 ++------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 36cd365efaf..67b06bfad09 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3042,11 +3042,20 @@ static inline bool arm_sctlr_b(CPUARMState *env) (env->cp15.sctlr_el[1] & SCTLR_B) != 0; } +static inline uint64_t arm_sctlr(CPUARMState *env, int el) +{ + if (el == 0) { + /* FIXME: ARMv8.1-VHE S2 translation regime. */ + return env->cp15.sctlr_el[1]; + } else { + return env->cp15.sctlr_el[el]; + } +} + + /* Return true if the processor is in big-endian mode. */ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) { - int cur_el; - /* In 32bit endianness is determined by looking at CPSR's E bit */ if (!is_a64(env)) { return @@ -3065,15 +3074,12 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) arm_sctlr_b(env) || #endif ((env->uncached_cpsr & CPSR_E) ? 1 : 0); + } else { + int cur_el = arm_current_el(env); + uint64_t sctlr = arm_sctlr(env, cur_el); + + return (sctlr & (cur_el ? SCTLR_EE : SCTLR_E0E)) != 0; } - - cur_el = arm_current_el(env); - - if (cur_el == 0) { - return (env->cp15.sctlr_el[1] & SCTLR_E0E) != 0; - } - - return (env->cp15.sctlr_el[cur_el] & SCTLR_EE) != 0; } #include "exec/cpu-all.h" diff --git a/target/arm/helper.c b/target/arm/helper.c index 1fa282a7fc1..49ff79a146b 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12854,12 +12854,8 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags = FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len); } - if (current_el == 0) { - /* FIXME: ARMv8.1-VHE S2 translation regime. */ - sctlr = env->cp15.sctlr_el[1]; - } else { - sctlr = env->cp15.sctlr_el[current_el]; - } + sctlr = arm_sctlr(env, current_el); + if (cpu_isar_feature(aa64_pauth, cpu)) { /* * In order to save space in flags, we record only whether