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

Re: [Minios-devel] [UNIKRAFT PATCHv6 27/37] plat/common: Implement CPU reset for arm64



Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>

On 14.09.2018 09:57, Wei Chen wrote:
From: Wei Chen <Wei.Chen@xxxxxxx>

Using PSCI despatch function to call PSCI_CPU_RESET
function to reset CPU.

Signed-off-by: Wei Chen <Wei.Chen@xxxxxxx>
---
  plat/common/arm/cpu_native.c        | 16 ++++++++++++++++
  plat/common/include/arm/arm64/cpu.h |  1 +
  2 files changed, 17 insertions(+)

diff --git a/plat/common/arm/cpu_native.c b/plat/common/arm/cpu_native.c
index e7603ac..1d632a4 100644
--- a/plat/common/arm/cpu_native.c
+++ b/plat/common/arm/cpu_native.c
@@ -32,6 +32,7 @@
   * THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
   */
  #include <cpu.h>
+#include <irq.h>
  #include <uk/assert.h>
  #include <arm/cpu_defs.h>
@@ -43,3 +44,18 @@ void halt(void)
  {
        __asm__ __volatile__("wfi");
  }
+
+/* Systems support PSCI >= 0.2 can do system reset from PSCI */
+void reset(void)
+{
+       /*
+        * NO PSCI or invalid PSCI method, we can't do reset, just
+        * halt the CPU.
+        */
+       if (!smcc_psci_call) {
+               uk_printd(DLVL_CRIT, "Couldn't reset system, HALT!\n");
+               __CPU_HALT();
+       }
+
+       smcc_psci_call(PSCI_FNID_SYSTEM_RESET, 0, 0, 0);
+}
diff --git a/plat/common/include/arm/arm64/cpu.h 
b/plat/common/include/arm/arm64/cpu.h
index 6fd2a16..ccbe21d 100644
--- a/plat/common/include/arm/arm64/cpu.h
+++ b/plat/common/include/arm/arm64/cpu.h
@@ -116,3 +116,4 @@ int32_t smcc_psci_smc_call(uint32_t, uint64_t, uint64_t, 
uint64_t);
/* CPU native APIs */
  void halt(void);
+void reset(void);


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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