Skip to contentSkip to conversation

Introduce PSCI-0.2 supports

PATCH Superseded [email protected] 4 participants 14 messages Oct 1, 2014 – Oct 3, 2014

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Introduce PSCI-0.2 supports

From: Suravee Suthikulpanit <[email protected]>

This patch series introduce PSCI-0.2 supports for:
* PSCI_VERSION
* CPU_ON
* SYSTEM_OFF
* SYSTEM_RESET

Then, it modifies the shutdown/restart logic to use PSCI-0.2 interface by default when available.

Suravee Suthikulpanit (2):
xen/arm: Initial support for PSCI-0.2 (cpu_on, system_off,
system_reset)
xen/arm: Use PSCI-0.2 for machine_halt/restart by default

 xen/arch/arm/arm64/smpboot.c |  2 +-
 xen/arch/arm/platform.c      |  2 +-
 xen/arch/arm/psci.c          | 72 +++++++++++++++++++++++++++++++++++++++-----
 xen/arch/arm/shutdown.c      | 23 ++++++++++----
 xen/include/asm-arm/psci.h   |  4 ++-
 5 files changed, 86 insertions(+), 17 deletions(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/2 xen/arm: Initial support for PSCI-0.2

From: Suravee Suthikulpanit <[email protected]>

This patch adds support for PSCI-0.2 PSCI_VERSION, CPU_ON, SYSTEM_OFF, and SYSTEM_RESET functions.

For PSCI-0.2, the new DT binding "arm,psci-0.2" is used for matching. The psci_init() is now refactored to handle both PSCI-0.1 and PSCI-0.2.

Also, to add support for PSCI_VERSION, this patch replaces the "bool_t psci_available" variable with "int psci_ver", which contains the PSCI_VERSION as described in the PSCI-0.2 spec. For v0.1, this psci_ver is 1.

---
 xen/arch/arm/arm64/smpboot.c |  2 +-
 xen/arch/arm/platform.c      |  2 +-
 xen/arch/arm/psci.c          | 72 +++++++++++++++++++++++++++++++++++++++-----
 xen/include/asm-arm/psci.h   |  4 ++-
 4 files changed, 69 insertions(+), 11 deletions(-)
xen/arch/arm/arm64/smpboot.c +1 -1
index 9146476..341cc77 100644
@@ -54,7 +54,7 @@ static void __init smp_spin_table_init(int cpu, struct dt_device_node *dn)
 
 static int __init smp_psci_init(int cpu)
 {
-    if ( !psci_available )
+    if ( !psci_ver )
     {
         printk("CPU%d asks for PSCI, but DTB has no PSCI node\n", cpu);
         return -ENODEV;
xen/arch/arm/platform.c +1 -1
index 74c3328..cb4cda8 100644
@@ -110,7 +110,7 @@ int __init platform_specific_mapping(struct domain *d)
 #ifdef CONFIG_ARM_32
 int __init platform_cpu_up(int cpu)
 {
-    if ( psci_available )
+    if ( psci_ver )
         return call_psci_cpu_on(cpu);
 
     if ( platform && platform->cpu_up )
xen/arch/arm/psci.c +64 -8

106 lines not on this page · raw message

xen/include/asm-arm/psci.h +3 -1
index 9777c03..ab37984 100644
@@ -13,10 +13,12 @@
 #define PSCI_DISABLED               -8
 
 /* availability of PSCI on the host for SMP bringup */
-extern bool_t psci_available;
+extern int psci_ver;
 
 int psci_init(void);
 int call_psci_cpu_on(int cpu);
+void call_psci_system_off(void);
+void call_psci_system_reset(void);
 
 /* functions to handle guest PSCI requests */
 int32_t do_psci_cpu_on(uint32_t vcpuid, register_t entry_point);
Signature · 1 line
1.9.3
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] xen/arm: Initial support for PSCI-0.2

Quoted 5 lines · On Wed, 1 Oct 2014, [email protected] wrote:

From: Suravee Suthikulpanit <[email protected]>

This patch adds support for PSCI-0.2 PSCI_VERSION, CPU_ON, SYSTEM_OFF, and SYSTEM_RESET functions.

Quoted 8 lines

For PSCI-0.2, the new DT binding "arm,psci-0.2" is used for matching. The psci_init() is now refactored to handle both PSCI-0.1 and PSCI-0.2.

Also, to add support for PSCI_VERSION, this patch replaces the "bool_t psci_available" variable with "int psci_ver", which contains the PSCI_VERSION as described in the PSCI-0.2 spec. For v0.1, this psci_ver is 1.

The support to PSCI 0.2 added by this patch is a bit incomplete, but on the other hand the patch is very simple so it might just be the only thing we can actually accept for this release.

Quoted 166 lines
 xen/arch/arm/arm64/smpboot.c |  2 +-
 xen/arch/arm/platform.c      |  2 +-
 xen/arch/arm/psci.c          | 72 +++++++++++++++++++++++++++++++++++++++-----
 xen/include/asm-arm/psci.h   |  4 ++-
 4 files changed, 69 insertions(+), 11 deletions(-)
xen/arch/arm/arm64/smpboot.c +1 -1
index 9146476..341cc77 100644
@@ -54,7 +54,7 @@ static void __init smp_spin_table_init(int cpu, struct dt_device_node *dn)
 
 static int __init smp_psci_init(int cpu)
 {
-    if ( !psci_available )
+    if ( !psci_ver )
     {
         printk("CPU%d asks for PSCI, but DTB has no PSCI node\n", cpu);
         return -ENODEV;
xen/arch/arm/platform.c +1 -1
index 74c3328..cb4cda8 100644
@@ -110,7 +110,7 @@ int __init platform_specific_mapping(struct domain *d)
 #ifdef CONFIG_ARM_32
 int __init platform_cpu_up(int cpu)
 {
-    if ( psci_available )
+    if ( psci_ver )
         return call_psci_cpu_on(cpu);
 
     if ( platform && platform->cpu_up )
xen/arch/arm/psci.c +64 -8
index b6360d5..874917e 100644
@@ -23,7 +23,7 @@
 #include <xen/smp.h>
 #include <asm/psci.h>
 
-bool_t psci_available;
+int psci_ver;
 
 #ifdef CONFIG_ARM_32
 #define REG_PREFIX "r"
@@ -58,16 +58,23 @@ int call_psci_cpu_on(int cpu)
                                 cpu_logical_map(cpu), __pa(init_secondary), 0);
 }
 
-int __init psci_init(void)
+void call_psci_system_off(void)
+{
+    if ( psci_ver > 2 )
+        __invoke_psci_fn_smc(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
+}
+
+void call_psci_system_reset(void)
+{
+    if ( psci_ver > 2 )
+        __invoke_psci_fn_smc(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
+}
+
+int __init psci_is_smc_method(const struct dt_device_node *psci)
 {
-    const struct dt_device_node *psci;
     int ret;
     const char *prop_str;
 
-    psci = dt_find_compatible_node(NULL, NULL, "arm,psci");
-    if ( !psci )
-        return -ENODEV;
-
     ret = dt_property_read_string(psci, "method", &prop_str);
     if ( ret )
     {
@@ -85,19 +92,68 @@ int __init psci_init(void)
         return -EINVAL;
     }
 
+    return 0;
+}
+
+int __init psci_init_0_1(const struct dt_device_node *psci)
+{
+    int ret;
+
+    ret = psci_is_smc_method(psci);
+    if ( ret )
+        return -EINVAL;
+
     if ( !dt_property_read_u32(psci, "cpu_on", &psci_cpu_on_nr) )
     {
         printk("/psci node is missing the \"cpu_on\" property\n");
         return -ENOENT;
     }
 
-    psci_available = 1;
+    psci_ver = 1;
 
     printk(XENLOG_INFO "Using PSCI for SMP bringup\n");
 
     return 0;
 }
 
+int __init psci_init_0_2(const struct dt_device_node *psci)
+{
+    int ret;
+
+    ret = psci_is_smc_method(psci);
+    if ( ret )
+        return -EINVAL;
+
+    psci_ver = __invoke_psci_fn_smc(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0);
+
+    if ( psci_ver != 2 )
+    {
+        printk("Error: The retrieved PSCI version (%#x) does not support.\n", psci_ver);
+        return -EOPNOTSUPP;
+    }
+
+    psci_cpu_on_nr = PSCI_0_2_FN_CPU_ON;
+
+    printk(XENLOG_INFO "Using PSCI-0.2 for SMP bringup\n");
+
+    return 0;
+}
+
+int __init psci_init(void)
+{
+    const struct dt_device_node *psci;
+
+    psci = dt_find_compatible_node(NULL, NULL, "arm,psci");
+    if ( psci )
+        return psci_init_0_1(psci);
+
+    psci = dt_find_compatible_node(NULL, NULL, "arm,psci-0.2");
+    if ( psci )
+        return psci_init_0_2(psci);
+
+    return -ENODEV;
+}
+
 /*
  * Local variables:
  * mode: C
xen/include/asm-arm/psci.h +3 -1
index 9777c03..ab37984 100644
@@ -13,10 +13,12 @@
 #define PSCI_DISABLED               -8
 
 /* availability of PSCI on the host for SMP bringup */
-extern bool_t psci_available;
+extern int psci_ver;
 
 int psci_init(void);
 int call_psci_cpu_on(int cpu);
+void call_psci_system_off(void);
+void call_psci_system_reset(void);
 
 /* functions to handle guest PSCI requests */
 int32_t do_psci_cpu_on(uint32_t vcpuid, register_t entry_point);
Signature · 1 line
1.9.3
#3 lore raw

Re: [PATCH 1/2] xen/arm: Initial support for PSCI-0.2

In reply to [email protected]

Hi Suravee,

Quoted 8 lines · On 10/01/2014 09:02 PM, [email protected] wrote:
xen/arch/arm/psci.c +8 -0
+int __init psci_init_0_1(const struct dt_device_node *psci)
+{
+    int ret;
+
+    ret = psci_is_smc_method(psci);
+    if ( ret )
+        return -EINVAL;
+

xen/arch/arm/psci.c int __init psci_init(void) · line 114

Quoted 10 lines
xen/arch/arm/psci.c +1 -1
     if ( !dt_property_read_u32(psci, "cpu_on", &psci_cpu_on_nr) )
     {
         printk("/psci node is missing the \"cpu_on\" property\n");
         return -ENOENT;
     }
 
-    psci_available = 1;
+    psci_ver = 1;
 
     printk(XENLOG_INFO "Using PSCI for SMP bringup\n");

I would modify this printk into "Using PSCI 0.1...".

Quoted 7 lines
 
     return 0;

}

xen/arch/arm/psci.c +3 -0
+int __init psci_init_0_2(const struct dt_device_node *psci)
+{
+    int ret;

xen/arch/arm/psci.c int __init psci_init(void) · line 131

Quoted 10 lines
xen/arch/arm/psci.c +10 -0
+
+    ret = psci_is_smc_method(psci);
+    if ( ret )
+        return -EINVAL;
+
+    psci_ver = __invoke_psci_fn_smc(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0);
+
+    if ( psci_ver != 2 )
+    {
+        printk("Error: The retrieved PSCI version (%#x) does not support.\n", psci_ver);

NIT: s/does/is/ ?

Quoted 12 lines
xen/arch/arm/psci.c +12 -0
+        return -EOPNOTSUPP;
+    }
+
+    psci_cpu_on_nr = PSCI_0_2_FN_CPU_ON;
+
+    printk(XENLOG_INFO "Using PSCI-0.2 for SMP bringup\n");
+
+    return 0;
+}
+
+int __init psci_init(void)
+{

xen/arch/arm/psci.c int __init psci_init(void) · line 153

Quoted 10 lines
xen/arch/arm/psci.c +10 -0
+    const struct dt_device_node *psci;
+
+    psci = dt_find_compatible_node(NULL, NULL, "arm,psci");
+    if ( psci )
+        return psci_init_0_1(psci);
+
+    psci = dt_find_compatible_node(NULL, NULL, "arm,psci-0.2");
+    if ( psci )
+        return psci_init_0_2(psci);
+

I think we need to prefer PSCI 0.2 if the platform supports the both version of PSCI.

Quoted 11 lines
xen/arch/arm/psci.c +3 -0
+    return -ENODEV;
+}
+
 /*
  * Local variables:
  * mode: C
xen/include/asm-arm/psci.h +0 -0
index 9777c03..ab37984 100644

xen/include/asm-arm/psci.h line 16

Quoted 5 lines
xen/include/asm-arm/psci.h +1 -1
@@ -13,10 +13,12 @@
 #define PSCI_DISABLED               -8
 
 /* availability of PSCI on the host for SMP bringup */
-extern bool_t psci_available;
+extern int psci_ver;

I would use unsigned int here, or even better an enum to describe the different version of PSCI.

Regards,

Signature · 1 line
Julien Grall
#4 lore raw

Re: [PATCH 1/2] xen/arm: Initial support for PSCI-0.2

Quoted 5 lines · Julien Grall

xen/arch/arm/psci.c int __init psci_init(void) · line 131

Quoted 3 lines
xen/arch/arm/psci.c +3 -0
+    if ( psci_ver != 2 )
+    {
+        printk("Error: The retrieved PSCI version (%#x) does not support.\n", psci_ver);

NIT: s/does/is/ ?

along with "supported", yes. I'd probably simplify it to "PSCI version % #x is not supported".

Quoted 18 lines
Quoted 18 lines
xen/arch/arm/psci.c +17 -0
+        return -EOPNOTSUPP;
+    }
+
+    psci_cpu_on_nr = PSCI_0_2_FN_CPU_ON;
+
+    printk(XENLOG_INFO "Using PSCI-0.2 for SMP bringup\n");
+
+    return 0;
+}
+
+int __init psci_init(void)
+{
+    const struct dt_device_node *psci;
+
+    psci = dt_find_compatible_node(NULL, NULL, "arm,psci");
+    if ( psci )
+        return psci_init_0_1(psci);
Quoted 8 lines

xen/arch/arm/psci.c int __init psci_init(void) · line 153

Quoted 5 lines
xen/arch/arm/psci.c +5 -0
+
+    psci = dt_find_compatible_node(NULL, NULL, "arm,psci-0.2");
+    if ( psci )
+        return psci_init_0_2(psci);
+

I think we need to prefer PSCI 0.2 if the platform supports the both version of PSCI.

Yes, please.

This may require also falling back to 0.1 if psci_init_0_2 fails?

Quoted 13 lines
Quoted 13 lines
xen/arch/arm/psci.c +3 -0
+    return -ENODEV;
+}
+
 /*
  * Local variables:
  * mode: C
xen/include/asm-arm/psci.h +0 -0
index 9777c03..ab37984 100644
@@ -13,10 +13,12 @@
 #define PSCI_DISABLED               -8
 
Quoted 6 lines

xen/include/asm-arm/psci.h line 16

Quoted 3 lines
xen/include/asm-arm/psci.h +1 -1
 /* availability of PSCI on the host for SMP bringup */
-extern bool_t psci_available;
+extern int psci_ver;

I would use unsigned int here, or even better an enum to describe the different version of PSCI.

unsigned, to match the psci spec, would be sufficient. The code should also use the existing XEN_PSCI_V_0_1 and XEN_PSCI_V_0_2 where appropriate.

Ian.

#5 lore raw

Re: [PATCH 1/2] xen/arm: Initial support for PSCI-0.2

Quoted 15 lines · Ian Campbell
Quoted 15 lines
Quoted 15 lines

+int __init psci_init(void)

Quoted 11 lines

xen/arch/arm/psci.c int __init psci_init(void) · line 153

Quoted 11 lines
xen/arch/arm/psci.c +11 -0
+{
+    const struct dt_device_node *psci;
+
+    psci = dt_find_compatible_node(NULL, NULL, "arm,psci");
+    if ( psci )
+        return psci_init_0_1(psci);
+
+    psci = dt_find_compatible_node(NULL, NULL, "arm,psci-0.2");
+    if ( psci )
+        return psci_init_0_2(psci);
+

I think we need to prefer PSCI 0.2 if the platform supports the both version of PSCI.

Quoted 4 lines

Yes, please.

This may require also falling back to 0.1 if psci_init_0_2 fails?

Good point. I just realized that DT could have:

compatible = "arm,psci-0.2", "arm,psci"

Suravee

#6 lore raw

Re: [PATCH 1/2] xen/arm: Initial support for PSCI-0.2

In reply to [email protected]

xen/arch/arm/psci.c int call_psci_cpu_on(int cpu) · line 63

Quoted 4 lines · On Wed, 2014-10-01 at 15:02 -0500, [email protected] wrote:
xen/arch/arm/psci.c +3 -1
-int __init psci_init(void)
+void call_psci_system_off(void)
+{
+    if ( psci_ver > 2 )

Doesn't this need to be >= to do anything on a 0.2 system? (Likewise in the fn below)

Quoted 1 line

+ __invoke_psci_fn_smc(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);

Should we print a message in the case that we aren't able to call the 0.2 handler? (again, likewise below)

Quoted 1 line

+}

Ian.

#7 lore raw

Re: [PATCH 1/2] xen/arm: Initial support for PSCI-0.2

Quoted 8 lines · Ian Campbell

xen/arch/arm/psci.c int call_psci_cpu_on(int cpu) · line 63

Quoted 4 lines · On Wed, 2014-10-01 at 15:02 -0500, [email protected] wrote:
xen/arch/arm/psci.c +3 -1
-int __init psci_init(void)
+void call_psci_system_off(void)
+{
+    if ( psci_ver > 2 )

Doesn't this need to be >= to do anything on a 0.2 system? (Likewise in the fn below)

Ah yes. Thanks.

Quoted 6 lines
Quoted 2 lines

+ __invoke_psci_fn_smc(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);

Should we print a message in the case that we aren't able to call the 0.2 handler? (again, likewise below)

I feel that this will be too verbose for the PSCI-0.1 case since this function always get called in the arch/arm/shutdown.c

Suravee

#8 lore raw

PATCH 2/2 xen/arm: Use PSCI-0.2 for machine_halt/restart by default

In reply to [email protected]

From: Suravee Suthikulpanit <[email protected]>

"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.

For non-PSCI, platform_poweroff() and platform_reset() are used instead.

---
 xen/arch/arm/shutdown.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
xen/arch/arm/shutdown.c +17 -6
index adc0529..2289ad1 100644
@@ -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,22 @@ 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);
+
+    /* Not return if success */
+    call_psci_system_off();
+
+    platform_poweroff();
     halt_this_cpu(NULL);
 }
 
@@ -39,9 +47,12 @@ void machine_restart(unsigned int delay_millisecs)
     while ( (num_online_cpus() > 1) && (timeout-- > 0) )
         mdelay(1);
 
+    /* Not return if success */
+    call_psci_system_reset();
+
     while ( 1 )
     {
-        raw_machine_reset();
+        platform_reset();
         mdelay(100);
     }
 }
Signature · 1 line
1.9.3
Acked-by on v1 2/2
#9 lore raw

Re: [PATCH 2/2] xen/arm: Use PSCI-0.2 for machine_halt/restart by default

Quoted 9 lines · On Wed, 1 Oct 2014, [email protected] wrote:

From: Suravee Suthikulpanit <[email protected]>

"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.

For non-PSCI, platform_poweroff() and platform_reset() are used instead.

Quoted 60 lines
 xen/arch/arm/shutdown.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
xen/arch/arm/shutdown.c +17 -6
index adc0529..2289ad1 100644
@@ -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,22 @@ 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);
+
+    /* Not return if success */
+    call_psci_system_off();
+
+    platform_poweroff();
     halt_this_cpu(NULL);
 }
 
@@ -39,9 +47,12 @@ void machine_restart(unsigned int delay_millisecs)
     while ( (num_online_cpus() > 1) && (timeout-- > 0) )
         mdelay(1);
 
+    /* Not return if success */
+    call_psci_system_reset();
+
     while ( 1 )
     {
-        raw_machine_reset();
+        platform_reset();
         mdelay(100);
     }
 }
Signature · 1 line
1.9.3
#10 lore raw

Re: [PATCH 2/2] xen/arm: Use PSCI-0.2 for machine_halt/restart by default

In reply to [email protected]

Hi Suravee,

Quoted 4 lines · On 10/01/2014 09:02 PM, [email protected] wrote:

void machine_halt(void)
{

xen/arch/arm/shutdown.c +2 -0
+    int timeout = 10;
+

xen/arch/arm/shutdown.c static void noreturn halt_this_cpu(void *arg) · line 28

Quoted 10 lines
xen/arch/arm/shutdown.c +6 -0
     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 doesn't look like PSCI specific. Can you explain in the commit message why you need to add this new block of code?

Regards,

Signature · 1 line
Julien Grall
#11 lore raw

Re: [PATCH 2/2] xen/arm: Use PSCI-0.2 for machine_halt/restart by default

Quoted 21 lines · Julien Grall

Hi Suravee,

Quoted 4 lines · On 10/01/2014 09:02 PM, [email protected] wrote:
  void machine_halt(void)
  {
xen/arch/arm/shutdown.c +2 -0
+    int timeout = 10;
+

xen/arch/arm/shutdown.c static void noreturn halt_this_cpu(void *arg) · line 28

Quoted 10 lines
xen/arch/arm/shutdown.c +6 -0
      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 doesn't look like PSCI specific. Can you explain in the commit message why you need to add this new block of code?

Quoted 2 lines

Regards,

It's not PSCI specific. I was just trying to handle the graceful shutdown similar to the code flow in machine_restart. If you think it's not necessary, I can take this out.

Suravee

#12 lore raw

Re: [PATCH 2/2] xen/arm: Use PSCI-0.2 for machine_halt/restart by default

Quoted 24 lines · Suravee Suthikulpanit
Quoted 21 lines · Julien Grall

Hi Suravee,

Quoted 4 lines · On 10/01/2014 09:02 PM, [email protected] wrote:
  void machine_halt(void)
  {
xen/arch/arm/shutdown.c +2 -0
+    int timeout = 10;
+

xen/arch/arm/shutdown.c static void noreturn halt_this_cpu(void *arg) · line 28

Quoted 10 lines
xen/arch/arm/shutdown.c +6 -0
      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 doesn't look like PSCI specific. Can you explain in the commit message why you need to add this new block of code?

Quoted 6 lines
Quoted 2 lines

Regards,

It's not PSCI specific. I was just trying to handle the graceful shutdown similar to the code flow in machine_restart. If you think it's not necessary, I can take this out.

I'm fine with keeping this code in the patch. I was requesting to specify in the commit message that you are adding this code for...

Regards,

Signature · 1 line
Julien Grall
#13 lore raw

Re: [PATCH 2/2] xen/arm: Use PSCI-0.2 for machine_halt/restart by default

Quoted 30 lines · Julien Grall
Quoted 27 lines · Suravee Suthikulpanit
Quoted 23 lines · Julien Grall

Hi Suravee,

Quoted 4 lines · On 10/01/2014 09:02 PM, [email protected] wrote:
  void machine_halt(void)
  {
xen/arch/arm/shutdown.c +2 -0
+    int timeout = 10;
+

xen/arch/arm/shutdown.c static void noreturn halt_this_cpu(void *arg) · line 28

Quoted 10 lines
xen/arch/arm/shutdown.c +6 -0
      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 doesn't look like PSCI specific. Can you explain in the commit message why you need to add this new block of code?

Regards,

Quoted 10 lines
Quoted 3 lines

It's not PSCI specific. I was just trying to handle the graceful shutdown similar to the code flow in machine_restart. If you think it's not necessary, I can take this out.

I'm fine with keeping this code in the patch. I was requesting to specify in the commit message that you are adding this code for...

Regards,

Ok, I'll resend w/ the update commit message.

Thanks,

Suravee