tools: config-create: Make sanity checks the first code we run

Move the sanity check functions to the top of the script.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: mmio: Add opcode to error message when failing to parse

In case the MMIO parser fails to decode the instruction print the
failing instruction with the error message.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: print CR2 in case the hypervisor causes a pagefault

When causing a pagefault the page fault address is important for
debugging.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: add bash-completion for the jailhouse-tool

Because `jailhouse` is the main user-interface to the VM and some
command-chains are quite verbose (create, enable, cell create, cell
load, ...) it is very convenient to have a working bash-completion for
it.

This completes all current uses, although it is very static in some
places (as is the jh-tool) - some argument are only expected at certain
positions, etc.

For it to work, you need to have the `jailhouse`-tool in your
PATH-variable (obviously for the tool itself to work, you will likely
also need all other tools in PATH). Then just run

> . tools/jailhouse_bashcompletion

and it should work. You also need the bash-completion package installed
on your distribution and activated in your bash, otherwise the
source-operation will do nothing. For more details please read the
header of the file.

Known Bug: cell-namens as argument for the cell-subcommands can't contain
           spaces

Signed-off-by: Benjamin Block <bebl@mageta.org>
[Jan: removed restriction to .bin files]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: jailhouse: Use a libexec subdir for extension scripts

We want our extension scripts to be under a standard directory, namely
$libexecdir/<package>. As libexecdir may be overwritten during
installation, accept it from the Makefile via a define.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
configs: Avoid spaces in QEMU config name

Specifically bash completion is more fun without them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config-create: Add support for using a data directory

Once installed, the jailhouse-config-create has to be able to use a data
directory for finding its templates. That dir will typically be
different from the one where the script is located. Prepare for this by
providing a datadir variable assignment that can be patched during
installation.

When running from the source tree, we continue to use that directory as
default template dir.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: Hide some secondary build commands

By default, hide commands that are not essential for following the build
(or installation) process. Those can still be revealed by specifying
V=1. chmod is a first candidate.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: Add installation rules

This installs the jailhouse tool, its helper scripts and the template
files to standard, configurable directories. We patch the config
generator on installation so that the target version is aware of the
chosen data directory.

Note that installing the bash completion is left up to the user. There
is apparently no distro-independent way to achieve this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Rename page_map_* -> paging_*

The module is already called "paging", so lets call its functions like
this as well. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Remove unused cpu_data argument from vmx_entry_failure

panic_stop no longer requires it, so it became useless.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Remove cpu_data parameter from interrupt handling path

We can obtain a reference on demand now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Remove cpu_data parameter from vmx_set_cell_config

As a consequence, this allows to remove it also from vmx_cpu_reset and
vmx_cpu_park. All functions always work against the invoking CPU.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Remove cpu_data parameter from hypercall functions

We can obtain a reference on demand now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>