From 90de25d4b6a174a778d95af5c19931b5e0f4d70e Mon Sep 17 00:00:00 2001 From: visa Date: Sun, 10 Jul 2016 10:18:58 +0000 Subject: [PATCH] Use the synciobdma instruction instead of the sync instruction for flushing any pending local IOBDMA operations. The sync instruction is overkill because it implies a full memory barrier. ok jasper@ (long time ago) --- sys/arch/octeon/dev/cn30xxfau.c | 10 ++++------ sys/arch/octeon/dev/cn30xxfauvar.h | 4 ++-- sys/arch/octeon/dev/cn30xxpow.c | 4 ++-- sys/arch/octeon/include/octeonvar.h | 12 +++++++++++- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/sys/arch/octeon/dev/cn30xxfau.c b/sys/arch/octeon/dev/cn30xxfau.c index f4509275b56..49cd421a13b 100644 --- a/sys/arch/octeon/dev/cn30xxfau.c +++ b/sys/arch/octeon/dev/cn30xxfau.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxfau.c,v 1.5 2014/08/11 18:08:17 miod Exp $ */ +/* $OpenBSD: cn30xxfau.c,v 1.6 2016/07/10 10:18:58 visa Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -119,7 +119,7 @@ cn30xxfau_op_init(struct cn30xxfau_desc *fd, size_t scroff, size_t regno) uint64_t cn30xxfau_op_save(struct cn30xxfau_desc *fd) { - mips_sync(); + octeon_synciobdma(); return octeon_cvmseg_read_8(fd->fd_scroff); } @@ -134,7 +134,7 @@ cn30xxfau_op_inc_8(struct cn30xxfau_desc *fd, int64_t v) { cn30xxfau_op_iobdma_store_data(fd->fd_scroff, v, 0, OCT_FAU_OP_SIZE_64/* XXX */, fd->fd_regno); - mips_sync(); + octeon_synciobdma(); return octeon_cvmseg_read_8(fd->fd_scroff)/* XXX */; } @@ -143,9 +143,7 @@ cn30xxfau_op_incwait_8(struct cn30xxfau_desc *fd, int v) { cn30xxfau_op_iobdma_store_data(fd->fd_scroff, v, 1, OCT_FAU_OP_SIZE_64/* XXX */, fd->fd_regno); - /* XXX */ - mips_sync(); - /* XXX */ + octeon_synciobdma(); return octeon_cvmseg_read_8(fd->fd_scroff)/* XXX */; } diff --git a/sys/arch/octeon/dev/cn30xxfauvar.h b/sys/arch/octeon/dev/cn30xxfauvar.h index b53c7b40647..fd5da54c7e1 100644 --- a/sys/arch/octeon/dev/cn30xxfauvar.h +++ b/sys/arch/octeon/dev/cn30xxfauvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxfauvar.h,v 1.2 2013/06/01 22:20:35 jasper Exp $ */ +/* $OpenBSD: cn30xxfauvar.h,v 1.3 2016/07/10 10:18:58 visa Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -125,7 +125,7 @@ cn30xxfau_op_inc_fetch_8(struct cn30xxfau_desc *fd, int64_t v) static inline int64_t cn30xxfau_op_inc_read_8(struct cn30xxfau_desc *fd) { - mips_sync(); + octeon_synciobdma(); return octeon_cvmseg_read_8(fd->fd_scroff); } diff --git a/sys/arch/octeon/dev/cn30xxpow.c b/sys/arch/octeon/dev/cn30xxpow.c index a6f040a3360..6f5fd3e1959 100644 --- a/sys/arch/octeon/dev/cn30xxpow.c +++ b/sys/arch/octeon/dev/cn30xxpow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxpow.c,v 1.7 2014/08/11 18:56:49 miod Exp $ */ +/* $OpenBSD: cn30xxpow.c,v 1.8 2016/07/10 10:18:58 visa Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -135,7 +135,7 @@ cn30xxpow_work_response_async(uint64_t scraddr) { uint64_t result; - mips_sync(); + octeon_synciobdma(); result = octeon_cvmseg_read_8(scraddr); return (result & POW_IOBDMA_GET_WORK_RESULT_NO_WORK) ? diff --git a/sys/arch/octeon/include/octeonvar.h b/sys/arch/octeon/include/octeonvar.h index 02cee40fa87..1a012bafcac 100644 --- a/sys/arch/octeon/include/octeonvar.h +++ b/sys/arch/octeon/include/octeonvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: octeonvar.h,v 1.29 2016/07/01 15:12:37 visa Exp $ */ +/* $OpenBSD: octeonvar.h,v 1.30 2016/07/10 10:18:58 visa Exp $ */ /* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */ /*- @@ -428,4 +428,14 @@ octeon_get_cycles(void) return tmp; } +static inline void +octeon_synciobdma(void) +{ + __asm volatile ( + _ASM_PROLOGUE_OCTEON + " synciobdma\n" + _ASM_EPILOGUE + : : : "memory"); +} + #endif /* _MIPS_OCTEON_OCTEONVAR_H_ */ -- 2.20.1