Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Apr 2017 11:06:10 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317361 - in head/sys: arm64/arm64 conf dev/psci
Message-ID:  <201704241106.v3OB6ATg022689@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Mon Apr 24 11:06:10 2017
New Revision: 317361
URL: https://svnweb.freebsd.org/changeset/base/317361

Log:
  Call the PSCI reset from cpu_reset on arm64. When rebooting from DDB the
  kernel calls this directly so the event handler is not called, meaning
  the computer fails to reboot.
  
  Tested by:	cognet
  MFC after:	1 week
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/arm64/arm64/vm_machdep.c
  head/sys/conf/options.arm64
  head/sys/dev/psci/psci.c
  head/sys/dev/psci/psci.h

Modified: head/sys/arm64/arm64/vm_machdep.c
==============================================================================
--- head/sys/arm64/arm64/vm_machdep.c	Mon Apr 24 10:21:13 2017	(r317360)
+++ head/sys/arm64/arm64/vm_machdep.c	Mon Apr 24 11:06:10 2017	(r317361)
@@ -25,6 +25,8 @@
  *
  */
 
+#include "opt_platform.h"
+
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
@@ -52,6 +54,10 @@ __FBSDID("$FreeBSD$");
 #include <machine/vfp.h>
 #endif
 
+#ifdef DEV_PSCI
+#include <dev/psci/psci.h>
+#endif
+
 /*
  * Finish a fork operation, with process p2 nearly set up.
  * Copy and update the pcb, set up the stack so that the child
@@ -113,7 +119,11 @@ void
 cpu_reset(void)
 {
 
-	printf("cpu_reset");
+#ifdef DEV_PSCI
+	psci_reset();
+#endif
+
+	printf("cpu_reset failed");
 	while(1)
 		__asm volatile("wfi" ::: "memory");
 }

Modified: head/sys/conf/options.arm64
==============================================================================
--- head/sys/conf/options.arm64	Mon Apr 24 10:21:13 2017	(r317360)
+++ head/sys/conf/options.arm64	Mon Apr 24 11:06:10 2017	(r317361)
@@ -7,6 +7,8 @@ SOCDEV_VA			opt_global.h
 THUNDERX_PASS_1_1_ERRATA	opt_global.h
 VFP				opt_global.h
 
+DEV_PSCI			opt_platform.h
+
 # SoC Support
 SOC_ALLWINNER_A64		opt_soc.h
 SOC_BRCM_BCM2837		opt_soc.h

Modified: head/sys/dev/psci/psci.c
==============================================================================
--- head/sys/dev/psci/psci.c	Mon Apr 24 10:21:13 2017	(r317360)
+++ head/sys/dev/psci/psci.c	Mon Apr 24 11:06:10 2017	(r317361)
@@ -412,6 +412,13 @@ psci_shutdown(void *xsc, int howto)
 	/* System reset and off do not return. */
 }
 
+void
+psci_reset(void)
+{
+
+	psci_shutdown(NULL, 0);
+}
+
 #ifdef FDT
 /* Only support PSCI 0.1 on FDT */
 static int

Modified: head/sys/dev/psci/psci.h
==============================================================================
--- head/sys/dev/psci/psci.h	Mon Apr 24 10:21:13 2017	(r317360)
+++ head/sys/dev/psci/psci.h	Mon Apr 24 11:06:10 2017	(r317361)
@@ -36,7 +36,7 @@ typedef int (*psci_callfn_t)(register_t,
 
 extern int psci_present;
 
-void	psci_system_reset(void);
+void	psci_reset(void);
 int	psci_cpu_on(unsigned long, unsigned long, unsigned long);
 int	psci_hvc_despatch(register_t, register_t, register_t, register_t);
 int	psci_smc_despatch(register_t, register_t, register_t, register_t);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704241106.v3OB6ATg022689>