From patchwork Tue Jan 8 22:31:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 155029 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp44180jaa; Tue, 8 Jan 2019 14:50:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN4isjb4C+eKysqSzcscn68UD6hX/yDiKQVhplomdwtGzI38FD+DumNdCxXp6lCXMHFwwGm/ X-Received: by 2002:adf:90e5:: with SMTP id i92mr2676785wri.210.1546987817451; Tue, 08 Jan 2019 14:50:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546987817; cv=none; d=google.com; s=arc-20160816; b=EFWCNVafjY0oFSjvY3f0f0zxO5KQH+DOLsHhdPf0I8pnHEu67Up0sIJ2kOMxPDh38R 3QmW8YchONEgg4OYvrBglBKQ/NhNtNsBa1xMYC/l4O0UmB0ROe1gkRsYQ1ERFNWOw1vR tV+0VuIDYizIm+zcW8zt1/zRtboMxmozo89TtMs7gxRqH3BvNCo+wOG9SoBgC+qFWcM5 8PZSlGF6UQnBhexK6/f2492aw+4+06eq5Gesr5oy6TQxrHrXKcSgTP7qTIzwzG6Ffz8P qu6Y4iw9FH1GBowtCGJ8gdQIC9leaHmXo6A3ZZ+D5Y7OZvJoFy3bIwOe/YGZcKGCdXoA yrwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=NXvQI4SDFPXeWp0pGzcoDK8YDYSgU/rnRAlnBVBgc8Q=; b=ne47LC9AhPmiqI+z3lrTCwM294EK56CIBwKFbQCjistmO3/b2fL11WX1P48mv3lQ0Q i7l3xwmGZBSmkYTcew7h77V6B4xFwvrPFoNErYrHfoP6yaiYzegO7w7zKzv/n6V48tm4 W9fpV1pdLollodYJEgZhIHnQ4Mds8D9nnDWZ/TZW72S0EfLdkepzlpzbAmyvpkkGiF0Q JRHzH9ejgJurX416+HF8ObU5HFPnqYEaGdb0LxXjaZK79tBktC9rWtzIKnlji6EFL7iE JY0Nu5u1MCG8cPXgnptQrlktseg4QNetT70TAq1LXM/NDZTYrPCyxli9gUErreCu4Qkk YTwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kV6+cR9q; 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=fail (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 f3si7419556wmg.129.2019.01.08.14.50.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 08 Jan 2019 14:50:17 -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; dkim=fail header.i=@linaro.org header.s=google header.b=kV6+cR9q; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:44055 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gh0CO-000844-68 for patch@linaro.org; Tue, 08 Jan 2019 17:50:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggzv7-0000Ch-AI for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:32:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggzv5-0004mk-8d for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:32:25 -0500 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:45110) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggzv4-0004fC-KU for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:32:22 -0500 Received: by mail-pf1-x443.google.com with SMTP id g62so2595014pfd.12 for ; Tue, 08 Jan 2019 14:32:16 -0800 (PST) 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; bh=NXvQI4SDFPXeWp0pGzcoDK8YDYSgU/rnRAlnBVBgc8Q=; b=kV6+cR9qojlCr2T+0XAYE0jTKLirEQLs5q+HbezOpDejbDOUjRQTVezJOXzOe3ZPkN BU5LiLQdheF9LYpDjb4iHyVBiOy5LePjJdMXklfBPdQ8xbU1TXElSQakQ9kTKEf7O8jD 3pVgQVOb+ylk600op1wfspah5k+0rWlqNFe2M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NXvQI4SDFPXeWp0pGzcoDK8YDYSgU/rnRAlnBVBgc8Q=; b=R4O+6CoNZY3HHGeb+WxLxMTnXylU5+wVmB4e+7wBPVO+lMFH5jgkTwNb5FjnPdK/S1 GRpGs2vHikFxgnzU0Zutazyr2xd3+VQRe7aYEq0v5e1qRHBfdTBv79Vn5OQmF1Tjq+3e 9l1O2PjRf4WDKyqlK30NUX0mQ3iRs8D8PlTLhlYHNI8Gz//hK2l7E2RbOyVrYNxDpP4U iPICgCSHQ+kGkSHhGGslTzCPUar308WgyhrCOpd0IpFQDxcpiEnvUW+nJfgVQbyx1ZLv lSzEKUjULG2uj71rtYbrj5Vaefvd4Nq30I9DQYvItsEJ9HVgGmzoBLAKBO/FckZZF0MJ hDjQ== X-Gm-Message-State: AJcUukegq5BlR60Bz2jBgGTZzZsFxLHq5hQhz2XTlhReR5qAsv6VTOcl jsZILFdL7GPE0M4jFv4mfXhX0ziZNVg= X-Received: by 2002:a62:d448:: with SMTP id u8mr3517798pfl.105.1546986735578; Tue, 08 Jan 2019 14:32:15 -0800 (PST) Received: from cloudburst.lan (2001-44b8-2176-c800-8cc6-2630-7d99-5ef1.static.ipv6.internode.on.net. [2001:44b8:2176:c800:8cc6:2630:7d99:5ef1]) by smtp.gmail.com with ESMTPSA id w128sm100686177pfw.79.2019.01.08.14.32.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Jan 2019 14:32:14 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 9 Jan 2019 08:31:13 +1000 Message-Id: <20190108223129.5570-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190108223129.5570-1-richard.henderson@linaro.org> References: <20190108223129.5570-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v3 15/31] target/arm: Move cpu_mmu_index out of line 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: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This function is, or will shortly become, too big to inline. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h | 48 +++++---------------------------------------- target/arm/helper.c | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 43 deletions(-) -- 2.17.2 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 9ad7b2d11e..eb83a71b67 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2741,54 +2741,16 @@ static inline int arm_mmu_idx_to_el(ARMMMUIdx mmu_idx) } /* Return the MMU index for a v7M CPU in the specified security and - * privilege state + * privilege state. */ -static inline ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, - bool secstate, - bool priv) -{ - ARMMMUIdx mmu_idx = ARM_MMU_IDX_M; - - if (priv) { - mmu_idx |= ARM_MMU_IDX_M_PRIV; - } - - if (armv7m_nvic_neg_prio_requested(env->nvic, secstate)) { - mmu_idx |= ARM_MMU_IDX_M_NEGPRI; - } - - if (secstate) { - mmu_idx |= ARM_MMU_IDX_M_S; - } - - return mmu_idx; -} +ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, + bool secstate, bool priv); /* Return the MMU index for a v7M CPU in the specified security state */ -static inline ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, - bool secstate) -{ - bool priv = arm_current_el(env) != 0; - - return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv); -} +ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate); /* Determine the current mmu_idx to use for normal loads/stores */ -static inline int cpu_mmu_index(CPUARMState *env, bool ifetch) -{ - int el = arm_current_el(env); - - if (arm_feature(env, ARM_FEATURE_M)) { - ARMMMUIdx mmu_idx = arm_v7m_mmu_idx_for_secstate(env, env->v7m.secure); - - return arm_to_core_mmu_idx(mmu_idx); - } - - if (el < 2 && arm_is_secure_below_el3(env)) { - return arm_to_core_mmu_idx(ARMMMUIdx_S1SE0 + el); - } - return el; -} +int cpu_mmu_index(CPUARMState *env, bool ifetch); /* Indexes used when registering address spaces with cpu_address_space_init */ typedef enum ARMASIdx { diff --git a/target/arm/helper.c b/target/arm/helper.c index f23555b1dc..56d0b60b74 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12949,6 +12949,50 @@ int fp_exception_el(CPUARMState *env, int cur_el) return 0; } +ARMMMUIdx arm_v7m_mmu_idx_for_secstate_and_priv(CPUARMState *env, + bool secstate, bool priv) +{ + ARMMMUIdx mmu_idx = ARM_MMU_IDX_M; + + if (priv) { + mmu_idx |= ARM_MMU_IDX_M_PRIV; + } + + if (armv7m_nvic_neg_prio_requested(env->nvic, secstate)) { + mmu_idx |= ARM_MMU_IDX_M_NEGPRI; + } + + if (secstate) { + mmu_idx |= ARM_MMU_IDX_M_S; + } + + return mmu_idx; +} + +/* Return the MMU index for a v7M CPU in the specified security state */ +ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) +{ + bool priv = arm_current_el(env) != 0; + + return arm_v7m_mmu_idx_for_secstate_and_priv(env, secstate, priv); +} + +int cpu_mmu_index(CPUARMState *env, bool ifetch) +{ + int el = arm_current_el(env); + + if (arm_feature(env, ARM_FEATURE_M)) { + ARMMMUIdx mmu_idx = arm_v7m_mmu_idx_for_secstate(env, env->v7m.secure); + + return arm_to_core_mmu_idx(mmu_idx); + } + + if (el < 2 && arm_is_secure_below_el3(env)) { + return arm_to_core_mmu_idx(ARMMMUIdx_S1SE0 + el); + } + return el; +} + void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) {