Introduce PSCI-0.2 supports
v2 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.
Note: This probably do not need to target the 4.5 release.
Changes in V2:
* 1/2:
- Use "uint32_t" instead of "int" for psci_ver. (Julien, Ian)
- In psci_init(), modify logic to first try PSCI-0.2, and fallback to 0.1 when not supports (Julien, Ian).
- Fix call_psci_system_off() and psci_system_reset()
- Rewording of error messages (Julien, Ian)
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 | 80 +++++++++++++++++++++++++++++++++++++++----- xen/arch/arm/shutdown.c | 25 ++++++++++---- xen/include/asm-arm/psci.h | 4 ++- 5 files changed, 95 insertions(+), 18 deletions(-)
Signature · 1 line
1.9.3
PATCH v2 1/2 xen/arm: Initial support for PSCI-0.2 (cpu_on, system_off, system_reset)
From: Suravee Suthikulpanit <[email protected]>
This patch adds SMC calls to suport PSCI-0.2:
* PSCI_VERSION
* CPU_ON
* SYSTEM_OFF
* SYSTEM_RESET
First, the psci_init() is refactored to handle both PSCI-0.1 and PSCI-0.2.
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 | 80 +++++++++++++++++++++++++++++++++++++++----- xen/include/asm-arm/psci.h | 4 ++- 4 files changed, 76 insertions(+), 12 deletions(-)
xen/arch/arm/arm64/smpboot.c +1 -1
@@ -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
@@ -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 +71 -9
113 lines not on this page · raw message
xen/include/asm-arm/psci.h +3 -1
@@ -13,10 +13,12 @@#define PSCI_DISABLED -8/* availability of PSCI on the host for SMP bringup */ -extern bool_t psci_available; +extern uint32_t 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
Re: [V2 1/2] xen/arm: Initial support for PSCI-0.2 (cpu_on, system_off, system_reset)
Hi Suravee,
Quoted 3 lines · On 10/02/2014 10:29 PM, [email protected] wrote:
From: Suravee Suthikulpanit <[email protected]>
This patch adds SMC calls to suport PSCI-0.2:
s/suport/support/
Quoted 5 lines
*
PSCI_VERSION
*CPU_ON
*SYSTEM_OFF
*SYSTEM_RESET
Quoted 7 lines
First, the
psci_init()is refactored to handle both PSCI-0.1 and PSCI-0.2.To add support for
PSCI_VERSION, this patch replaces the "bool_tpsci_available" variable with "intpsci_ver", which contains thePSCI_VERSIONas described in the PSCI-0.2 spec. For v0.1, thispsci_veris 1.Signed-off-by Suravee Suthikulpanit <[email protected]>
We would have to implement CPU_OFF at some point. As it's not done for PSCI v0.1, I guess it's not too important.
Regards,
Signature · 1 line
Julien Grall
PATCH v2 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 | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
xen/arch/arm/shutdown.c +19 -6
@@ -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 noreturnhalt_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 ); } }
Signature · 1 line
1.9.3