Home Tech Haiku OS Hardware Virtualization: Final Inform

Haiku OS [GSoC 2024] Hardware Virtualization: Final Inform

22
0
Haiku OS [GSoC 2024] Hardware Virtualization: Final Inform

Project overview
QEMU is a digital machine which permits working an operating arrangement internal of every other. Whereas there already is a Haiku port, it for the time being doesn’t toughen any acceleration arrangement thru native virtualization (thru Intel VT-x and AMD SVM.) This makes it too gradual for many uses.
This challenge aimed to carry hardware virtualization to Haiku by porting NVMM, a hypervisor that already has QEMU toughen, into Haiku from DragonFlyBSD. The challenge desires (as integrated on the proposal) had been:
Project desires

  • NVMM driver ported to Haiku (VMX backend handiest)
  • QEMU in a position to accelerating digital machines thru NVMM

The challenge desires didn’t alternate powerful exact thru the challenge (even despite the incontrovertible truth that there had been plans to rep SVM backend working too, which didn’t happen since I didn’t obtained any time to rep into it) and so they’ve been finished to a diploma: The driver (VMX backend) is kind of entirely ported (there are handiest a couple of miniature print missing) and QEMU is in a position to accelerating digital machines but several bugs remain.

Now, the miniature print:
Done desires

  • NVMM frontend ported
  • NVMM VMX backend ported (with a couple considerations final)
  • libnvmm (& take a look at suite) ported
  • EPT toughen added to the kernel
  • QEMU patched to toughen NVMM on Haiku and dealing

Unresolved considerations

  • SVM backend no longer ported
  • Some OSes don’t work effectively on QEMU
  • Assorted behavior on right hardware
  • QEMU crashes when SMP is enabled
  • EPT translations no longer flushed from TLB on time

These are appropriate the significant considerations, for a plump listing of incomplete stuff discuss to GitHub (43 quiet opened whereas penning this publish).
Right here we will look QEMU virtualizing KolibriOS thru NVMM (on nested virtualization):

KolibriOS working on QEMU+NVMM (nested virtualization)

Code
The code is in the marketplace at GitHub (commits dated Might almost definitely perhaps perhaps 13 and later in the master branch). None of it has been merged yet for the explanation that driver isn’t entirely working
and the kernel modifications I made are handiest needed for NVMM.
Done desires: Technical miniature print
Some miniature print about every reveal I obtained carried out, in chronological notify, with one of the main extra
related commits integrated. Some commits from the starting of the challenge enjoy modifications
to extra stuff than what the commit message says since on the starting I needed to enact loads
of modifications in many different parts of the challenge and it used to be laborious to interrupt up things into
separate commits.

Whereas the NVMM code from DragonFlyBSD used to be extra OS-self sustaining than the NetBSD one it quiet
assumed loads of BSD macros had been available. Moderately a couple of them weren’t available on Haiku so we
introduced some headers from DragonFlyBSD:

NVMM is written in C whereas spacious chunks of Haiku are written on C++. We determined to befriend NVMM in C (that is, compile it with gcc) and appropriate
put C++ code into the nvmm_haiku.cpp file which holds any OS-dependent good judgment for the Haiku port, appropriate fancy there are nvmm_netbsd.c and nvmm_dragonflybsd.c.
Nevertheless, there are some Haiku headers we needed to embody from NVMM C code. Those headers had been undoubtedly supposed
to hang a C-API but curiously the x86_64 variations of those headers didn’t. I needed to made them work with C:

SVM backend
Appropriate for the sake completion. The finest commits keen the SVM backend:

Porting libnvmm
Porting libnvmm used to be straightforward and painless, even despite the incontrovertible truth that it required to rob away some non-identical old error codes.

VMX backend
This used to be the half of the challenge that spans better over time (I labored on it from Might almost definitely perhaps perhaps 13 to spherical July 16, and there had been bugfixes after that).
It slowly won efficiency over time, daily adding a brand new characteristic unless in the end the calc instance
turned the first VM to be virtualized by NVMM on Haiku.

The code contained right here is amazingly straight-forward for the explanation that laborious half used to be getting the OS negate
capabilities that these IOCTLs needed working.

calc-vm virtualized by NVMM

Haiku negate driver

Implemented Haiku legacy driver API into the driver.

 » …
Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here