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 may require integration 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 revisited
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: Make PAGE_ALIGN macro robust against complex parameter

Separate the parameter expression from the macro's own calculation.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Clean up jailhouse_system_config_size

Instead of open-coding the content of struct jailhouse_system for
calculating its size, simply adjust sizeof(*system) by that part of
system->system that is already included in jailhouse_cell_config_size().
Simplifies future extensions of struct jailhouse_system.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core/configs/driver: Rename jailhouse_system::system to root_cell

Now that we have a terminology for the first cell, use it. No functional
change, but local configs will require adjustments.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core/driver: Reintroduce a second hypercall argument

Now we have the use case: GET_CPU_INFO will take two arguments, so
reintroduce the capability to pass them. But not more. For now.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core/driver: Extend "CPU Get State" to "CPU Get Info" hypercall

Add a second argument to control which per-cpu information shall be
retrieved via JAILHOUSE_HC_CPU_GET_INFO. For now there will only be
JAILHOUSE_CPU_INFO_STATE, providing the original hypercall service.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Add support for per-CPU statistics

Record VM exits on a per-CPU basis and export this information via the
"CPU Get Info" hypercall.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver: Export cell statistics via sysfs

Provide an accumulation of per-CPU statistics for each cell via sysfs.
This can help analyzing potential performance issues of Jailhouse cells.

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