core: Take page offset of config data into account when mapping the data

We have to take the offset of the configuration data on the first page
into account when calculating the mapping size. Otherwise we may fail to
map its last page.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
configs: Update QEMU VM config

Reflects changes in latest QEMU: PCI range starts at lower address,
e1000 and virtio-9p flipped positions. Also adjust a harmless mistake of
the denied range at this chance.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Documenation: Add references section to hypervisor-interfaces.txt

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Rename "Linux cell" to "root cell"

As we refer to the first cell that contains the boot-strap Linux as
"root cell" in the documentation, change the internal naming accordingly
in order to be more consistent. The affects linux_cell primarily, but
also a few related variable and function names as well as a couple of
console messages.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Move remap_to_root_cell and address_in_region

Move remap_to_root_cell and, thus, also address_in_region before
cell_create because we will need it there soon. No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Make counter variable unsigned in remap_to_root_cell

Unwritten rule: unless we need signedness, don't define counters as
signed integers.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Make arch_unmap_memory_region return error codes

We are going to use arch_unmap_memory_region also for scenarios we
hugepages might require breakups, thus we will need to handle potential
errors. Prepare arch_unmap_memory_region and its implementations for
this by propagating the error of page_map_destroy.

We can still ignore the return code in cell_destroy, so move the
corresponding comment.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Implement generic root cell shrinking of memory regions

Use arch_unmap_memory_region to implement the unmapping of a new cell's
memory regions from the root cell. This simplifies the code and even
allows us to perform a roll-back on errors (always provided we still
have enough memory after a potential hughpage breakup).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Move vmx_[un]map_memory_region

This aligns the ordering in the file to vtd and the header. No
functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Reorder cell creation and root cell shrinking in arch_cell_create

This avoids having the roll back the root cell shrinking of vmx and vtd
(except via vmx_cell_exit).

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