From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqHCa-0006Gq-79 for qemu-devel@nongnu.org; Sat, 01 Oct 2016 06:07:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqHCY-0007j6-4R for qemu-devel@nongnu.org; Sat, 01 Oct 2016 06:07:27 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqHCX-0007iw-TM for qemu-devel@nongnu.org; Sat, 01 Oct 2016 06:07:26 -0400 Received: by mail-wm0-x243.google.com with SMTP id f193so2153422wmg.2 for ; Sat, 01 Oct 2016 03:07:25 -0700 (PDT) From: Artyom Tarasenko Date: Sat, 1 Oct 2016 12:05:18 +0200 Message-Id: <1475316333-9776-15-git-send-email-atar4qemu@gmail.com> In-Reply-To: <1475316333-9776-1-git-send-email-atar4qemu@gmail.com> References: <1475316333-9776-1-git-send-email-atar4qemu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 14/29] target-sparc: use direct address translation in hyperprivileged mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Richard Henderson , Mark Cave-Ayland , Artyom Tarasenko Implement translation behavior described in the chapter 13.7 of "UltraSPARC T1™ Supplement to the UltraSPARC Architecture 2005". Please note that QEMU doesn't impelement Real->Physical address translation. The "Real Address" is always the "Physical Address". Signed-off-by: Artyom Tarasenko --- target-sparc/mmu_helper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target-sparc/mmu_helper.c b/target-sparc/mmu_helper.c index 32b629f..bef63f8 100644 --- a/target-sparc/mmu_helper.c +++ b/target-sparc/mmu_helper.c @@ -498,7 +498,8 @@ static int get_physical_address_data(CPUSPARCState *env, int is_user = (mmu_idx == MMU_USER_IDX || mmu_idx == MMU_USER_SECONDARY_IDX); - if ((env->lsu & DMMU_E) == 0) { /* DMMU disabled */ + if ((env->lsu & DMMU_E) == 0 || cpu_hypervisor_mode(env)) { + /* direct translation VA -> PA */ *physical = ultrasparc_truncate_physical(address); *prot = PAGE_READ | PAGE_WRITE; return 0; @@ -617,8 +618,9 @@ static int get_physical_address_code(CPUSPARCState *env, int is_user = (mmu_idx == MMU_USER_IDX || mmu_idx == MMU_USER_SECONDARY_IDX); - if ((env->lsu & IMMU_E) == 0 || (env->pstate & PS_RED) != 0) { - /* IMMU disabled */ + if (((env->lsu & IMMU_E) == 0) || (env->pstate & PS_RED) != 0 + || cpu_hypervisor_mode(env)) { + /* direct translation VA -> PA */ *physical = ultrasparc_truncate_physical(address); *prot = PAGE_EXEC; return 0; -- 2.7.2