qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sean Donner <sean.donner@sbcglobal.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [kqemu patch] get Open/NetBSD to work with the kqemu accelerator
Date: Wed, 26 Dec 2007 22:42:08 -0800 (PST)	[thread overview]
Message-ID: <19117.39384.qm@web82014.mail.mud.yahoo.com> (raw)

I just wanted to comment and say this patch works great. I too was
having problems with getting OpenBSD 4.2 working without using the
-no-kqemu option.  Recompiling with this patch I was able to 
confirm that kqemu was working by running 'info kqemu' in the qemu
monitor.  I would really like to see this patch (or a functionally
similar one) incorporated into the next release.

>[sorry if this is the wrong list, but I haven't figured out any public
> address where I could send kqemu bug reports and patches]
>
>Currently, both NetBSD and OpenBSD are hanging or crashing when running
>on qemu with the kqemu accelerator enabled.
>
>This happens because both systems are using a weird scheme where they
>are loading the GDT table with LGDT up-front (with the limit set to
>the maximum), but are growing the table and actually mapping the memory
>behind it only when needed.
>(see src/sys/arch/i386/i386/gdt.c in both source trees)
>
>That is causing the kqemu accelerator to generate a page fault in
>update_dt_cache() when trying to fill its 'soft' tlb with pages that
>are beyond the real end of the GDT table.
>
>With this diff applied, NetBSD and OpenBSD seem to run fine with
>kqemu + user-only virtualization (I've tried netbsd-4.0-rc2 and
>openbsd 4.2).
>
>Full virtualization (-kernel-kqemu) doesn't work yet for different
>reasons (I think).
>
>Regards,
>Adi
>
>--- xx/kqemu-1.3.0pre11/common/monitor.c        Tue Feb  6 23:02:00 2007
>+++ kqemu-1.3.0pre11/common/monitor.c   Mon Nov  5 18:59:58 2007
>@@ -990,7 +990,8 @@ static void *map_vaddr(struct kqemu_state *s, unsigned
>     e = &s->soft_tlb[(addr >> PAGE_SHIFT) & (SOFT_TLB_SIZE - 1)];
>  redo:
>     if (e->vaddr[(is_user << 1) + is_write] != (addr & PAGE_MASK)) {
>-        soft_tlb_fill(s, addr, is_write, is_user);
>+        if(cpu_x86_handle_mmu_fault(s, addr, is_write, is_user, 1))
>+                return NULL;
>         goto redo;
>     } else {
>         taddr = e->addend + addr;
>@@ -1802,6 +1803,11 @@ static void update_dt_cache(struct kqemu_state *s, int
>             page_end = dt_end;
>         sel2 = sel + (page_end - dt_ptr);
>         ptr = map_vaddr(s, dt_ptr, 0, 0);
>+        if(!ptr)
>+                /* Open/NetBSD have a 'dynamic' GDT, but they load the gdt
>+                   register with LGDT only once and with a limit far beyond
>+                   the end of the memory actually mapped for the table */
>+                goto skip_the_rest;
>         ram_addr = ram_ptr_to_ram_addr(s, ptr);
>         if (dt_changed || 
>             s->dt_ram_addr[dt_type][pindex] != ram_addr ||
>@@ -1818,7 +1824,7 @@ static void update_dt_cache(struct kqemu_state *s, int
>     sel_end = (s->dt_limit[dt_type] + 1) & ~7;
>     if (sel < sel_end)
>         reset_dt_entries(s, dt_type, sel, sel_end);
>-
>+skip_the_rest:
>     s->dt_base[dt_type] = base;
>     s->dt_limit[dt_type] = limit;
> }

             reply	other threads:[~2007-12-27  6:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-27  6:42 Sean Donner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-11-05 20:00 [Qemu-devel] [kqemu patch] get Open/NetBSD to work with the kqemu accelerator Enache Adrian

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=19117.39384.qm@web82014.mail.mud.yahoo.com \
    --to=sean.donner@sbcglobal.net \
    --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).