core/configs: Clean up config structure alignment/packing

Instead of spreading aligned(1), we rather need to pack all config
structures and also the containers we define in the config files
themselves. Clean this up, also dropping the now unneeded padding from
jailhouse_cell_desc.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core/configs: Change IRQ line access control modeling

Change the configuration file to manage access to IRQ lines at IRQ chip
level. Each IRQ chip config entry consists of a unique identifier,
typically the chip's MMIO address, and a bitmap controlling access to
individual IRQs lines of that chip. This will simplify access control
checks to IRQ chips.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Add support for Mod 1 to MMIO parser

The only difference to Mod 2 is the length of the displacement: 1
instead of 4 bytes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Add support for IOAPIC access control

This adds basic access control to the IOAPIC. Based on the IRQ chip
configuration, we permit or deny writing to redirection table entries.
This needs to be integrated with interrupt remapping later on.

We furthermore allow reads from other valid IOAPIC registers but deny
any other write accesses.

EOI writing is currently passed through. This will have to be
virtualized as well when interrupt remapping is added.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
configs: Make use of IOAPIC moderation

Remove the IOAPIC page from the memory regions and add the IOAPIC as
irqchip instead.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Replace shrinking_set with root_cell.cpu_set in cell_create

Let's make it clear: the set we shrink is always the one of the root cell.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Factor out cell_destroy_internal

We will reuse it to roll back failed cell creations.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Guard vtd_add_device_to_cell against addition of existing devices

Avoid that we add an already registered device to a cell, specifically
that we report this to the console. This case can happen soon when
rolling back failed cell creations.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
x86: Remove some unneeded local caching of cell->config

No hot-paths, we can save the local variables.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Generic memory region mapping with rollback on error for cell creation

Pull the memory region mappings that currently happen in vmx and vtd
into generic code paths. This allows us to properly roll back on errors
during cell creation.

We now perform the arch-specific cell initialization first, then
transfer CPUs and finally remap the memory regions. For the rollback, we
can simply use the infrastructure available for cell destruction, both
at generic level as well as inside vmx/vtd.

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