[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCHv6 30/37] plat/kvm: Implement shutdown for Arm64


  • To: <minios-devel@xxxxxxxxxxxxxxxxxxxx>, <simon.kuenzer@xxxxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Fri, 14 Sep 2018 07:57:03 +0000
  • Authentication-results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=bestguesspass action=none header.from=arm.com;
  • Cc: Kaly.Xin@xxxxxxx, nd@xxxxxxx, wei.chen@xxxxxxx
  • Delivery-date: Fri, 14 Sep 2018 07:58:42 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

From: Wei Chen <Wei.Chen@xxxxxxx>

QEMU/KVM provide a PSCI interface for virtual machine on
Arm64 platform. So we use this interface to implement
platform system off function.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
 plat/kvm/shutdown.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/plat/kvm/shutdown.c b/plat/kvm/shutdown.c
index a513df9..474bfb4 100644
--- a/plat/kvm/shutdown.c
+++ b/plat/kvm/shutdown.c
@@ -22,7 +22,8 @@
  */
 
 #include <errno.h>
-#include <x86/cpu.h>
+#include <cpu.h>
+#include <irq.h>
 #include <uk/print.h>
 #include <uk/plat/bootstrap.h>
 
@@ -31,14 +32,10 @@ static void cpu_halt(void) __noreturn;
 /* TODO: implement CPU reset */
 void ukplat_terminate(enum ukplat_gstate request __unused)
 {
-       /*
-        * Poke the QEMU "isa-debug-exit" device to "shutdown". Should be
-        * harmless if it is not present. This is used to enable automated
-        * tests on virtio.  Note that the actual QEMU exit() status will
-        * be 83 ('S', 41 << 1 | 1).
-        */
        uk_printk("Unikraft halted\n");
-       outw(0x501, 41);
+
+       /* Try to make system off */
+       system_off();
 
        /*
         * If we got here, there is no way to initiate "shutdown" on virtio
@@ -49,9 +46,7 @@ void ukplat_terminate(enum ukplat_gstate request __unused)
 
 static void cpu_halt(void)
 {
-       __asm__ __volatile__("cli; hlt");
-       for (;;)
-               ;
+       __CPU_HALT();
 }
 
 int ukplat_suspend(void)
-- 
2.17.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.