Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Improve inline asm around dsb/dmb/isb:
details: https://anonhg.NetBSD.org/src/rev/141fb7889bf6
branches: trunk
changeset: 336309:141fb7889bf6
user: joerg <joerg%NetBSD.org@localhost>
date: Wed Feb 25 13:52:42 2015 +0000
description:
Improve inline asm around dsb/dmb/isb:
- always use volatile and mark them as memory barrier
- use the common version from locore.h in all places not included from
userland
diffstat:
sys/arch/arm/allwinner/awin_space.c | 17 ++++-------------
sys/arch/arm/amlogic/amlogic_space.c | 17 ++++-------------
sys/arch/arm/arm/cpufunc.c | 8 ++++----
sys/arch/arm/arm32/bus_dma.c | 8 ++++----
sys/arch/arm/arm32/db_machdep.c | 8 ++++----
sys/arch/arm/arm32/pmap.c | 8 +++-----
sys/arch/arm/broadcom/bcm2835_space.c | 13 ++++---------
sys/arch/arm/broadcom/bcm53xx_pax.c | 6 +++---
sys/arch/arm/broadcom/bcmgen_space.c | 17 ++++-------------
sys/arch/arm/include/arm32/pmap.h | 7 +++----
sys/arch/arm/include/lock.h | 10 +++++-----
sys/arch/arm/include/locore.h | 8 ++++----
sys/arch/arm/include/mutex.h | 6 +++---
sys/arch/arm/include/rwlock.h | 6 +++---
sys/arch/arm/rockchip/rockchip_space.c | 17 ++++-------------
sys/arch/arm/samsung/exynos_space.c | 17 ++++-------------
sys/arch/arm/zynq/zynq_space.c | 17 ++++-------------
17 files changed, 64 insertions(+), 126 deletions(-)
diffs (truncated from 562 to 300 lines):
diff -r 23cf51895059 -r 141fb7889bf6 sys/arch/arm/allwinner/awin_space.c
--- a/sys/arch/arm/allwinner/awin_space.c Wed Feb 25 13:35:25 2015 +0000
+++ b/sys/arch/arm/allwinner/awin_space.c Wed Feb 25 13:52:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_space.c,v 1.3 2014/02/20 21:45:49 matt Exp $ */
+/* $NetBSD: awin_space.c,v 1.4 2015/02/25 13:52:42 joerg Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_space.c,v 1.3 2014/02/20 21:45:49 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_space.c,v 1.4 2015/02/25 13:52:42 joerg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -366,17 +366,8 @@
{
flags &= BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE;
- if (flags) {
- /* Issue an ARM11 Data Syncronisation Barrier (DSB) */
-#ifdef _ARM_ARCH_7
- __asm __volatile("dsb");
-#else
- __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)
- : "memory");
-#endif
- return;
- }
-
+ if (flags)
+ arm_dsb();
}
void *
diff -r 23cf51895059 -r 141fb7889bf6 sys/arch/arm/amlogic/amlogic_space.c
--- a/sys/arch/arm/amlogic/amlogic_space.c Wed Feb 25 13:35:25 2015 +0000
+++ b/sys/arch/arm/amlogic/amlogic_space.c Wed Feb 25 13:52:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_space.c,v 1.1 2015/02/07 17:20:17 jmcneill Exp $ */
+/* $NetBSD: amlogic_space.c,v 1.2 2015/02/25 13:52:42 joerg Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amlogic_space.c,v 1.1 2015/02/07 17:20:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amlogic_space.c,v 1.2 2015/02/25 13:52:42 joerg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -366,17 +366,8 @@
{
flags &= BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE;
- if (flags) {
- /* Issue an ARM11 Data Syncronisation Barrier (DSB) */
-#ifdef _ARM_ARCH_7
- __asm __volatile("dsb");
-#else
- __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)
- : "memory");
-#endif
- return;
- }
-
+ if (flags)
+ arm_dsb();
}
void *
diff -r 23cf51895059 -r 141fb7889bf6 sys/arch/arm/arm/cpufunc.c
--- a/sys/arch/arm/arm/cpufunc.c Wed Feb 25 13:35:25 2015 +0000
+++ b/sys/arch/arm/arm/cpufunc.c Wed Feb 25 13:52:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc.c,v 1.150 2014/07/31 07:14:42 skrll Exp $ */
+/* $NetBSD: cpufunc.c,v 1.151 2015/02/25 13:52:42 joerg Exp $ */
/*
* arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.150 2014/07/31 07:14:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.151 2015/02/25 13:52:42 joerg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_cpuoptions.h"
@@ -1490,9 +1490,9 @@
#if defined(CPU_ARMV7)
__asm volatile(".arch\tarmv7a");
__asm volatile("mcr p15, 2, %0, c0, c0, 0" :: "r" (cssr));
- __asm volatile("isb"); /* sync to the new cssr */
+ __asm volatile("isb" ::: "memory"); /* sync to the new cssr */
#else
- __asm volatile("mcr p15, 1, %0, c0, c0, 2" :: "r" (cssr));
+ __asm volatile("mcr p15, 1, %0, c0, c0, 2" :: "r" (cssr) : "memory");
#endif
__asm volatile("mrc p15, 1, %0, c0, c0, 0" : "=r" (csid));
return csid;
diff -r 23cf51895059 -r 141fb7889bf6 sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c Wed Feb 25 13:35:25 2015 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c Wed Feb 25 13:52:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.90 2015/02/12 10:23:48 joerg Exp $ */
+/* $NetBSD: bus_dma.c,v 1.91 2015/02/25 13:52:42 joerg Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#include "opt_arm_bus_space.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.90 2015/02/12 10:23:48 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.91 2015/02/25 13:52:42 joerg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -832,13 +832,13 @@
*/
case BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE:
STAT_INCR(sync_postreadwrite);
- __asm __volatile("dmb" ::: "memory");
+ arm_dmb();
cpu_dcache_inv_range(va, len);
cpu_sdcache_inv_range(va, pa, len);
break;
case BUS_DMASYNC_POSTREAD:
STAT_INCR(sync_postread);
- __asm __volatile("dmb" ::: "memory");
+ arm_dmb();
cpu_dcache_inv_range(va, len);
cpu_sdcache_inv_range(va, pa, len);
break;
diff -r 23cf51895059 -r 141fb7889bf6 sys/arch/arm/arm32/db_machdep.c
--- a/sys/arch/arm/arm32/db_machdep.c Wed Feb 25 13:35:25 2015 +0000
+++ b/sys/arch/arm/arm32/db_machdep.c Wed Feb 25 13:52:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.22 2014/10/12 05:40:56 skrll Exp $ */
+/* $NetBSD: db_machdep.c,v 1.23 2015/02/25 13:52:42 joerg Exp $ */
/*
* Copyright (c) 1996 Mark Brinicombe
@@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.22 2014/10/12 05:40:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.23 2015/02/25 13:52:42 joerg Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -385,7 +385,7 @@
armreg_tlbdataop_write(
__SHIFTIN(va_index, dti->dti_index)
| __SHIFTIN(way, ARM_TLBDATAOP_WAY));
- __asm("isb");
+ arm_isb();
const uint32_t d0 = armreg_tlbdata0_read();
const uint32_t d1 = armreg_tlbdata1_read();
if ((d0 & ARM_TLBDATA_VALID)
@@ -406,7 +406,7 @@
armreg_tlbdataop_write(
__SHIFTIN(way, ARM_TLBDATAOP_WAY)
| __SHIFTIN(va_index, dti->dti_index));
- __asm("isb");
+ arm_isb();
const uint32_t d0 = armreg_tlbdata0_read();
const uint32_t d1 = armreg_tlbdata1_read();
if (d0 & ARM_TLBDATA_VALID) {
diff -r 23cf51895059 -r 141fb7889bf6 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Wed Feb 25 13:35:25 2015 +0000
+++ b/sys/arch/arm/arm32/pmap.c Wed Feb 25 13:52:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.316 2014/11/10 15:46:33 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.317 2015/02/25 13:52:42 joerg Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -215,7 +215,7 @@
#include <arm/locore.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.316 2014/11/10 15:46:33 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.317 2015/02/25 13:52:42 joerg Exp $");
//#define PMAP_DEBUG
#ifdef PMAP_DEBUG
@@ -952,9 +952,7 @@
{
if (PMAP_NEEDS_PTE_SYNC && pmap_is_cached(pm))
PTE_SYNC(ptep);
-#if ARM_MMU_V7 > 0
- __asm("dsb":::"memory");
-#endif
+ arm_dsb();
}
#ifdef PMAP_INCLUDE_PTE_SYNC
diff -r 23cf51895059 -r 141fb7889bf6 sys/arch/arm/broadcom/bcm2835_space.c
--- a/sys/arch/arm/broadcom/bcm2835_space.c Wed Feb 25 13:35:25 2015 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_space.c Wed Feb 25 13:52:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_space.c,v 1.6 2013/04/14 15:11:52 skrll Exp $ */
+/* $NetBSD: bcm2835_space.c,v 1.7 2015/02/25 13:52:42 joerg Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.6 2013/04/14 15:11:52 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_space.c,v 1.7 2015/02/25 13:52:42 joerg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -356,13 +356,8 @@
{
flags &= BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE;
- if (flags) {
- /* Issue an ARM11 Data Syncronisation Barrier (DSB) */
- __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)
- : "memory");
- return;
- }
-
+ if (flags)
+ arm_dsb();
}
void *
diff -r 23cf51895059 -r 141fb7889bf6 sys/arch/arm/broadcom/bcm53xx_pax.c
--- a/sys/arch/arm/broadcom/bcm53xx_pax.c Wed Feb 25 13:35:25 2015 +0000
+++ b/sys/arch/arm/broadcom/bcm53xx_pax.c Wed Feb 25 13:52:42 2015 +0000
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_pax.c,v 1.13 2014/03/30 01:12:18 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_pax.c,v 1.14 2015/02/25 13:52:42 joerg Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -419,12 +419,12 @@
bcmpax_write_4(sc, PCIE_CFG_IND_ADDR,
__SHIFTIN(func, CFG_IND_ADDR_FUNC)
| __SHIFTIN(reg, CFG_IND_ADDR_REG));
- __asm __volatile("dsb");
+ arm_dsb();
return PCIE_CFG_IND_DATA;
}
if (sc->sc_linkup) {
bcmpax_write_4(sc, PCIE_CFG_ADDR, tag);
- __asm __volatile("dsb");
+ arm_dsb();
return PCIE_CFG_DATA;
}
return 0;
diff -r 23cf51895059 -r 141fb7889bf6 sys/arch/arm/broadcom/bcmgen_space.c
--- a/sys/arch/arm/broadcom/bcmgen_space.c Wed Feb 25 13:35:25 2015 +0000
+++ b/sys/arch/arm/broadcom/bcmgen_space.c Wed Feb 25 13:52:42 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgen_space.c,v 1.4 2013/10/28 22:51:16 matt Exp $ */
+/* $NetBSD: bcmgen_space.c,v 1.5 2015/02/25 13:52:42 joerg Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcmgen_space.c,v 1.4 2013/10/28 22:51:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgen_space.c,v 1.5 2015/02/25 13:52:42 joerg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -241,17 +241,8 @@
{
flags &= BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE;
- if (flags) {
- /* Issue an ARM11 Data Syncronisation Barrier (DSB) */
-#ifdef _ARM_ARCH_7
- __asm __volatile("dsb");
-#else
- __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" : : "r" (0)
- : "memory");
-#endif
- return;
- }
-
+ if (flags)
Home |
Main Index |
Thread Index |
Old Index