From patchwork Tue Jan 8 22:31:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 155030 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp44268jaa; Tue, 8 Jan 2019 14:50:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN6c+oH95YujtP6wiGtLsmX5yTPUROJDtCH7PS34WVOqsVYIqB3uFUnybFHdVJAzLjIXE65T X-Received: by 2002:a1c:cc2:: with SMTP id 185mr3309625wmm.1.1546987823808; Tue, 08 Jan 2019 14:50:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546987823; cv=none; d=google.com; s=arc-20160816; b=PQPEFqPK84cvcd9oL3dS+7GxFRJAjO+hi4wBYnUEUIqVsmprNRx2y4sFADjhjSZJpE eACaGlMR01Zr5NEJ1yCEH+jj8SKMaFjHjLc5Vk1PTYEHtP+Q1PSeknQqhpv774sFDKjK bf2Q8baHY05zJ49Rg5FjZRFMBShUbewsY/sO3ZE2R5ZZqa4NZx9c/9prGMwpfwIfWHR2 fnWxSGOkzkK0ifh89fpBgR5pgw7bMLNOmTqBL5Hs5JuV27PbABphO+97UiFr549LsliU W6rMxuF7NsaMn6Euipw1ssJH9IclUa3DJmiLR1OfP2EDEbvRpMtS6Wjo9d6RFTRjw33z ckgA== 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=XTiEnwJBlAE8O18axOe03GoQvcEB4gWvYODIP3nVaNY=; b=hRAdM30qXkAHAm1XqLIMMNQ3Q868YPMvAYxH8fztmWQBYBErJQnOcH8BIguG4wB/gf STqZ4z8eaFAQY93y8KklTPbuWLt0z9iB0pymSt397JU9NvSiAX2v0XxWd3qLbHt0w8NP 2z2YYTiLdKinZ2Z3HTDjEBdIZfy38G3syt9iNM9WT6rh9ZKGUYuR/I0qrjE9UDt0y5CM 1u8o5z+nb6AWXMmxjX1m6/LPQwnOJLZgAEcCyPln2VMGz/O+EzwKONp6uggd2o2sp0uO xZqiIW6vfiPbns7Yl3uRaYuiF/LFSbHgeUzCllyt1j2pG3D6zpWiYaFe/WHnQEie4sJt lYcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Veg11HCz; 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 t17si1568892wrr.69.2019.01.08.14.50.23 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 08 Jan 2019 14:50:23 -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=Veg11HCz; 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]:44087 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gh0CU-0008B8-Mx for patch@linaro.org; Tue, 08 Jan 2019 17:50:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggzv7-0000Cf-AA 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-0004n8-Ct 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]:45111) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggzv5-0004k2-79 for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:32:23 -0500 Received: by mail-pf1-x443.google.com with SMTP id g62so2595122pfd.12 for ; Tue, 08 Jan 2019 14:32:21 -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=XTiEnwJBlAE8O18axOe03GoQvcEB4gWvYODIP3nVaNY=; b=Veg11HCzEW8WRI1bc6Eik6grAS9diAQeqn5EJ4aHSs2CedP4Zen95Mg3+0j3dVcjIL OFh0etmeU3Y6u9V/WsfNJYYLS4YRuWLaWNCHWSrvh6+Zxyc79z8iqz9G5PP+VOvAE/pM /qt4n1eQkXlsJgBSJ8lggMfkwdly8mbpeJdrg= 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=XTiEnwJBlAE8O18axOe03GoQvcEB4gWvYODIP3nVaNY=; b=LSV095JshuezQPGycQRC1Ia8Tf1YkQxx0Tjjyx8JeVka2U73UAL1nygBRPb/ZQSv7d mvu1TVEg+IUr7cXf4xBq6ECOSV0spBPr4fhq2yNUW3t1Wd6erNkFOjveBda0nIgaKWQs AjAdMvPUk09dksw4aYlt8lYHIJCNDWvtXSSNTlqx+EPsJnkXjHGvZX5Kf9Lj4GdXEafI ro8+Ht1tjlr5IV+asEgY6xavxO1Gbr/90SxilJ+QOvHsJLjZRCdLw8pQGYgsatxwsuMo dxuQ4TVBM/YxjIKj3hLMsTJLxeQZuGf2K6n/SZ82DXkt6B/8BFz86aPDR5HEmOwhlhbb 2X5Q== X-Gm-Message-State: AJcUukeK9dAoPmq+EYaZaFetX/lkJWEkD94Rig2xOS9+/xdzi7D9K5oi l3CsD+O8scOB2g9QJ3dBmNFzzIzq4J0= X-Received: by 2002:a63:1013:: with SMTP id f19mr3194300pgl.38.1546986740656; Tue, 08 Jan 2019 14:32:20 -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.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Jan 2019 14:32:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 9 Jan 2019 08:31:15 +1000 Message-Id: <20190108223129.5570-18-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 17/31] target/arm: Introduce arm_stage1_mmu_idx 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" While we could expose stage_1_mmu_idx, the combination is probably going to be more useful. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/internals.h | 15 +++++++++++++++ target/arm/helper.c | 7 +++++++ 2 files changed, 22 insertions(+) -- 2.17.2 diff --git a/target/arm/internals.h b/target/arm/internals.h index 89f3b122a4..248fdf7a3c 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -927,4 +927,19 @@ void arm_cpu_update_vfiq(ARMCPU *cpu); */ ARMMMUIdx arm_mmu_idx(CPUARMState *env); +/** + * arm_stage1_mmu_idx: + * @env: The cpu environment + * + * Return the ARMMMUIdx for the stage1 traversal for the current regime. + */ +#ifdef CONFIG_USER_ONLY +static inline ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env) +{ + return ARMMMUIdx_S1NSE0; +} +#else +ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env); +#endif + #endif diff --git a/target/arm/helper.c b/target/arm/helper.c index ba6733c4f1..4af8abd18f 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12998,6 +12998,13 @@ int cpu_mmu_index(CPUARMState *env, bool ifetch) return arm_to_core_mmu_idx(arm_mmu_idx(env)); } +#ifndef CONFIG_USER_ONLY +ARMMMUIdx arm_stage1_mmu_idx(CPUARMState *env) +{ + return stage_1_mmu_idx(arm_mmu_idx(env)); +} +#endif + void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) {