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.eli...@arm.com>
---
 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

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to