From patchwork Wed Jan 18 22:38:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9524901 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 DF977601B7 for ; Wed, 18 Jan 2017 22:53:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2E1D2863D for ; Wed, 18 Jan 2017 22:53:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C62102863F; Wed, 18 Jan 2017 22:53:22 +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 7A9702863D for ; Wed, 18 Jan 2017 22:53:22 +0000 (UTC) Received: from localhost ([::1]:44844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTz6X-0000nv-F4 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Jan 2017 17:53:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTyt4-0006V8-Mu for qemu-devel@nongnu.org; Wed, 18 Jan 2017 17:39:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTyt4-0002gt-2L for qemu-devel@nongnu.org; Wed, 18 Jan 2017 17:39:26 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cTyt3-0002gM-SE for qemu-devel@nongnu.org; Wed, 18 Jan 2017 17:39:26 -0500 Received: by mail-wm0-x244.google.com with SMTP id r126so7538722wmr.3 for ; Wed, 18 Jan 2017 14:39:25 -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; bh=ZT0ULS4O34ZajmcGJ5ED7NMHHyv70PVQ5S4rGi4KVug=; b=uz5SkS5+zXjTqktLvm7Dzp0QQSgjSV4YHzzQsDo6qSc/JbLLNxH+7P3Gxg2omDR+RR 98lJfcHYkniLaP3tjHiEkgBopUkm83uCZd1K0yrsDCZ+ytF1xqI7UqHoDcKUEkQ3OtJ2 9pswFIslNiyVOwxb0H5nft+Dq29WHSDXr6GxNAM3hjDLpkaIhueDDqaTBoGJ0PL8aQXo mhA+Hci6M9NKersu8P7pWlDH6PezT86X/WAWCawYXx/CteesKNB0z28eZntF3KFcTMt5 D35ytTkmlwSfhU6lJGwQ/cFWLTrRp214OoWpd5yIaeZEEVxHljvW9cpoHkPOYn9p+Dz3 BOBw== 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=ZT0ULS4O34ZajmcGJ5ED7NMHHyv70PVQ5S4rGi4KVug=; b=rmKg4zbtfiC5cFO3p36ZG3w3qfGUk9nrF1ouu76JZrOpyBtg4UTQ1daACRgl3k3KFb YXMB7GxmivcySeRl3LkpQci5WNeC/FnALmKTAnbtn1QC9mq7clrc0zhYO9lQYLsCqP7Q c7+vmDJqFO/SNYgx+4OOirDdAX7/QrpI4RxSoFvT/29f5Qi3U4RR1AxV8L3mUYslPr0I h2j5H1wCskcpSZ8DySTdssZPQbo3w6aga3NVsNNdEGEiwVennYxg8MLITD70rbjSAcHH NasORP8QeAvwQt1AxSDxLWadtIlpQybVxMmMz3TBkCcJVRJtGbqrveHsHlNa/djDVXQ3 K7dw== X-Gm-Message-State: AIkVDXJ9REQDJ/cqnP0dlNMkaYktMKIpiXp/eY3IwtXkPl8qM36FjGePatgBABuME4lXLw== X-Received: by 10.28.172.5 with SMTP id v5mr4189613wme.41.1484779164856; Wed, 18 Jan 2017 14:39:24 -0800 (PST) Received: from localhost (x4e33e2b8.dyn.telefonica.de. [78.51.226.184]) by smtp.gmail.com with ESMTPSA id y145sm48362839wmc.17.2017.01.18.14.39.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2017 14:39:24 -0800 (PST) From: Artyom Tarasenko To: peter.maydell@linaro.org Date: Wed, 18 Jan 2017 23:38:23 +0100 Message-Id: <1484779123-18968-11-git-send-email-atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1484779123-18968-1-git-send-email-atar4qemu@gmail.com> References: <1484779123-18968-1-git-send-email-atar4qemu@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 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@ilande.co.uk, qemu-devel@nongnu.org, Artyom Tarasenko , rth@twiddle.net 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 9307b91..00fbb4e 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -719,10 +719,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 8902e44..009ea3a 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 */