Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64/aarch64 Reduce scope of memory barriers use...



details:   https://anonhg.NetBSD.org/src/rev/3f26d46f0fb3
branches:  trunk
changeset: 977111:3f26d46f0fb3
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Oct 15 21:14:15 2020 +0000

description:
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@

diffstat:

 sys/arch/aarch64/aarch64/bus_space.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r c600361afac9 -r 3f26d46f0fb3 sys/arch/aarch64/aarch64/bus_space.c
--- a/sys/arch/aarch64/aarch64/bus_space.c      Thu Oct 15 18:57:16 2020 +0000
+++ b/sys/arch/aarch64/aarch64/bus_space.c      Thu Oct 15 21:14:15 2020 +0000
@@ -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 <ryo%nerv.org@localhost>
@@ -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 @@
 #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 @@
 {
        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 *



Home | Main Index | Thread Index | Old Index