From patchwork Wed Jan 11 20:19:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9511227 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 2CBD5606E1 for ; Wed, 11 Jan 2017 20:39:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D5E4285FD for ; Wed, 11 Jan 2017 20:39:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1234628655; Wed, 11 Jan 2017 20:39:30 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 AEF8F285FD for ; Wed, 11 Jan 2017 20:39:29 +0000 (UTC) Received: from localhost ([::1]:56938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRPg7-0000qZ-B1 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 11 Jan 2017 15:39:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRPO8-0006YR-NG for qemu-devel@nongnu.org; Wed, 11 Jan 2017 15:20:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRPO7-0000zq-Uv for qemu-devel@nongnu.org; Wed, 11 Jan 2017 15:20:52 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:36675) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cRPO7-0000zU-OP for qemu-devel@nongnu.org; Wed, 11 Jan 2017 15:20:51 -0500 Received: by mail-wm0-x241.google.com with SMTP id r126so554519wmr.3 for ; Wed, 11 Jan 2017 12:20:51 -0800 (PST) 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 :in-reply-to:references; bh=GyxFbBxm3DWtMmULtBmnFlX4brG3I27YHbwO8DPilcQ=; b=ElELaeE1+pDm3zaIeIU72W0RUeji4ht7OF5pamRCXe89Haxzn/cxgIhq0SbYyjOugt oaSuyHYQ8Et8xuq6v3xpSaup6ZRURLAeft9MfdrmuBSNP/n/2sPst79d5cHKhFjBT7nz 4Dfki1C+pp3qBvPjEO0Vi1Qw6xYrB3QJt4CCeuLsyW9ZaSCljFU+cMdSoYDG0aEO4zSB d5mkhqHGm5EI1VoDIhq4bLe40UkrT3iYxSynUu+EySCL+UZxbOfySoDCUQazR1S/eCaP NhyQNQRacfPo+GS5ODiQNiEjhCFUKLsvG9lDqODpcJVzOKrtHXqDWHhuSmhOqmQnkzSS nd8g== 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:in-reply-to:references; bh=GyxFbBxm3DWtMmULtBmnFlX4brG3I27YHbwO8DPilcQ=; b=oFpPPBWb5zmwF9jUeIc+rGAneHUUVDF5UnxEoz43gEHlMjLfwSI4pUuYj6bFrt3fTn 6ruDAmYVmP2f68EaRGXbBptkdaF+DjXD1WqUsvFmzxyOlBcHqilcwyc8j89JLsiW/ONn IoPltCamRoPbu2sk0E0Z3biMveGgykntznZ2XMrhD8E95WY9iJ7DkFAlS8KZZneZwc5r db4VT6FU4B1ArdzsmHuiNgdRapcvnXVHV4pV7Zb6lVj/njrVrGeEX+cwFjsx3US89XjK 45oNkdcWxBTgUv2/pHEEWb4NefhV679QSNtrgoG3SLnCmXkFCWkNGZ0n49Gr9UCOUgDU lVAg== X-Gm-Message-State: AIkVDXLH0L/s0vc3uY9A/73MIkJ9t4LQ+AhUZpcabSR451zh6ZkAd41cmvNxp1bHZeyGIw== X-Received: by 10.223.142.1 with SMTP id n1mr4829949wrb.185.1484166050745; Wed, 11 Jan 2017 12:20:50 -0800 (PST) Received: from localhost (x55b4b54a.dyn.telefonica.de. [85.180.181.74]) by smtp.gmail.com with ESMTPSA id g73sm10648851wme.16.2017.01.11.12.20.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 12:20:49 -0800 (PST) From: Artyom Tarasenko To: qemu-devel@nongnu.org Date: Wed, 11 Jan 2017 21:19:41 +0100 Message-Id: <6c5b3d85dcfabe9935687ecb986e80ce71f89cab.1484165352.git.atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PATCH v2 10/30] target-sparc: hypervisor mode takes over nucleus mode 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: Mark Cave-Ayland , Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Accordinf to UA2005, 9.3.3 "Address Space Identifiers", "In hyperprivileged mode, all instruction fetches and loads and stores with implicit ASIs use a physical address, regardless of the value of TL". Signed-off-by: Artyom Tarasenko --- target/sparc/cpu.h | 4 ++-- target/sparc/translate.c | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index 113ae33..4f709e1 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -716,10 +716,10 @@ static inline int cpu_mmu_index(CPUSPARCState *env, bool ifetch) ? (env->lsu & IMMU_E) == 0 || (env->pstate & PS_RED) != 0 : (env->lsu & DMMU_E) == 0) { return MMU_PHYS_IDX; - } else if (env->tl > 0) { - return MMU_NUCLEUS_IDX; } else if (cpu_hypervisor_mode(env)) { return MMU_HYPV_IDX; + } else if (env->tl > 0) { + return MMU_NUCLEUS_IDX; } else if (cpu_supervisor_mode(env)) { return MMU_KERNEL_IDX; } else { diff --git a/target/sparc/translate.c b/target/sparc/translate.c index b898898..82f9965 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2142,7 +2142,11 @@ static DisasASI get_asi(DisasContext *dc, int insn, TCGMemOp memop) case ASI_TWINX_NL: case ASI_NUCLEUS_QUAD_LDD: case ASI_NUCLEUS_QUAD_LDD_L: - mem_idx = MMU_NUCLEUS_IDX; + if (hypervisor(dc)) { + mem_idx = MMU_HYPV_IDX; + } else { + mem_idx = MMU_NUCLEUS_IDX; + } break; case ASI_AIUP: /* As if user primary */ case ASI_AIUPL: /* As if user primary LE */