[vbox-dev] KVM & VirtualBox

Knut St. Osmundsen knut.osmundsen at oracle.com
Wed Dec 22 22:59:54 GMT 2010


Michael,

VirtualBox has a hypervisor already. I don't know exactly what the KVM API expose, but from the looks of things, it at least guest execution and shadow paging.  So, if you wish to graft KVM into VirtualBox's VMM, you will probably have to rewrite or rip out the PGM (page manager/monitor) component as well as making substantial changes to the EM (execution manager/monitor). The former is probably more work than the latter as the PGM component is large and there are heaps of dependencies on it. CPUM is also going to cause some trouble as there are heaps of dependencies on the register structures it maintains, you may try synchronize the CPU state back and forth between CPUM and KVM but that isn't extremely efficient.

As stated in the IOM documentation (IOM.cpp line 69) IOMMMIORead/Write are used by the recompiler (src/recompiler/VBoxRecompiler.c) to implement MMIO. (A simple grep thru the source tree should tell you this if your editor isn't able to...) Regarding those @page documentation blocks, some may be a bit outdated, so quickly checking out the relevant code is recommended.


On Dec 22, 2010, at 10:14 PM, Michael van der Kolff wrote:

> You state "rewriting 75% of the hypervisor".  If you look at
> ${KRNL_SRC}/Documentation/kvm/api.txt, you'll see that it *is* a
> hypervisor... With a rather simple API.  I was rather hoping that I
> could find where to fit the plumbing on the VirtualBox side fairly
> easily...
> 
> Cheers,
> 
> Michael
> 
> On Thu, Dec 23, 2010 at 12:33 AM, Sander van Leeuwen
> <sander.x.van.leeuwen at oracle.com> wrote:
>> Michael,
>> 
>> That sounds like a pointless exercise to me. First of all VirtualBox isn't
>> some QEmu extension like KVM
>> and the entire code is very tightly integrated.  It's not possible without
>> rewriting 75% of the hypervisor.
>> Be my guest, but I don't know how many man years you've allocated for this
>> task. :-)
>> I also fail to see what you want to accomplish with that.
>> 
>> (MM)IO is handled in the instruction emulator, which calls the IOM*
>> functions, which end up calling
>> the registered device handlers. (src/VBox/VMM for IO handling,
>> src/VBox/Devices for the virtual device code)
>> 
>> Sander
>> 
>> On 12/22/2010 8:35 AM, Michael van der Kolff wrote:
>>> 
>>> I was thinking of attempting to write a patch to make VirtualBox use
>>> KVM for its CPU (KVM only implements the CPU, it doesn't implement
>>> platform - that's someone else's job). So, I read alternately the
>>> doxygen documentation&  the VBox source code (kvm-all.c from qemu
>>> shows how to handle all of the stuff that KVM can chuck back - simple
>>> once one sees how...).  Anyway, I was looking to join the bits that do
>>> MMIO&  IO, and the doxygen documentation&  names, categorisation,
>>> etc... would seem to imply that IOMMMIO{Read/Write} are responsible
>>> for that - except it would seem that they aren't called anywhere right
>>> now.
>>> 
>>> How exactly is MMIO handled in VirtualBox right now?
>>> 
>>> Cheers,
>>> 
>>> Michael
>>> 
>>> _______________________________________________
>>> vbox-dev mailing list
>>> vbox-dev at virtualbox.org
>>> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>> 
>> 
>> --
>> Kind regards / Mit freundlichen Gruessen / Met vriendelijke groet
>> 
>> --
>> Sander van Leeuwen | Senior Staff Engineer, VirtualBox
>> Oracle Virtualization
>> 
>> ORACLE Deutschland B.V. & Co. KG | Werkstrasse 24 | 71384 Weinstadt
>> 
>> ORACLE Deutschland B.V. & Co. KG
>> Hauptverwaltung: Riesstr. 25, D-80992 München
>> Registergericht: Amtsgericht München, HRA 95603
>> 
>> Komplementärin: ORACLE Deutschland Verwaltung B.V.
>> Rijnzathe 6, 3454PV De Meern, Niederlande
>> Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
>> Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
>> 
>> _______________________________________________
>> vbox-dev mailing list
>> vbox-dev at virtualbox.org
>> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>> 
> 
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> http://vbox.innotek.de/mailman/listinfo/vbox-dev

-- 

Kind regards / Mit freundlichen Gruessen / Vennlig hilsen,
 bird

--

ORACLE Deutschland B.V. & Co. KG  Knut St. Osmundsen
Werkstrasse 24                    Senior Staff Engineer, VirtualBox
71384 Weinstadt, Germany          mailto:bird at sun.com

Hauptverwaltung: Riesstr. 25, D-80992 Muenchen
Registergericht: Amtsgericht Muenchen, HRA 95603

Komplementaerin: ORACLE Deutschland Verwaltung B.V.
Rijnzathe 6, 3454PV De Meern, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschaeftsfuehrer: J. Kunz, M. van de Molen, A. van der Ven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20101222/e4582c87/attachment.html>


More information about the vbox-dev mailing list