core: Compact local variable list in paging_init

No functional change.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Clarify local variable meaning in init_early

This size is the sum of the core and the per-CPU data area.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Calculate core and per-CPU data region size differently

Use pointer arithmetic to obtain the size of the region that contains
the hypervisor core and the per-CPU data structures. system_config tells
us where it ends.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Validate CPU ID before using it

Currently, Linux ensures that we have enough room in the per-CPU data
area when calling the entry function with a specific CPU ID. That will
change as we will allocate only as much as required for a given system
configuration. To avoid that we would then dereference some out of
bounds CPU data because of an invalid CPU ID, always perform the ID
check before using the data structure.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver: Rename hv_core_percpu_size to hv_core_and_percpu_size

This size is the sum of the core and the per-CPU data region.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core/driver: Rework obtaining of maximum number of CPUs

num_possible_cpus() actually counts the possible CPUs and does not
necessarily return the maximum CPU ID + 1, the value Jailhouse needs.
Fix this by deriving that value from the root cell's CPU set. Rename
the header field correspondingly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Update TODO regarding ARM

Specifically leave a note that big endian support is not yet there.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Silence recursive make calls

Generalize install.mk to include.mk so that it can host the Q tag
definition. Apply this tag on the recursive make call of the top-level
makefile.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Add copyright header to make_release

Top-level license already applied, but let's make it also formally
clear.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config-create: cosmetic changes for pep8 compliance

Fix syntax according to pep8 and remove stale function return.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools: config create: change the way input files are handled

Switch from automatically generated lists of input files to
hand-maintained ones. Generating the lists turned out to make the code
less readable. All the parse-functions would have to be called just to
collect theire opens.
Now we still use the input_open wrapper to prefix the opens with the
root_dir and we make sure that the file one is trying to open is listed
as an input file and will therefore be collected by the collector.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: make the x86 types-definitions work on either x86-32 and x86-64

For Intel TXT we will need to work in 32bit mode for a limited amount of
time. To make sure we can use certain headers and definitions safely in
both modes, change the definition of `u64` to use `long long` instead of
`long` (which changes its length depending on the arch).

Furthermore, the x86-header defines a macro BITS_PER_LONG, currently we
define this always as `64`. To make this usable for the TXT-stub, hide
this behind an `ifndef`. The current hypervisor-code won't be affected
by this change and we can define this for the TXT-stub with our tooling,
thus make the header usable in both modes.

Signed-off-by: Benjamin Block <bebl@mageta.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: make the jailhouse-header arch-independent

The header of jailhouse is defined with arch-dependent types such as
`unsigned long` which on linux varies in size. Because this header can
be considered the "communication"-relay with the environment, it should
be type-safe on any arch. Thus change all types into fixed-size-types.

Signed-off-by: Benjamin Block <bebl@mageta.org>
[Jan: adjusted jailhouse_entry to keep unsigned int]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Remove debugging left-over in gen_version_h

Stop polluting the source directory with this useless diff.log that was
once added during development.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tooling: Fix gen_version_h to query git support for the correct repository

The initial git availability check ran in the kernel directory instead
of the Jailhouse source tree. Fix it by moving the cd before it. Also
quote the input path properly at this chance.

Reported-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>