This patch contains a few general comments in the source code of the core subsystem.
Signed-off-by: Claudio Scordino <[email protected]> --- hypervisor/control.c | 8 ++++++++ hypervisor/include/jailhouse/cell-config.h | 5 +++++ hypervisor/include/jailhouse/header.h | 15 +++++++++++---- hypervisor/paging.c | 2 ++ hypervisor/setup.c | 6 ++++++ 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/hypervisor/control.c b/hypervisor/control.c index bdb8eae..def3b31 100644 --- a/hypervisor/control.c +++ b/hypervisor/control.c @@ -69,6 +69,10 @@ bool cpu_id_valid(unsigned long cpu_id) test_bit(cpu_id, system_cpu_set)); } +/* + * Suspend all CPUs assigned to the cell except the one executing + * the function (if it is in the cell's CPU set) to prevent races. + */ static void cell_suspend(struct cell *cell, struct per_cpu *cpu_data) { unsigned int cpu; @@ -401,6 +405,10 @@ static int cell_create(struct per_cpu *cpu_data, unsigned long config_address) if (err) goto err_cell_exit; + /* + * Shrinking: the new cell's CPUs are parked, then removed from the root + * cell, assigned to the new cell and get their stats cleared. + */ for_each_cpu(cpu, cell->cpu_set) { arch_park_cpu(cpu); diff --git a/hypervisor/include/jailhouse/cell-config.h b/hypervisor/include/jailhouse/cell-config.h index e4d6006..bf86068 100644 --- a/hypervisor/include/jailhouse/cell-config.h +++ b/hypervisor/include/jailhouse/cell-config.h @@ -158,8 +158,13 @@ struct jailhouse_iommu { #define JAILHOUSE_SYSTEM_SIGNATURE "JAILSYST" +/** + * General descriptor of the system. + */ struct jailhouse_system { char signature[8]; + + /** Jailhouse's location in memory */ struct jailhouse_memory hypervisor_memory; struct jailhouse_memory debug_console; union { diff --git a/hypervisor/include/jailhouse/header.h b/hypervisor/include/jailhouse/header.h index 4a4d1cb..54cfab9 100644 --- a/hypervisor/include/jailhouse/header.h +++ b/hypervisor/include/jailhouse/header.h @@ -24,15 +24,22 @@ */ typedef int (*jailhouse_entry)(unsigned int); -/** Hypervisor description. */ +/** + * Hypervisor description. + * Located at the beginning of the hypervisor binary image and loaded by + * the driver (which also initializes some fields). + */ struct jailhouse_header { - /** Signature "JAILHOUS". + /** Signature "JAILHOUS" used for basic validity check of the + * hypervisor image. * @note Filled at build time. */ char signature[8]; - /** Size of hypervisor core, rounded up to page boundary. + /** Size of hypervisor core. + * It starts with the hypervisor's header and ends after its bss + * section. Rounded up to page boundary. * @note Filled at build time. */ unsigned long core_size; - /** Size of per-CPU data structure. + /** Size of the per-CPU data structure. * @note Filled at build time. */ unsigned long percpu_size; /** Entry point (arch_entry()). diff --git a/hypervisor/paging.c b/hypervisor/paging.c index b0f4013..07e6fcd 100644 --- a/hypervisor/paging.c +++ b/hypervisor/paging.c @@ -27,6 +27,8 @@ extern u8 __page_pool[]; /** * Offset between virtual and physical hypervisor addresses. * + * Jailhouse operates in a physically contiguous memory region, + * enabling offset-based address conversion. * @note Private, use page_map_hvirt2phys() or page_map_phys2hvirt() instead. */ unsigned long page_offset; diff --git a/hypervisor/setup.c b/hypervisor/setup.c index b76f845..0e2be9c 100644 --- a/hypervisor/setup.c +++ b/hypervisor/setup.c @@ -152,6 +152,10 @@ static void init_late(void) paging_dump_stats("after late setup"); } +/* + * This is the entry point, called by the Linux driver on each CPU + * when initializing Jailhouse. + */ int entry(unsigned int cpu_id, struct per_cpu *cpu_data) { static volatile bool activate; @@ -162,6 +166,8 @@ int entry(unsigned int cpu_id, struct per_cpu *cpu_data) spin_lock(&init_lock); if (master_cpu_id == -1) { + /* Only the master CPU, the first to enter this + * function, performs system-wide initializations. */ master = true; init_early(cpu_id); } -- 2.7.4 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
