Module Name:    src
Committed By:   skrll
Date:           Mon Nov 30 21:06:56 UTC 2020

Modified Files:
        src/sys/arch/arm/arm: cpu_subr.c

Log Message:
Ensure stores are observed before the 'sev' instructions.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/arm/cpu_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm/cpu_subr.c
diff -u src/sys/arch/arm/arm/cpu_subr.c:1.1 src/sys/arch/arm/arm/cpu_subr.c:1.2
--- src/sys/arch/arm/arm/cpu_subr.c:1.1	Sat Feb 15 08:16:10 2020
+++ src/sys/arch/arm/arm/cpu_subr.c	Mon Nov 30 21:06:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.1 2020/02/15 08:16:10 skrll Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.2 2020/11/30 21:06:56 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -33,13 +33,15 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.1 2020/02/15 08:16:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.2 2020/11/30 21:06:56 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
 #include <sys/cpu.h>
 #include <sys/reboot.h>
 
+#include <arm/cpufunc.h>
+
 #ifdef VERBOSE_INIT_ARM
 #define VPRINTF(...)	printf(__VA_ARGS__)
 #else
@@ -86,7 +88,8 @@ cpu_boot_secondary_processors(void)
 	for (size_t n = 0; n < __arraycount(arm_cpu_mbox); n++)
 		atomic_or_ulong(&arm_cpu_mbox[n], arm_cpu_hatched[n]);
 
-	__asm __volatile ("sev; sev; sev");
+	dsb(ishst);
+	__asm __volatile ("sev");
 
 	/* wait all cpus have done cpu_hatch() */
 	for (cpuno = 1; cpuno < ncpu; cpuno++) {
@@ -136,7 +139,8 @@ cpu_clr_mbox(int cpuindex)
 	/* Notify cpu_boot_secondary_processors that we're done */
 	atomic_and_ulong(&arm_cpu_mbox[off], ~bit);
 	membar_producer();
-	__asm __volatile("sev; sev; sev");
+	dsb(ishst);
+	__asm __volatile("sev");
 }
 
 #endif

Reply via email to