From patchwork Fri Dec 7 10:36:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 153130 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp347564ljp; Fri, 7 Dec 2018 02:53:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/XffR2GzZ6+RY0/X6QatMb9qjoUQLtgQfhXHaG4iuHFZhxP7cYx7p96TiRq2KGrU73I4KCB X-Received: by 2002:a37:d10:: with SMTP id 16mr1336968qkn.39.1544180018358; Fri, 07 Dec 2018 02:53:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544180018; cv=none; d=google.com; s=arc-20160816; b=p0xaSBvL54gOvoqyZPYgELL4yjVG/zoStPLCFs3wkDyou7AXeLImHkNO0cQ66+xtdE 0cfVnjmcKtDNzMLgRJfYcE2imhgcHfNomctWykWab03qXDFzox7OIBNrX+cRJDQjrRnz 02M7NjwvdAYVrilCnmg6BePBBiOzu+vFXp10rTV8m3+LRdq8c4D0Kcs0/dVuDKmRRj0y e+G8qw5n8tulfFcpaCl3yGTCRIZh9bs0jxZTkl2W3BjdRFiG1/B1lLSyqQ/4cJqRfbnh xl+5cadzqMc7yMI3oVGwu/FxaEO27ddrjMGP9IZpNQWq6f2PZez6RwXYX7AfmqjayhQg 7qBA== 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=XvZTGTYjUe/CqE8goYOLGOvh/OEaS2UEgrpCkPuGHNk=; b=hAocMBxl1e6nT4Eu5WixMJ2f7pXTGxp7FEC0l/sH6Gavplg0P7sdIE6CFT88SDdVVx voXog9+JVB+oOkXpI77Wo2RZCZHDhug6gKSGL2FMLdbJSh+DCXHL8vpm3RA9JJN6BAUs nBr9KgP7RSAcxtBr+sqo5TBqlOLM+gldSbm012arzvTwhGgcg/iGihJFVdG9LIcTp7nD KH2BIriHiU17XeEKWoeGyg/DiVp4M9ySEfF2rhCRDcQjDv82kcgoek4hvbtdrosClVFV 3cfW8sIE+TS8BGN7buG3g0RGTZkSMpMRa/kFIxYOA7jS/OKEjObUCNFiExONgYrwzijy GZxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AZNsB+iB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id i17si1234283qte.298.2018.12.07.02.53.38 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 07 Dec 2018 02:53:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AZNsB+iB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:45335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVDlJ-0002mr-QM for patch@linaro.org; Fri, 07 Dec 2018 05:53:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVDVD-0008Bu-7N for qemu-devel@nongnu.org; Fri, 07 Dec 2018 05:37:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVDVC-0007kc-0c for qemu-devel@nongnu.org; Fri, 07 Dec 2018 05:36:59 -0500 Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]:46154) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gVDVB-0007ht-Qj for qemu-devel@nongnu.org; Fri, 07 Dec 2018 05:36:57 -0500 Received: by mail-ot1-x341.google.com with SMTP id w25so3309703otm.13 for ; Fri, 07 Dec 2018 02:36:57 -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=XvZTGTYjUe/CqE8goYOLGOvh/OEaS2UEgrpCkPuGHNk=; b=AZNsB+iBtTqQReyBoRZmZT1kvswobHBVscI1PbpxKdjp/gPSj1DjtFi5/03aGCewiU aOGOvuKCle72NTvgYSD1R5lT7vI+C2WuFASnMNh4If9e+oCTBK49Ky3LnLs3STgprCc+ 4jKeS0m1AHE4Zxkzszt9vjRasNQCyFScuaBpA= 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=XvZTGTYjUe/CqE8goYOLGOvh/OEaS2UEgrpCkPuGHNk=; b=AdoFc6+0ttAZ9mgMc5y55DO+7agL0oSSv2dRBzIAl5qAUY6EiGRMihT24KbVI8I8IA yXKzKH/cmq0eTMHwoUHGTpbbDjZWCBSfjJX+p2hhE9osiN5gYNkNFIKB8HHVphtEY+3z azRylQxPM8QMonIaq5c1QRvL39rVXuny39DhaHoQR33V5tu6/Kjx2NGFL90NyhEhiuR4 eFfK737nd3YGPPbr0K5nLrYx7Ed+n4w8VXZ28Zc6WQA++7ZzeknZZysmqfztMGdFUa2m NxE3rEPyG+BuJPpno14LnuMwc2X3sY739erZKC46/QPQSCuo15kQKQa/eWvCF9fN1eDU Pn9Q== X-Gm-Message-State: AA+aEWakFA/iwy1708uU9kNATUvlUSMfqa05GEkCiPy0MSqlIRnWkJnk mzpNhEDtq6RJ4CSu1pj+1OeKRQsZ318= X-Received: by 2002:a9d:1b0:: with SMTP id e45mr1182823ote.16.1544179016818; Fri, 07 Dec 2018 02:36:56 -0800 (PST) Received: from cloudburst.twiddle.net (172.189-204-159.bestel.com.mx. [189.204.159.172]) by smtp.gmail.com with ESMTPSA id c19sm2037594otl.16.2018.12.07.02.36.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Dec 2018 02:36:56 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 7 Dec 2018 04:36:19 -0600 Message-Id: <20181207103631.28193-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181207103631.28193-1-richard.henderson@linaro.org> References: <20181207103631.28193-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::341 Subject: [Qemu-devel] [PATCH 14/26] 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, ramana.radhakrishnan@arm.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This function is, or will shortly become, too big to inline. 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 Reviewed-by: Peter Maydell diff --git a/target/arm/cpu.h b/target/arm/cpu.h index f70eff8bcf..18f2378b87 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2731,54 +2731,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 158c550fab..eaa9e60e7b 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12959,6 +12959,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) {