From nobody Tue Feb 10 07:22:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1566336461; cv=none; d=zoho.com; s=zohoarc; b=A+DAN+32WvmSHvHxnCruLqZyX+GtQkP4CbZHeXyLAuS5qqCP4uRa8JrminGf2sqkdZ/qvA/0R/YRSygh4mlpEESvsBqO2GuR9y2t3hO8iD6aHIJ6Vg2KpSbjEl5+tiQAphyGMYV4Kh9Flfub2kt+ao36rUaMg9ytpcyzMJSk8ME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566336461; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=nSUrF1uk3AduHW47FcRxNvtOuMuTx2/7SA2elwSehDg=; b=jfhPVux7VvREZ+Le1ZH+G55j4mZF5HSbj1+bTjhxBgoa5kavQ9suMFgsSMPpkXC5Guttyx4CpZHO28KC7piu7P6h5D0HXZJArknkgj5t8GMJIZrnKhQETVVqjOP7AzUvPhl8TLLNTVx9SnlkEgZ8WxfNoMhl1hsK7r4pz/waPkA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566336461880298.0115733406594; Tue, 20 Aug 2019 14:27:41 -0700 (PDT) Received: from localhost ([::1]:41936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0BfI-0000ON-7O for importer@patchew.org; Tue, 20 Aug 2019 17:27:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53899) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0BM0-0000JN-Ko for qemu-devel@nongnu.org; Tue, 20 Aug 2019 17:07:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0BLz-00009r-8U for qemu-devel@nongnu.org; Tue, 20 Aug 2019 17:07:44 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:33044) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i0BLz-00006w-1f for qemu-devel@nongnu.org; Tue, 20 Aug 2019 17:07:43 -0400 Received: by mail-pl1-x644.google.com with SMTP id go14so102403plb.0 for ; Tue, 20 Aug 2019 14:07:41 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id k22sm21690743pfk.157.2019.08.20.14.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 14:07:39 -0700 (PDT) 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=nSUrF1uk3AduHW47FcRxNvtOuMuTx2/7SA2elwSehDg=; b=dTNR3oOr2NCBTwzIGc5R3Mdlzd4W9hzQ87v9G5kYcaGHqMVco+8liB/2+EAgpmBhyB 6yorMPpZ8qF/8JbQ+jfn4zX0pHVof6G+HmrlgZNim+qbw0Aotp/nhcbu+6PLxbP6K2n9 zYFFNSlVQdzn5Yu2uZKZqrIWNs3H2Z2KisD7dQtTE7G2YSwNQVpSgBliI97dXhNWRG90 7j1dmL5slesU/eHbO3Ddu2jFPdqTqwoK3y1/B9YOlB/TU9F2JcuUwy7URET6K6ZcPET7 ffd/NddUYcCEjisNLIUZbw4mX6jcFe3qK/hQND8S5kvQReznHxDvyOP98Z6YEYLLpDGw sZgA== 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=nSUrF1uk3AduHW47FcRxNvtOuMuTx2/7SA2elwSehDg=; b=MD9hrxswy234v4847ChPhomm/NeTNQpdYUNOlBmlOoHD000G/MiM3CEHYIBrIJ6Xjd Az+iqy7gtybSGOaMOBznbhyv+upS5l04mR6w0Ojbsv/vIVrafED6oWRZ1CHza+66cdz8 0Z6c6zAJzjbuEIFsRgg3oXzrcfg2c3nVRHbZx5piaKVSeMl9/6RcRJyqCwz+rdqHOhVi wtsnKKg3DxPjhJSyPWrVg5JMPeI/Eod9Z7h6FpD8A+DWTFH54UZrJFQ/8HgbaAGdrrEq tUwbhdnsW239OILF0MJA33lF1UW+O6WsN8E/wfzYj1gj+xXZaa14CJatZnom1iC/B65o e9MQ== X-Gm-Message-State: APjAAAVnerMH2RC3zsKbo5nxO1TefIuxATzeBf2stYJxFK0pN+pBpdWR VGRxENc41M2NAVmb6/hdwUeXLYWavdk= X-Google-Smtp-Source: APXvYqxsYqa/tnph9n25tHakulMESvEBPTR+rhwNUkuH69Yg3xOoyqchQN7KIPQdq+8y5AQtxAC1hA== X-Received: by 2002:a17:902:5a04:: with SMTP id q4mr30699862pli.280.1566335259913; Tue, 20 Aug 2019 14:07:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 20 Aug 2019 14:07:16 -0700 Message-Id: <20190820210720.18976-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190820210720.18976-1-richard.henderson@linaro.org> References: <20190820210720.18976-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::644 Subject: [Qemu-devel] [PATCH v5 13/17] target/arm: Split out arm_mmu_idx_el X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Avoid calling arm_current_el() twice. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/internals.h | 9 +++++++++ target/arm/helper.c | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 232d963875..f5313dd3d4 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -949,6 +949,15 @@ void arm_cpu_update_virq(ARMCPU *cpu); */ void arm_cpu_update_vfiq(ARMCPU *cpu); =20 +/** + * arm_mmu_idx_el: + * @env: The cpu environment + * @el: The EL to use. + * + * Return the full ARMMMUIdx for the translation regime for EL. + */ +ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el); + /** * arm_mmu_idx: * @env: The cpu environment diff --git a/target/arm/helper.c b/target/arm/helper.c index 83ae33dae5..19bdb9b9d6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10988,15 +10988,12 @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMStat= e *env, bool secstate) } #endif =20 -ARMMMUIdx arm_mmu_idx(CPUARMState *env) +ARMMMUIdx arm_mmu_idx_el(CPUARMState *env, int el) { - int el; - if (arm_feature(env, ARM_FEATURE_M)) { return arm_v7m_mmu_idx_for_secstate(env, env->v7m.secure); } =20 - el =3D arm_current_el(env); if (el < 2 && arm_is_secure_below_el3(env)) { return ARMMMUIdx_S1SE0 + el; } else { @@ -11004,6 +11001,11 @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env) } } =20 +ARMMMUIdx arm_mmu_idx(CPUARMState *env) +{ + return arm_mmu_idx_el(env, arm_current_el(env)); +} + int cpu_mmu_index(CPUARMState *env, bool ifetch) { return arm_to_core_mmu_idx(arm_mmu_idx(env)); @@ -11164,7 +11166,7 @@ static uint32_t rebuild_hflags_internal(CPUARMState= *env) { int el =3D arm_current_el(env); int fp_el =3D fp_exception_el(env, el); - ARMMMUIdx mmu_idx =3D arm_mmu_idx(env); + ARMMMUIdx mmu_idx =3D arm_mmu_idx_el(env, el); =20 if (is_a64(env)) { return rebuild_hflags_a64(env, el, fp_el, mmu_idx); --=20 2.17.1