Module Name:    src
Committed By:   jmcneill
Date:           Thu Oct 15 21:14:15 UTC 2020

Modified Files:
        src/sys/arch/aarch64/aarch64: bus_space.c

Log Message:
Reduce scope of memory barriers use in bus_space_barrier() implementation.

Instead of always "dsb sy", use "dsb ishld" for reads, "dsb ishst" for
writes, and "dsh ish" for reads and writes.

Ok skrll@


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/bus_space.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/aarch64/aarch64/bus_space.c
diff -u src/sys/arch/aarch64/aarch64/bus_space.c:1.10 src/sys/arch/aarch64/aarch64/bus_space.c:1.11
--- src/sys/arch/aarch64/aarch64/bus_space.c:1.10	Sat Sep  5 16:44:54 2020
+++ src/sys/arch/aarch64/aarch64/bus_space.c	Thu Oct 15 21:14:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.c,v 1.10 2020/09/05 16:44:54 jakllsch Exp $ */
+/* $NetBSD: bus_space.c,v 1.11 2020/10/15 21:14:15 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <r...@nerv.org>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.10 2020/09/05 16:44:54 jakllsch Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.11 2020/10/15 21:14:15 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -38,6 +38,7 @@ __KERNEL_RCSID(1, "$NetBSD: bus_space.c,
 #include <aarch64/bus_funcs.h>
 #include <aarch64/machdep.h>
 
+#include <arm/cpufunc.h>
 
 /* Prototypes for all the bus_space structure functions */
 bs_protos(generic)
@@ -612,8 +613,17 @@ generic_bs_barrier(void *t, bus_space_ha
 {
 	flags &= BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE;
 
-	if (flags != 0)
-		__asm __volatile ("dmb sy" ::: "memory");
+	switch (flags) {
+	case BUS_SPACE_BARRIER_READ:
+		dmb(ishld);
+		break;
+	case BUS_SPACE_BARRIER_WRITE:
+		dmb(ishst);
+		break;
+	case BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE:
+		dmb(ish);
+		break;
+	}
 }
 
 void *

Reply via email to