That's pretty neat, now we don't need to worry about the broken PSCI on the Seattle board as much :) And it simplifies the arch ports as well. I like this approach.
Cheers, Tony On 31-Jul-16 10:39, Jan Kiszka wrote: > From: Jan Kiszka <jan.kis...@siemens.com> > > The hypervisor's disable function will lose support for destroying > non-root cells along with the shutdown. Prepare for this by performing > an explicit non-root cell destruction prior to calling the shutdown > command. > > Signed-off-by: Jan Kiszka <jan.kis...@siemens.com> > --- > driver/cell.c | 76 > +++++++++++++++++++++++++++++++++-------------------------- > driver/cell.h | 6 ++--- > driver/main.c | 8 +++++-- > 3 files changed, 51 insertions(+), 39 deletions(-) > > diff --git a/driver/cell.c b/driver/cell.c > index 8ec7165..fcd9426 100644 > --- a/driver/cell.c > +++ b/driver/cell.c > @@ -1,7 +1,7 @@ > /* > * Jailhouse, a Linux-based partitioning hypervisor > * > - * Copyright (c) Siemens AG, 2013-2015 > + * Copyright (c) Siemens AG, 2013-2016 > * > * Authors: > * Jan Kiszka <jan.kis...@siemens.com> > @@ -129,29 +129,10 @@ void jailhouse_cell_register_root(void) > > void jailhouse_cell_delete_root(void) > { > - cell_delete(root_cell); > -} > - > -void jailhouse_cell_delete_all(void) > -{ > - struct cell *cell, *tmp; > - unsigned int cpu; > - > jailhouse_pci_do_all_devices(root_cell, JAILHOUSE_PCI_TYPE_IVSHMEM, > JAILHOUSE_PCI_ACTION_DEL); > > - jailhouse_pci_do_all_devices(root_cell, JAILHOUSE_PCI_TYPE_DEVICE, > - JAILHOUSE_PCI_ACTION_RELEASE); > - > - list_for_each_entry_safe(cell, tmp, &cells, entry) > - jailhouse_cell_delete(cell); > - > - for_each_cpu(cpu, &offlined_cpus) { > - if (cpu_up(cpu) != 0) > - pr_err("Jailhouse: failed to bring CPU %d back " > - "online\n", cpu); > - cpumask_clear_cpu(cpu, &offlined_cpus); > - } > + cell_delete(root_cell); > } > > int jailhouse_cmd_cell_create(struct jailhouse_cell_create __user *arg) > @@ -389,23 +370,14 @@ int jailhouse_cmd_cell_start(const char __user *arg) > return err; > } > > -int jailhouse_cmd_cell_destroy(const char __user *arg) > +static int cell_destroy(struct cell *cell) > { > - struct jailhouse_cell_id cell_id; > - struct cell *cell; > unsigned int cpu; > int err; > > - if (copy_from_user(&cell_id, arg, sizeof(cell_id))) > - return -EFAULT; > - > - err = cell_management_prologue(&cell_id, &cell); > - if (err) > - return err; > - > err = jailhouse_call_arg1(JAILHOUSE_HC_CELL_DESTROY, cell->id); > if (err) > - goto unlock_out; > + return err; > > for_each_cpu(cpu, &cell->cpus_assigned) { > if (cpumask_test_cpu(cpu, &offlined_cpus)) { > @@ -423,10 +395,46 @@ int jailhouse_cmd_cell_destroy(const char __user *arg) > pr_info("Destroyed Jailhouse cell \"%s\"\n", > kobject_name(&cell->kobj)); > > - jailhouse_cell_delete(cell); > + cell_delete(cell); > + > + return 0; > +} > + > +int jailhouse_cmd_cell_destroy(const char __user *arg) > +{ > + struct jailhouse_cell_id cell_id; > + struct cell *cell; > + int err; > + > + if (copy_from_user(&cell_id, arg, sizeof(cell_id))) > + return -EFAULT; > + > + err = cell_management_prologue(&cell_id, &cell); > + if (err) > + return err; > + > + err = cell_destroy(cell); > > -unlock_out: > mutex_unlock(&jailhouse_lock); > > return err; > } > + > +int jailhouse_cmd_cell_destroy_non_root(void) > +{ > + struct cell *cell, *tmp; > + int err; > + > + list_for_each_entry_safe(cell, tmp, &cells, entry) { > + if (cell == root_cell) > + continue; > + err = cell_destroy(cell); > + if (err) { > + pr_err("Jailhouse: failed to destroy cell \"%s\"\n", > + kobject_name(&cell->kobj)); > + return err; > + } > + } > + > + return 0; > +} > diff --git a/driver/cell.h b/driver/cell.h > index db8a11a..649cca0 100644 > --- a/driver/cell.h > +++ b/driver/cell.h > @@ -1,7 +1,7 @@ > /* > * Jailhouse, a Linux-based partitioning hypervisor > * > - * Copyright (c) Siemens AG, 2014-2015 > + * Copyright (c) Siemens AG, 2014-2016 > * > * Authors: > * Jan Kiszka <jan.kis...@siemens.com> > @@ -43,11 +43,11 @@ int jailhouse_cell_prepare_root(const struct > jailhouse_cell_desc *cell_desc); > void jailhouse_cell_register_root(void); > void jailhouse_cell_delete_root(void); > > -void jailhouse_cell_delete_all(void); > - > int jailhouse_cmd_cell_create(struct jailhouse_cell_create __user *arg); > int jailhouse_cmd_cell_load(struct jailhouse_cell_load __user *arg); > int jailhouse_cmd_cell_start(const char __user *arg); > int jailhouse_cmd_cell_destroy(const char __user *arg); > > +int jailhouse_cmd_cell_destroy_non_root(void); > + > #endif /* !_JAILHOUSE_DRIVER_CELL_H */ > diff --git a/driver/main.c b/driver/main.c > index 13154e6..0a76e18 100644 > --- a/driver/main.c > +++ b/driver/main.c > @@ -1,7 +1,7 @@ > /* > * Jailhouse, a Linux-based partitioning hypervisor > * > - * Copyright (c) Siemens AG, 2013-2015 > + * Copyright (c) Siemens AG, 2013-2016 > * Copyright (c) Valentine Sinitsyn, 2014 > * > * Authors: > @@ -387,6 +387,10 @@ static int jailhouse_cmd_disable(void) > goto unlock_out; > } > > + err = jailhouse_cmd_cell_destroy_non_root(); > + if (err) > + goto unlock_out; > + > error_code = 0; > > preempt_disable(); > @@ -416,7 +420,7 @@ static int jailhouse_cmd_disable(void) > > vunmap(hypervisor_mem); > > - jailhouse_cell_delete_all(); > + jailhouse_cell_delete_root(); > jailhouse_enabled = false; > module_put(THIS_MODULE); > > -- Antonios Motakis Virtualization Engineer Huawei Technologies Duesseldorf GmbH European Research Center Riesstrasse 25, 80992 München -- 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.