public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori-NZpS4cJIG2HvQtjrzfazuQ@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [RFC] Porting KVM to QEMU CVS
Date: Wed, 20 Dec 2006 22:04:19 -0600	[thread overview]
Message-ID: <458A07C3.3080000@cs.utexas.edu> (raw)
In-Reply-To: <45864E67.3050803-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

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

Avi Kivity wrote:
> Anthony Liguori wrote:
>> Any thoughts?  
> 
> SMM continues the tradition of making each x86 generation hackier than 
> before.
> 
> What happens (probably) is that the virtual hardware unmaps the vga 
> memory when SMM is entered, and uses the physical memory at these 
> addresses (which is not normally accessible) to store the SMI handler code.

Doh! SMM uses the VGA memory doesn't it.  Now it all makes sense :-)

If I disable SMM in the Bochs BIOS, the patch works quite happily with 
the latest CVS.  I've attached the patch for reference.

> The way to fix this (again, probably) is to:
> 
> 1. Revert the 0-640K/1MB-end-of-memory slot thing and create just one 
> memory slot for all physical RAM.

We lose the VGA optimization here right?

> 2. Add hacks in the memory slot code to not return a memory slot if the 
> physical address is in the forbidden range.

I'm not sure I understand what you mean by this.  I guess I have to 
spend some time and understand how the whole memory slot thing works.

> 3. Add another hack to disable the first hack when SMM is entered and 
> re-enabled it when SMM is exited (e.g. some ioctl).

I'll have to read a little more into SMM.  It can be entered at any 
moment right?  I seem to recall that either the VT or SVM spec has 
special handling for SMIs?

Another option to consider would simply be to have the BIOS detect 
whether or not the emulated hardware supports SMM dynamically (right 
now, it's a compile time switch).  This would let us turn it off in QEMU 
when KVM is enabled.

> 
>> Is anyone else working on this?
> 
> I intended to merge qemu once a release is made.  However, if you get 
> this working and it is stable, it may make sense to merge sooner as I 
> very much like qemu cvs.

I would rather just submit this patch (with the BIOS hack) to QEMU and 
try and get it picked up in CVS.  There are some regressions at the 
moment in CVS so it may be nice for users to have an 0.8.2 based version 
available. What do you think?

Would be nice to have KVM support in QEMU CVS by the time 2.6.20 rolls out.

Regards,

Anthony Liguori

[-- Attachment #2: rombios-smm.diff --]
[-- Type: text/x-patch, Size: 1962 bytes --]

? _rombios_.c
? _rombiosl_.c
? biossums
? rombios.s
? rombios.sym
? rombios.txt
? rombios16.bin
? rombios32.bin
? rombios32.out
? rombiosl.s
? rombiosl.sym
? rombiosl.txt
Index: BIOS-bochs-latest
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/BIOS-bochs-latest,v
retrieving revision 1.141
diff -u -r1.141 BIOS-bochs-latest
Binary files /tmp/cvsCh2IkN and BIOS-bochs-latest differ
Index: BIOS-bochs-legacy
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/BIOS-bochs-legacy,v
retrieving revision 1.5
diff -u -r1.5 BIOS-bochs-legacy
Binary files /tmp/cvsQC2QUQ and BIOS-bochs-legacy differ
Index: rombios.h
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios.h,v
retrieving revision 1.3
diff -u -r1.3 rombios.h
--- rombios.h	3 Oct 2006 20:27:30 -0000	1.3
+++ rombios.h	21 Dec 2006 04:02:40 -0000
@@ -19,7 +19,7 @@
 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
 /* define it to include QEMU specific code */
-//#define BX_QEMU
+#define BX_QEMU
 
 #ifndef LEGACY
 #  define BX_ROMBIOS32     1
Index: rombios32.c
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios32.c,v
retrieving revision 1.8
diff -u -r1.8 rombios32.c
--- rombios32.c	3 Oct 2006 20:27:30 -0000	1.8
+++ rombios32.c	21 Dec 2006 04:02:41 -0000
@@ -38,7 +38,7 @@
 //#define BX_USE_EBDA_TABLES
 
 /* define it if the (emulated) hardware supports SMM mode */
-#define BX_USE_SMM
+//#define BX_USE_SMM
 
 #define cpuid(index, eax, ebx, ecx, edx) \
   asm volatile ("cpuid" \
@@ -852,6 +852,11 @@
     int ioapic_id, i, len;
     int mp_config_table_size;
 
+#ifdef BX_QEMU
+    if (smp_cpus <= 1)
+	return 1;
+#endif
+
 #ifdef BX_USE_EBDA_TABLES
     mp_config_table = (uint8_t *)(ram_size - ACPI_DATA_SIZE - MPTABLE_MAX_SIZE);
 #else

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

  parent reply	other threads:[~2006-12-21  4:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-18  4:57 [RFC] Porting KVM to QEMU CVS Anthony Liguori
     [not found] ` <45861F9D.7070006-NZpS4cJIG2HvQtjrzfazuQ@public.gmane.org>
2006-12-18  8:16   ` Avi Kivity
     [not found]     ` <45864E67.3050803-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-12-21  4:04       ` Anthony Liguori [this message]
     [not found]         ` <458A07C3.3080000-NZpS4cJIG2HvQtjrzfazuQ@public.gmane.org>
2006-12-21  8:36           ` Avi Kivity
     [not found]             ` <458A4792.1000309-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-12-21 16:11               ` Anthony Liguori

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=458A07C3.3080000@cs.utexas.edu \
    --to=aliguori-nzps4cjig2hvqtjrzfazuq@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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