qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Kovalenko <igor.v.kovalenko@gmail.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] sparc64 support TSB related MMU registers
Date: Sun, 26 Apr 2009 23:24:46 +0400	[thread overview]
Message-ID: <b2fa41d60904261224m57a3f0e9s23ae76013212f1fb@mail.gmail.com> (raw)
In-Reply-To: <f43fc5580904241042n7497892fv4ee573b3bf658697@mail.gmail.com>

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

On Fri, Apr 24, 2009 at 9:42 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> On 4/24/09, Igor Kovalenko <igor.v.kovalenko@gmail.com> wrote:
>> Hi!
>>
>>  This change allows reading ultrasparc I/D MMU TSB tag target register
>>  and TSB pointer register (8k and 64k).
>>  Linux kernel uses TSB for memory management, and with this change it
>>  now can use early allocation routines.
>>
>>  I'm testing with linux-2.6.29.1 minimalistic sparc64 uniprocessor
>>  build, now kernel is able to start build device tree.
>>  Without the change kernel was not able to handle D-MMU miss while
>>  creating first device tree node.
>>  Currently it stops shortly after building device tree, trying to find
>>  out path to console.
>
> Nice, though I didn't notice any visible improvement in my tests.

Here is the missing part in qemu-sparc64-mmu-pagesize.patch
This fixes TLB match code to respect page size, otherwise 4M page
mappings may be not found.
Also this corrects a typo in get_physical_address_code which uses a
register from DMMU instead of IMMU.

Please apply.

get_physical_address_data/code probably needs some code reuse refactoring.

>>  (PS with openbios instance-to-path method fails in client interface
>>  call, in the same way
>>  it fails without loading kernel when I try invoking get-instance-path
>>  on stdin handle from command prompt.
>>  there fmove invokes memmove() with size argument looking like some
>>  pointer which leads to unhandled D-MMU fault)
>
> Similar very obscure problem was fixed with PPC (r481), the bug was
> with the PCI nodes.

Here (r484) on sparc64 it hangs in the same place.

-- 
Kind regards,
Igor V. Kovalenko

[-- Attachment #2: qemu-sparc64-mmu-pagesize.patch --]
[-- Type: application/octet-stream, Size: 2329 bytes --]

Index: qemu-trunk/target-sparc/helper.c
===================================================================
--- qemu-trunk.orig/target-sparc/helper.c
+++ qemu-trunk/target-sparc/helper.c
@@ -404,7 +404,7 @@ static int get_physical_address_data(CPU
         }
         // ctx match, vaddr match, valid?
         if (env->dmmuregs[1] == (env->dtlb_tag[i] & 0x1fff) &&
-            (address & mask) == (env->dtlb_tag[i] & ~0x1fffULL) &&
+            (address & mask) == (env->dtlb_tag[i] & mask) &&
             (env->dtlb_tte[i] & 0x8000000000000000ULL)) {
             // access ok?
             if (((env->dtlb_tte[i] & 0x4) && is_user) ||
@@ -420,8 +420,8 @@ static int get_physical_address_data(CPU
 #endif
                 return 1;
             }
-            *physical = (env->dtlb_tte[i] & mask & 0x1fffffff000ULL) +
-                (address & ~mask & 0x1fffffff000ULL);
+            *physical = ((env->dtlb_tte[i] & mask) | (address & ~mask)) &
+                        0x1ffffffe000ULL;
             *prot = PAGE_READ;
             if (env->dtlb_tte[i] & 0x2)
                 *prot |= PAGE_WRITE;
@@ -467,7 +467,7 @@ static int get_physical_address_code(CPU
         }
         // ctx match, vaddr match, valid?
         if (env->dmmuregs[1] == (env->itlb_tag[i] & 0x1fff) &&
-            (address & mask) == (env->itlb_tag[i] & ~0x1fffULL) &&
+            (address & mask) == (env->itlb_tag[i] & mask) &&
             (env->itlb_tte[i] & 0x8000000000000000ULL)) {
             // access ok?
             if ((env->itlb_tte[i] & 0x4) && is_user) {
@@ -481,8 +481,8 @@ static int get_physical_address_code(CPU
 #endif
                 return 1;
             }
-            *physical = (env->itlb_tte[i] & mask & 0x1fffffff000ULL) +
-                (address & ~mask & 0x1fffffff000ULL);
+            *physical = ((env->itlb_tte[i] & mask) | (address & ~mask)) &
+                        0x1ffffffe000ULL;
             *prot = PAGE_EXEC;
             return 0;
         }
@@ -490,7 +490,7 @@ static int get_physical_address_code(CPU
 #ifdef DEBUG_MMU
     printf("TMISS at 0x%" PRIx64 "\n", address);
 #endif
-    env->immuregs[6] = (address & ~0x1fffULL) | (env->dmmuregs[1] & 0x1fff);
+    env->immuregs[6] = (address & ~0x1fffULL) | (env->immuregs[1] & 0x1fff);
     env->exception_index = TT_TMISS;
     return 1;
 }

  parent reply	other threads:[~2009-04-26 19:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-23 22:56 [Qemu-devel] [PATCH] sparc64 support TSB related MMU registers Igor Kovalenko
2009-04-24 17:42 ` Blue Swirl
     [not found]   ` <b2fa41d60904242246x6b1b7177ifb973c41a3c051fb@mail.gmail.com>
     [not found]     ` <f43fc5580904242358k74df8bf9lc0b72c92e58a38bf@mail.gmail.com>
     [not found]       ` <b2fa41d60904250010m52db6db4id08b5729276faf62@mail.gmail.com>
     [not found]         ` <b2fa41d60904250714m3eb68cfay45ed84ff78892855@mail.gmail.com>
2009-04-25 14:17           ` Igor Kovalenko
2009-04-25 15:27             ` Blue Swirl
2009-04-26 19:24   ` Igor Kovalenko [this message]
2009-04-27 16:51     ` Blue Swirl

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=b2fa41d60904261224m57a3f0e9s23ae76013212f1fb@mail.gmail.com \
    --to=igor.v.kovalenko@gmail.com \
    --cc=blauwirbel@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).