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

[Xen-changelog] [xen master] xen/arm: Use PSCI-0.2 for machine_halt/restart by default



commit e456d46ce0e17f88c0fcebea75b02d931bddcb9a
Author:     Suravee Suthikulpanit <Suravee.Suthikulpanit@xxxxxxx>
AuthorDate: Fri Oct 3 09:31:11 2014 -0500
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Tue Oct 14 10:19:39 2014 +0100

    xen/arm: Use PSCI-0.2 for machine_halt/restart by default
    
    "machine_halt()" and "machine_restart()" are modified to use PSCI interface
    by default if PSCI-0.2 is supported. The "raw_machine_reset()" is also 
removed
    since this is unnecessary.
    
    Also, machine_halt() is modified to add 10ms delay to make sure all 
auxiliary CPUs
    are offlined before calling the shutdown.
    
    For non-PSCI, platform_poweroff() and platform_reset() are used instead.
    
    Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@xxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/arch/arm/shutdown.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c
index adc0529..4988b03 100644
--- a/xen/arch/arm/shutdown.c
+++ b/xen/arch/arm/shutdown.c
@@ -5,11 +5,7 @@
 #include <xen/lib.h>
 #include <xen/smp.h>
 #include <asm/platform.h>
-
-static void raw_machine_reset(void)
-{
-    platform_reset();
-}
+#include <asm/psci.h>
 
 static void noreturn halt_this_cpu(void *arg)
 {
@@ -18,10 +14,23 @@ static void noreturn halt_this_cpu(void *arg)
 
 void machine_halt(void)
 {
+    int timeout = 10;
+
     watchdog_disable();
     console_start_sync();
     local_irq_enable();
     smp_call_function(halt_this_cpu, NULL, 0);
+    local_irq_disable();
+
+    /* Wait at most another 10ms for all other CPUs to go offline. */
+    while ( (num_online_cpus() > 1) && (timeout-- > 0) )
+        mdelay(1);
+
+    /* This is mainly for PSCI-0.2, which does not return if success. */
+    call_psci_system_off();
+
+    /* Alternative halt procedure */
+    platform_poweroff();
     halt_this_cpu(NULL);
 }
 
@@ -39,9 +48,13 @@ void machine_restart(unsigned int delay_millisecs)
     while ( (num_online_cpus() > 1) && (timeout-- > 0) )
         mdelay(1);
 
+    /* This is mainly for PSCI-0.2, which does not return if success. */
+    call_psci_system_reset();
+
+    /* Alternative reset procedure */
     while ( 1 )
     {
-        raw_machine_reset();
+        platform_reset();
         mdelay(100);
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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