From patchwork Wed Oct 23 15:00:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 177321 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp909035ill; Wed, 23 Oct 2019 08:49:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUZiQK908IOAYGbQro0eGlLR416WQAKQ1+fDjdSRP1L720rWRZkZKQKGNEMjYy7brXxeY7 X-Received: by 2002:a37:b442:: with SMTP id d63mr9054727qkf.458.1571845783989; Wed, 23 Oct 2019 08:49:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571845783; cv=none; d=google.com; s=arc-20160816; b=qVGnQibcQVQHGZT7vhgYkZRPrV+XRXYygDwqVpiCGHXjUYfd3NBk9WR057gkqme+Qd +xvvrjkMLbfLoRMCHSaUJEsswPdYi0gNtpP+3opgT+hmR0Yzu4S5hvPd6tMxTIcQGsQ5 Gv9lvlMhcJZ+8fwi9nis9HjavqtDBnnaN6emYsd/ppb4QnHUE8T3X0LWFVjzzJeCqopN HzxGNYQgU7BMUUJtAd/B49u54ivSksvwHXX+DLlio2wXbYc8Mrd9xVGIO1eg8uuKj3a9 lRgY5kHBiVkd74jFnjU2yW31WFFt4t7FU1R6cYxP9LHyspXuCeyqLUAf4sTuHYRKsAeg ViCg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xWBixVJrplgoFEDYWsC1KvhyFbMO/zEb6ezvCN+GZN0=; b=lPmTJUfKZOa7Hg6zsNXqKrIHk1v6FEbYhAnJgsgS6g+Q8I2DEy5UU7Z6sDek0uWq4/ 5BFGlaFnwkkW1StvhOiSvg0HK0rKs5HRVYsAdsS724Nnh039jBdFozZpuqfYY15qeskx NviHRe+8mkyWKEAIK/xGEH3/j8e5H3d0TX5yKpVuPtpZwnGd3kCrG1YtqKk9AF8XoYBk jK4eMFpm+MUZxEq4PSuxm4eBj+0rUl1ZSPC045sOQZLgZY2QhO3uNQjrZXBczySmvAb7 GzzLxSZAPLUlRJGC1A9WcVsmtqtcFFmWOrzFypHD7H0tznx3OjFstETAESFjVWkp4a+1 tdVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ubohb+G+; 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 c185si18748557qkg.80.2019.10.23.08.49.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Oct 2019 08:49:43 -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=ubohb+G+; 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]:39970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNItK-0007qn-Mb for patch@linaro.org; Wed, 23 Oct 2019 11:49:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35252) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8u-00089K-B9 for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001G4-HJ for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:44 -0400 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]:39959) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-00017X-By for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qk1-x743.google.com with SMTP id y81so16142557qkb.7 for ; Wed, 23 Oct 2019 08:01:21 -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 :mime-version:content-transfer-encoding; bh=xWBixVJrplgoFEDYWsC1KvhyFbMO/zEb6ezvCN+GZN0=; b=ubohb+G+UrTjpIMomWpQ9Sa5nmzNxu1vYatVTsSKyMH1bdJ+VsGOuRhAFBp6IwZJuH MGcS9tTAerLZT8AXkq0eDQ+cm93ffExLqa3t/2PhgOJQ2kI24JigrTOR857+4+ZfRajZ MovB3vZMhCgfN2nk2Xg9nysn5DGTXolLJsDrj9HzSq5gYnKMlDLHi1W1KKD/ZeMPhgu8 X7gDQJwrWFSzHAO9OMDLwmhsqyt6ygUOyZZCryl+weZ2+HRggRCZmVO9ciuy+3zklBjz xTHVgP4zTsHL64ppddC/34xbQhqgXJsWBA0NuKw4RqNsCnoQNOslD0/qbALeQf/Vyz/Z 8aRA== 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:mime-version:content-transfer-encoding; bh=xWBixVJrplgoFEDYWsC1KvhyFbMO/zEb6ezvCN+GZN0=; b=H1dhMT5dOMZZarAiPrYvaMZPDnwQ3B9XyL3juZHPKAZTXpKT1yEdbLlB01t2LuNEGf QFSShnC5QAgMtda2fwu/fdzdcfM5Uk6JDsozEheiLW9kiILtvBoHxuUNWGrDXUMNLA8V zZSYG5h3vip2mMrgfYTkRReGHR7lDB0NxRzsnkW8bT37FevzciWmdQWya5azHq4lDdbV l0FZeDqGePIGOTEGz8BV5YE28gLrQsROCNYEW/rBB6VRXM7JOHmp7Og7naSAmZkq7ykK lYVPE0GQwoQo6roCsUy6Re+rV+eHpUuxPcKVWBmWcJd63cZQ8vmZJ2ho3++LfaCFkWI0 JS5A== X-Gm-Message-State: APjAAAXgtwOrJ01aBfAk9Tup3IOgJ35Hov5ro9AqzWqHU0qV016JdBGD otE4BpJ3v6N/J5OYS7Nr5YoJk5hXCmk= X-Received: by 2002:a05:620a:4f6:: with SMTP id b22mr8910127qkh.65.1571842879590; Wed, 23 Oct 2019 08:01:19 -0700 (PDT) Received: from localhost.localdomain (198-4-20-64.static.cosmoweb.net. [64.20.4.198]) by smtp.gmail.com with ESMTPSA id l189sm11030168qke.69.2019.10.23.08.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 13/24] target/arm: Split out arm_mmu_idx_el Date: Wed, 23 Oct 2019 11:00:46 -0400 Message-Id: <20191023150057.25731-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023150057.25731-1-richard.henderson@linaro.org> References: <20191023150057.25731-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::743 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Avoid calling arm_current_el() twice. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/internals.h | 9 +++++++++ target/arm/helper.c | 12 +++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) -- 2.17.1 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); +/** + * 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 85de96d071..3f7d3f257d 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11026,15 +11026,12 @@ ARMMMUIdx arm_v7m_mmu_idx_for_secstate(CPUARMState *env, bool secstate) } #endif -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); } - el = arm_current_el(env); if (el < 2 && arm_is_secure_below_el3(env)) { return ARMMMUIdx_S1SE0 + el; } else { @@ -11042,6 +11039,11 @@ ARMMMUIdx arm_mmu_idx(CPUARMState *env) } } +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)); @@ -11202,7 +11204,7 @@ static uint32_t rebuild_hflags_internal(CPUARMState *env) { int el = arm_current_el(env); int fp_el = fp_exception_el(env, el); - ARMMMUIdx mmu_idx = arm_mmu_idx(env); + ARMMMUIdx mmu_idx = arm_mmu_idx_el(env, el); if (is_a64(env)) { return rebuild_hflags_a64(env, el, fp_el, mmu_idx);