Due to the way how CPU 0 is offlined on x86, we cannot "steal" it from the root cell and give it to a different owner. Catch any configuration that tries to do so and reject this attempt.
Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> --- driver/cell.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/driver/cell.c b/driver/cell.c index 67edb732..23839812 100644 --- a/driver/cell.c +++ b/driver/cell.c @@ -220,6 +220,19 @@ int jailhouse_cmd_cell_create(struct jailhouse_cell_create __user *arg) /* Off-line each CPU assigned to the new cell and remove it from the * root cell's set. */ for_each_cpu(cpu, &cell->cpus_assigned) { +#ifdef CONFIG_X86 + if (cpu == 0) { + /* + * On x86, Linux only parks CPU 0 when offlining it and + * expects to be able to get it back by sending an IPI. + * This is not support by Jailhouse wich destroys the + * CPU state across non-root assignments. + */ + pr_err("Cannot assign CPU 0 to other cells\n"); + err = -EINVAL; + goto error_cpu_online; + } +#endif if (cpu_online(cpu)) { err = cpu_down(cpu); if (err) -- 2.16.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 jailhouse-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.