If Linux has some of the CPUs offlined itself, i.e. not for passing them
to other cells, and we disable the hypervisor then, those CPUs will not
be released. Attempts to online them again later on will fail. Reject
disable requests in such a case.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
#include <jailhouse/hypercall.h>
+struct cell *root_cell;
+
static LIST_HEAD(cells);
-static struct cell *root_cell;
static cpumask_t offlined_cpus;
void jailhouse_cell_kobj_release(struct kobject *kobj)
#endif /* CONFIG_PCI */
};
+extern struct cell *root_cell;
+
void jailhouse_cell_kobj_release(struct kobject *kobj);
struct cell *
preempt_disable();
+ if (num_online_cpus() != cpumask_weight(&root_cell->cpus_assigned)) {
+ /*
+ * Not all assigned CPUs are currently online. If we disable
+ * now, we will loose the offlined ones.
+ */
+
+ preempt_enable();
+
+ err = -EBUSY;
+ goto unlock_out;
+ }
+
atomic_set(&call_done, 0);
on_each_cpu(leave_hypervisor, NULL, 0);
while (atomic_read(&call_done) != num_online_cpus())