From patchwork Fri Nov 4 20:50:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9413223 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 B3E2860573 for ; Fri, 4 Nov 2016 21:05:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5D1B2AF10 for ; Fri, 4 Nov 2016 21:05:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AD3E2AF6F; Fri, 4 Nov 2016 21:05: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 4CFF12AF10 for ; Fri, 4 Nov 2016 21:05:30 +0000 (UTC) Received: from localhost ([::1]:40774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2lg1-00044V-GF for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 Nov 2016 17:05:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2lSU-0000r2-8K for qemu-devel@nongnu.org; Fri, 04 Nov 2016 16:51:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2lSR-0003wz-6W for qemu-devel@nongnu.org; Fri, 04 Nov 2016 16:51:30 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35928) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c2lSR-0003w6-07 for qemu-devel@nongnu.org; Fri, 04 Nov 2016 16:51:27 -0400 Received: by mail-wm0-x242.google.com with SMTP id c17so5605773wmc.3 for ; Fri, 04 Nov 2016 13:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=C8mxtOZhNvHMxI16eUs0cJzSUlWKULymkU2jpa2qiLc=; b=Uk1yPQKa4bKVlYyAYjTTFUyLdR+yU82zjKJ7T+JVRpW+feRWvdlJI9Xef+Xj8VKGKz r5bQtUsW/0teEPStTyZrziuVL64vs9Qd29fqXdoCjganXzxtsifODEyixg7A3aC+AXYQ Tbzq/hAQcGbi3TcnW9xJMUhskR7+RVt2IfMX2COgK6ISDPmkpt67doEXDHuFpCKr2t9i 7fHx1qIIDrxBqde6V2YhAmzclwD6IsM3Y7/TwseqyFm4w7kiQ4os615fS0sK+qKCMvvG xUa2Y0ERrIorbg2UeUKYTPYttdQfDANKYl9RmxTwyPbrvizm1EVc0DSJVEOImSxhhpdi HWiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=C8mxtOZhNvHMxI16eUs0cJzSUlWKULymkU2jpa2qiLc=; b=V+/IXpuDN0gEEq9/MR/VUFXVu/V0WhduIxUeUxCNqa/4S8RE3aPBaQCzb3yXWtUCbM 82gr5hzwHKf0mSjBR2JXO4qztBCLSjmCrGvZG+fvqYSs3/uQRuo1YfG4NqgnqT64K8mq pxKOoPardE4QGV3dNvvcgaEarubKVF9MDu42dDt+Jly76NsMGJ1WFwf7iQPumk3I/Wx5 1d24/dWPxzaacRQYG3xB5k3W+F1T3oqMCMDyz85iHcA1SD8Vc+U0DDHqBuxH9/bq4rDg vC/mpOEfYwB2940c++WE1gdjae3gLb8Mb7V1JTRHsqMb3ixlrMyUcrmbP8rsdL2AOpES /OLg== X-Gm-Message-State: ABUngvdoIHBtYf3toBFqlsCWYo/YD2WACu0wGcQg1JsZOfSqXaPlFuASKOBx6M28jMTeXQ== X-Received: by 10.194.6.36 with SMTP id x4mr15912097wjx.175.1478292685923; Fri, 04 Nov 2016 13:51:25 -0700 (PDT) Received: from localhost (x55b4b5cf.dyn.telefonica.de. [85.180.181.207]) by smtp.gmail.com with ESMTPSA id a1sm16166358wjl.28.2016.11.04.13.51.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Nov 2016 13:51:25 -0700 (PDT) From: Artyom Tarasenko To: qemu-devel@nongnu.org Date: Fri, 4 Nov 2016 21:50:11 +0100 Message-Id: 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::242 Subject: [Qemu-devel] [PATCH v1 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 */