On 1/24/19 1:01 PM, Andrew Jones wrote:
On Thu, Jan 24, 2019 at 11:16:31AM +0000, Alexandru Elisei wrote:
A new function psci_system_off() is added which implements the PSCI
SYSTEM_OFF function. A call causes the hypervisor to terminate the virtual
machine.
Consumers for the function will be added in a later patch.
Signed-off-by: Alexandru Elisei<alexandru.elisei@xxxxxxx>
---
lib/arm/asm/psci.h | 1 +
lib/arm/psci.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/lib/arm/asm/psci.h b/lib/arm/asm/psci.h
index ed51708fd265..93409996349a 100644
--- a/lib/arm/asm/psci.h
+++ b/lib/arm/asm/psci.h
@@ -9,5 +9,6 @@ extern int psci_cpu_on(unsigned long cpuid, unsigned long entry_point);
extern void psci_sys_reset(void);
extern int cpu_psci_cpu_boot(unsigned int cpu);
extern void cpu_psci_cpu_die(void);
+extern void psci_system_off(void);
#endif /* _ASMARM_PSCI_H_ */
diff --git a/lib/arm/psci.c b/lib/arm/psci.c
index 119f74e57e91..d8dc428e8e8b 100644
--- a/lib/arm/psci.c
+++ b/lib/arm/psci.c
@@ -48,6 +48,12 @@ void cpu_psci_cpu_die(void)
printf("CPU%d unable to power off (error = %d)\n", smp_processor_id(), err);
}
+void psci_system_off(void)
+{
+ int err = psci_invoke(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0);
+ printf("CPU%d unable to do system off (error = %d)\n", smp_processor_id(), err);
+}
+
void psci_sys_reset(void)
{
psci_invoke(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);
--
2.17.0
We should either rename psci_sys_reset to psci_system_reset or name this
new function with the psci_sys_* pattern.
Thanks,
drew
I am thinking we should rename psci_sys_reset() to match the PSCI specification
function name, which is SYSTEM_OFF. If you're ok with it, I'll do the rename in
the next patch set version.