From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [RFC] Porting KVM to QEMU CVS Date: Wed, 20 Dec 2006 22:04:19 -0600 Message-ID: <458A07C3.3080000@cs.utexas.edu> References: <45861F9D.7070006@cs.utexas.edu> <45864E67.3050803@qumranet.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030805080106040003060200" Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: To: Avi Kivity In-Reply-To: <45864E67.3050803-atKUWr5tajBWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is a multi-part message in MIME format. --------------030805080106040003060200 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------030805080106040003060200 Content-Type: text/x-patch; name="rombios-smm.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="rombios-smm.diff" ? _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 --------------030805080106040003060200 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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 --------------030805080106040003060200 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --------------030805080106040003060200--