tools: Add VERSION file to jailhouse tool dependencies

If the version changes, we want this information in the tool (via
CFLAGS).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver: Fix signedness in stats_show()

A variable that store hypercall result in stats_show() function
was incorrectly declared as unsigned, hence the error check always
succeeded.

Signed-off-by: Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: split Kbuild-related rules from the main Makefile

Split all parts of the main Makefile, that are only related to the
kernel build-system, into their own file (Kbuild). When invokes, this
file will be search first for additional rules by the kernel
build-system.

The remaining rules in our own root-Makefile will not be seen by the
kernel build-system anymore and thus are easier to extend.

Also, change some variable-names to fit those suggested by the
kernel-documentation (Documentation/kbuild/modules.txt).

Signed-off-by: Benjamin Block <bebl@mageta.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: add recursive tools-build and proper install-rules to the root Makefile

To build the jailhouse-tools, one has to make separate make-calls in
each their directory. This is fixed by adding simple recursive rules to
the root-Makefile. This also makes sure, that we always build both and
don't get incompatible versions during development.

This patch also adds proper install-rules to the root-Makefile. We added
them to our tools-Makefile, so we should also add them here. This only
concerns the hypervisor-image-file at the moment.

Signed-off-by: Benjamin Block <bebl@mageta.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: extracts common install-definitions into a central include

After adding install-rules to the tools- and root-Makefile we have some
redundancies in some variables and definitions (e.g.: $(INSTALL)). To fix
this, extract all duplications and general definitions concerning the
install-process into one central Makefile-include `install.mk`.

This also unifies the way directories are created for
installation-rules. Previously we would just create them every time
without checking if that is needed. Now we add them as prerequisite to
the install-rule and generate a rule for each of them in `install.mk`.
This way `make` will figure out if the need to be created. This also
lowers the verboseness of the Makefile.

Signed-off-by: Benjamin Block <bebl@mageta.org>
[Jan: moved install.mk to scripts folder]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Remove explicit depmod invocation

Modern kernels do this for us.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Respect DESTDIR for module installation

If unset, derive INSTALL_MOD_PATH from DESTDIR and export it so that the
module installation will use it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Install jailhouse binary under sbin

It is, in fact, a privileged program, at least now and in the
foreseeable future. So move it to sbin.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
inmates: Add memcpy prototype

Only supports built-in version so far.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
inmates: Add NULL definition

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
inmates: x86: Add E1000-based PCI DMA demonstration

This adds a simple Ethernet ping-ping via Intel E1000-based NICs. Run
two instances in the same network, and the first will become the test
controller while the second instance to show up will be the target.
Round trip times will be measured and dumped by the controller. This can
surely be further improved, and there are still some stability issues
(measurement stops on lost packet). It's a start.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
configs: qemu: put floppy IO ports into config

The qemu VM will have a floppy drive and we can not tell Qemu to not
emulate one. Now if the guest kernel has a driver for a floppy drive we
can get violations on "jailhouse enable". Of the shelf distro kernels
will have floppy support so we need to whitelist the floppy ports in the
qemu root cell config.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Choose between VT-x and AMD-V at compile time

The initial implementation of the compile-time VM abstraction layer.
SVM methods present are mostly stubs.
x86: vm_maps_flush_all() renamed to vm_tlb_flush()

New name suits better since the function doesn't necessarily
flushes all TLB entries.
x86: Added TODO/FIXME
x86: Adapted struct segment for non-VMX code

A better abstraction is needed; for now, #ifdefs will do.
x86: Added VMCB and related data structures

Imported AMD-V data structures from the Xvisor code.
See http://xhypervisor.org.
x86: Fixed decode_assists detection
x86: Fixed svm_tlb_flush() prototype
x86: Implemented vmcb_setup() and related