On Fri, Feb 01, 2019 at 11:16:41AM +0000, Alexandru Elisei wrote: > On arm and arm64, kvm-unit-tests uses the QEMU chr-testdev device to shut > down the virtual machine at the end of a test. The function > psci_system_off() provides another mechanism for terminating the virtual > machine. > > chr-testdev is implemented on top of virtio console. If the virtual machine > manager doesn't emulate a virtio console, then chr_testdev_exit() will fail. > If this happens, try to use psci_system_off() to terminate the test. > > This patch makes it possible for a virtual machine manager which doesn't > have support for chr-testdev, but has been configured not to emulate a > virtio console, to gracefully terminate a virtual machine after a test has > been completed. > > There is one limitation to using psci_system_off() to terminate a test: > chr-testdev allows kvm-unit-tests to specify an exit code; > psci_system_off() has no such mechanism. > > Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx> > --- > lib/arm/io.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/arm/io.c b/lib/arm/io.c > index 0d5ab9510ec8..bbb93e63fa3d 100644 > --- a/lib/arm/io.c > +++ b/lib/arm/io.c > @@ -12,6 +12,7 @@ > #include <devicetree.h> > #include <chr-testdev.h> > #include <config.h> > +#include <asm/psci.h> > #include <asm/spinlock.h> > #include <asm/io.h> > > @@ -90,6 +91,7 @@ void puts(const char *s) > void exit(int code) > { > chr_testdev_exit(code); > + psci_system_off(); > halt(code); > __builtin_unreachable(); > } > -- > 2.17.0 > Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx> _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm