driver: Export "hypervisor enabled" state via sysfs

This starts sysfs support for Jailhouse by exporting the enabled state
via the management device's sysfs directory (/sys/devices/jailhouse).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver: Avoid local variable name "cell"

Rename local variables cell to cell_params. We are about to call some
other object "cell". No functional changes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver: Reorder error path of jailhouse_cell_create

We will add more rollback code that is executed errors. This step avoids
that all the rollback calls need to be guarded by "if (err)".

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver: Track all active cells

Create a kobject for every existing cell, including the root cell, and
add it to sysfs. This will allow to export state information etc. about
active cells later on and to maintain additional data over the lifetime
of a cell in the driver.

Moreover, we can now avoid trying to create a cell twice. This only
triggers a memory access violation when writing to the reserved memory
of the existing cell, effectively offlining the Linux CPU that tries it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core: Introduce and use for_each_cell

Encapsulate the common pattern to iterate over all cells.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core/driver: Switch to ID-based cell addressing scheme

Return the cell ID on cell creation and request this ID instead of the
cell name for destruction. Will also help to keep future per-cell
hypercalls simple.

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

Only one user remaining, so it's simpler to merge it into its caller.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Documentation: Update and extend interface descriptions

First of all, introduce a glossary for key terms used in the Jailhouse
docs. It introduces the new terms "root cell" and "non-root cell". Then
extend and refactor the hypervisor interface descriptions, specifically
adding hypercalls for obtaining some basic diagnostic data. This data is
supposed to be exposed by the driver via sysfs. Start documenting its
structure.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver: Start exporting cell attributes via sysfs

Expose the cell ID via sysfs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
core/x86: Provide "Cell Get State" hypercall

Implement the hypercall to retrieve the cell state. This is based on the
information the cell provides via its communication page (as long as it
is alive). So the value may be corrupt, and we need to check it before
returning it to the caller.

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

Make use of "Cell Get State" hypercall to export the cell state via its
sysfs directory.

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