qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Kovalenko <igor.v.kovalenko@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] sparc64: mmu bypass mode correction
Date: Sun, 12 Jul 2009 02:37:23 +0400	[thread overview]
Message-ID: <b2fa41d60907111537xc965cchbd80bbd1e2e43222@mail.gmail.com> (raw)
In-Reply-To: <b2fa41d60907111535s622a5d69wf1cd5cf11def1a8a@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 196 bytes --]

This Implement physical address truncation in mmu bypass mode.
IMMU bypass is also active when cpu enters RED_STATE

Signed-off-by: igor.v.kovalenko@gmail.com

-- 
Kind regards,
Igor V. Kovalenko

[-- Attachment #2: sparc64-immu-bypass --]
[-- Type: application/octet-stream, Size: 1185 bytes --]

Index: qemu-trunk/target-sparc/helper.c
===================================================================
--- qemu-trunk.orig/target-sparc/helper.c
+++ qemu-trunk/target-sparc/helper.c
@@ -369,6 +369,13 @@ void dump_mmu(CPUState *env)
 #endif /* DEBUG_MMU */
 
 #else /* !TARGET_SPARC64 */
+
+// 41 bit physical address space
+static inline target_phys_addr_t ultrasparc_truncate_physical(uint64_t x)
+{
+    return x & 0x1ffffffffffULL;
+}
+
 /*
  * UltraSparc IIi I/DMMUs
  */
@@ -380,7 +387,7 @@ static int get_physical_address_data(CPU
     unsigned int i;
 
     if ((env->lsu & DMMU_E) == 0) { /* DMMU disabled */
-        *physical = address;
+        *physical = ultrasparc_truncate_physical(address);
         *prot = PAGE_READ | PAGE_WRITE;
         return 0;
     }
@@ -442,8 +449,9 @@ static int get_physical_address_code(CPU
     target_ulong mask;
     unsigned int i;
 
-    if ((env->lsu & IMMU_E) == 0) { /* IMMU disabled */
-        *physical = address;
+    if ((env->lsu & IMMU_E) == 0 || (env->pstate & PS_RED) != 0) {
+        /* IMMU disabled */
+        *physical = ultrasparc_truncate_physical(address);
         *prot = PAGE_EXEC;
         return 0;
     }

      reply	other threads:[~2009-07-11 22:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-11 22:35 [Qemu-devel] [PATCH] sparc64: mmu bypass mode correction Igor Kovalenko
2009-07-11 22:37 ` Igor Kovalenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2fa41d60907111537xc965cchbd80bbd1e2e43222@mail.gmail.com \
    --to=igor.v.kovalenko@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).