[haiku-development] Re: Regarding the KVM support

  • From: Laasya Sree <laasyasreesapa@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 14 Mar 2020 16:53:39 +0530

Hello,

*Work done: *I've imported all the NVMM sources into haiku drivers folder
and wrote a Jamfile for it [1].
Currently trying to compile the driver. But I'm facing errors because of
some header files and I'm trying to solve them.
For some header files I've fixed the include paths.
And when there is a missing header file in haiku I took it from NetBSD and
placed it inside src/libs/compat/netbsd folder. But again that header file
showed an error. And this is continuing. This has become time consuming and
I'll eventually copy the whole NetBSD code if I continue doing this.

It would be helpful if you can guide me on creating replacements of these
headers files that is available on haiku.

Hope to hear from you soon.

[1] - https://review.haiku-os.org/c/haiku/+/2314

On Sun, Mar 1, 2020 at 4:25 PM Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
wrote:

1 mars 2020 11:23 "Laasya Sree" <laasyasreesapa@xxxxxxxxx> a écrit:

Hello,

Hope you are having a great weekend,

Work done: I have read about KVM[1] and NVMM[2] and connection between
KVM and QEMU[3]. And I think
implementing NVMM will be apt: * NVMM's complex emulation machinery is
not in the kernel, but in
userland. This is an excellent security property of NVMM, because it
reduces the risk for the host
in case of bug or vulnerability – the host kernel remains unaffected –,
and also has the advantage
of making the machinery easily fuzzable. Currently, this property is not
found in other hypervisors
such as KVM, HAXM or Bhyve.

More importantly for us, it means that we have less work to do: the
userland parts should be reusable
directly, or with few patches. So we can focus on the kernel side, where
more work will be needed
(because Haiku is not a BSD kernel, and the internals are a little
different)

* Haiku is released under MIT license and NVMM is under GNU General
Pubic license(GPL). And the MIT
license is compatible with many copyleft licenses, such as the GNU GPL.
MIT licensed software can
be re-licensed as GPL software, and integrated with other GPL software.

Actually, the kernel code of NVMM is under a 2clause BSD license, so we
avoid adding more GPL code
to the kernel (which we prefer to avoid).

* KVM is 99 percent linux specific and NVMM is the fastest way to do it.

Query: Now that I have thought that NVMM is suitable for haiku I would
like to get your guidance
regarding what to begin with and where to take my first step. It would
be really helpful if you
could guide me on this.

You have probably found the NVMM kernel-side code already. It will need
some changes to be built as
an Haiku driver. The entry point for the BSD driver, as far as I can see,
is here:
https://nxr.netbsd.org/xref/src/sys/dev/nvmm/nvmm.c#1023

The entry point for Haiku drivers are a bit different. There is some
documentation about them,
for example here:

https://www.haiku-os.org/legacy-docs/writing-video-card-drivers/03-kernel-driver

Drivers in Haiku usually go in the sourcetree in
src/add-ons/kernel/drivers. I think the next step
would be importing the NVMM sources there and start adding a Jamfile for
them. Then you can start
trying to compile the driver and see what happens.

On the userland side, at some point we will need to build libnvmm. This
will probably be done as
an haikuports recipe at https://github.com/haikuports/haikuports. I don't
know how much the
userland side of NVMM relies on NetBSD-specific APIs, so it may be a good
idea to at least attempt
writing a recipe and see how far we can get it to build.

--
Adrien.




-- 
Regards,
Laasya,
Amrita university <https://www.amrita.edu/>
|Github|| <https://github.com/laasyasree>amFoss| <https://amfoss.in/>

Other related posts: