From patchwork Tue May 29 10:50:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 10435017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0A473603B5 for ; Tue, 29 May 2018 11:19:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC9B4286BF for ; Tue, 29 May 2018 11:19:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDDE9286E3; Tue, 29 May 2018 11:19:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, FSL_HELO_FAKE, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 601A4286BF for ; Tue, 29 May 2018 11:19:14 +0000 (UTC) Received: from localhost ([::1]:60242 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNcen-0006K3-JX for patchwork-qemu-devel@patchwork.kernel.org; Tue, 29 May 2018 07:19:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fNcDl-000223-Md for qemu-devel@nongnu.org; Tue, 29 May 2018 06:51:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fNcDk-0004Qg-Uw for qemu-devel@nongnu.org; Tue, 29 May 2018 06:51:17 -0400 Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]:38921) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fNcDk-0004Pu-PC for qemu-devel@nongnu.org; Tue, 29 May 2018 06:51:16 -0400 Received: by mail-wr0-x233.google.com with SMTP id w7-v6so12758932wrn.6 for ; Tue, 29 May 2018 03:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eMjuQcfsZnB++oUbJKAM1+OQHTUybkPf00CSKZtq8Dk=; b=IFHpdw58RAYKcm55TMRBs+q7z0ZJuDdyr0ES5Pq3UZVvxzRBMPqZWAk+OlCO3PAjmg ztwWiUQUaRlA/n+oenDtmP0201JIKo21s/0D3Yw8U/H1hsBg0NU/z45xqb9rW0bto27F Srx+JMxqSf2FOhs8GxWJGiU/3Uz/tW+KZ92xMTZVyMAZ44lITtiIo+/GdQHxMwbsf2wL WoVj9/UYWF/oKBzi4Lsj7j4MZfqi2w1ampDD/UBrAjBxrBvKoEiKpCIk1iWU1Nit+NyD q/vFLTkvlFr+2yQ1+/fzvmH5/LxTkBgdDPD9jFmIez9C9/V+gE991dSiUvirh8z+UMV0 H7BQ== 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=eMjuQcfsZnB++oUbJKAM1+OQHTUybkPf00CSKZtq8Dk=; b=TGw7bfgQZcmaQIiSF7hHgw2IWHS9wUWUTjoBDVoAa8iz/q4sQA1IXfvBQRg+sRLHWW 2bts75NyOpHr7EG8Y856WjeEW1pg0t/oifyphJGxpzQXloaJZqBRnf/J1bXyLALHuPtr LbHTl785v9iZ1Z0sM0rqX4LLS+r10ongM1D1eNq2OU60bkcbE9rOdITQ1W91qzpsEMYW sZA0wVeEpXdMudQa5j/HZYZpSxJf94icginHhSbViKsi/CRGS+2QzPAUmR3Pw2Jv6Qcz 04gdll/83suNek1XmvdSMHWlDjAH2YbSES2a+/w5r7/G3Nx48Em+Bf6GfjvBpMolzFBT NQPw== X-Gm-Message-State: ALKqPwc9wgpfjABXQx9fO+6Ip6FONB2tpOTPqfz3J0p/8qS8/RsPBJd5 rKLpUKWsAdwx6kd2W3uwyN4uyA== X-Google-Smtp-Source: ADUXVKJyNL1KY7IiD2rO1svLufitx7cWKJuWaX9Neg5AezXKoFBNSBTWvxKpaNzbijEKNs5BG+kyig== X-Received: by 2002:a19:f611:: with SMTP id x17-v6mr8788219lfe.116.1527591075469; Tue, 29 May 2018 03:51:15 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id r81-v6sm6299546lja.36.2018.05.29.03.51.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 May 2018 03:51:14 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Tue, 29 May 2018 12:50:11 +0200 Message-Id: <20180529105011.1914-39-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180529105011.1914-1-edgar.iglesias@gmail.com> References: <20180529105011.1914-1-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::233 Subject: [Qemu-devel] [PULL v1 38/38] target-microblaze: Consolidate MMU enabled checks 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: edgar.iglesias@xilinx.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Consolidate MMU enabled checks to cpu_mmu_index(). No functional changes. Suggested-by: Richard Henderson Reviewed-by: Alistair Francis Reviewed-by: Richard Henderson Signed-off-by: Edgar E. Iglesias --- target/microblaze/cpu.h | 4 +++- target/microblaze/helper.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index c77ca2d8f9..3c4e0ba80a 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -360,8 +360,10 @@ int cpu_mb_signal_handler(int host_signum, void *pinfo, static inline int cpu_mmu_index (CPUMBState *env, bool ifetch) { + MicroBlazeCPU *cpu = mb_env_get_cpu(env); + /* Are we in nommu mode?. */ - if (!(env->sregs[SR_MSR] & MSR_VM)) { + if (!(env->sregs[SR_MSR] & MSR_VM) || !cpu->cfg.use_mmu) { return MMU_NOMMU_IDX; } diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index 985bdae8d1..bc753793ec 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -58,8 +58,7 @@ int mb_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw, int prot; /* Translate if the MMU is available and enabled. */ - if (cpu->cfg.use_mmu && (env->sregs[SR_MSR] & MSR_VM) - && mmu_idx != MMU_NOMMU_IDX) { + if (mmu_idx != MMU_NOMMU_IDX) { uint32_t vaddr, paddr; struct microblaze_mmu_lookup lu; @@ -270,9 +269,10 @@ hwaddr mb_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) CPUMBState *env = &cpu->env; target_ulong vaddr, paddr = 0; struct microblaze_mmu_lookup lu; + int mmu_idx = cpu_mmu_index(env, false); unsigned int hit; - if (env->sregs[SR_MSR] & MSR_VM) { + if (mmu_idx != MMU_NOMMU_IDX) { hit = mmu_translate(&env->mmu, &lu, addr, 0, 0); if (hit) { vaddr = addr & TARGET_PAGE_MASK;