From 823a97b9f37a4b7e7ae934a5e6945486dbb1c4e3 Mon Sep 17 00:00:00 2001 From: kettenis Date: Fri, 5 Jan 2018 17:42:35 +0000 Subject: [PATCH] Make arm64 use the MI mplock implementation. Avoid being pulled in for assembly files by bringing and in line with other architectures. Some minor cleanup of those files is included. ok patrick@ --- sys/arch/arm64/include/cpu.h | 13 ++------- sys/arch/arm64/include/mplock.h | 49 ++------------------------------- sys/arch/arm64/include/param.h | 13 ++++----- 3 files changed, 12 insertions(+), 63 deletions(-) diff --git a/sys/arch/arm64/include/cpu.h b/sys/arch/arm64/include/cpu.h index 5378ce068cd..2f31ce8d71d 100644 --- a/sys/arch/arm64/include/cpu.h +++ b/sys/arch/arm64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.2 2017/12/30 08:39:49 kettenis Exp $ */ +/* $OpenBSD: cpu.h,v 1.3 2018/01/05 17:42:35 kettenis Exp $ */ /* * Copyright (c) 2016 Dale Rahn * @@ -14,6 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + #ifndef _MACHINE_CPU_H_ #define _MACHINE_CPU_H_ @@ -35,14 +36,9 @@ */ #include -#ifndef _LOCORE #include -#endif /* !_LOCORE */ - #include -#ifndef _LOCORE - /* All the CLKF_* macros take a struct clockframe * as an argument. */ #define clockframe trapframe @@ -79,6 +75,7 @@ void arm32_vector_init(vaddr_t, int); #include #include + struct cpu_info { struct device *ci_dev; /* Device corresponding to this CPU */ struct cpu_info *ci_next; @@ -264,8 +261,6 @@ intr_restore(u_long daif) void delay (unsigned); #define DELAY(x) delay(x) -#endif /* !_LOCORE */ - #endif /* _KERNEL */ #ifdef MULTIPROCESSOR @@ -273,5 +268,3 @@ void delay (unsigned); #endif /* MULTIPROCESSOR */ #endif /* !_MACHINE_CPU_H_ */ - -/* End of cpu.h */ diff --git a/sys/arch/arm64/include/mplock.h b/sys/arch/arm64/include/mplock.h index 9aed99ffbf0..60c464f4f84 100644 --- a/sys/arch/arm64/include/mplock.h +++ b/sys/arch/arm64/include/mplock.h @@ -1,53 +1,10 @@ -/* $OpenBSD: mplock.h,v 1.2 2017/12/04 09:51:03 mpi Exp $ */ +/* $OpenBSD: mplock.h,v 1.3 2018/01/05 17:42:35 kettenis Exp $ */ -/* - * Copyright (c) 2004 Niklas Hallqvist. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ +/* public domain */ #ifndef _MACHINE_MPLOCK_H_ #define _MACHINE_MPLOCK_H_ -struct __mp_lock_cpu { - u_int mplc_ticket; - u_int mplc_depth; -}; - -struct __mp_lock { - struct __mp_lock_cpu mpl_cpus[MAXCPUS]; - atomic_int mpl_ticket; - atomic_int mpl_users; -}; - -#ifndef _LOCORE - -void __mp_lock_init(struct __mp_lock *); -void __mp_lock(struct __mp_lock *); -void __mp_unlock(struct __mp_lock *); -int __mp_release_all(struct __mp_lock *); -int __mp_release_all_but_one(struct __mp_lock *); -void __mp_acquire_count(struct __mp_lock *, int); -int __mp_lock_held(struct __mp_lock *, struct cpu_info *); - -#endif +#define __USE_MI_MPLOCK #endif /* !_MACHINE_MPLOCK_H */ diff --git a/sys/arch/arm64/include/param.h b/sys/arch/arm64/include/param.h index d2e385cfb9b..5e25c7fde60 100644 --- a/sys/arch/arm64/include/param.h +++ b/sys/arch/arm64/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.2 2017/08/09 03:06:55 jsg Exp $ */ +/* $OpenBSD: param.h,v 1.3 2018/01/05 17:42:35 kettenis Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -36,8 +36,10 @@ #define _MACHINE_PARAM_H_ #ifdef _KERNEL +#ifndef _LOCORE #include #endif +#endif #define _MACHINE arm64 #define MACHINE "arm64" @@ -53,9 +55,6 @@ #ifdef _KERNEL -//#define KERNBASE_HI 0xffffffff -//#define KERNBASE_LO 0x80000000 - #define NBPG PAGE_SIZE /* bytes/page */ #define PGSHIFT PAGE_SHIFT /* LOG2(PAGE_SIZE) */ #define PGOFSET PAGE_MASK /* byte offset into page */ @@ -64,7 +63,7 @@ #define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */ #define USPACE_ALIGN 0 /* u-area alignment 0-none */ -#define NMBCLUSTERS 4096 /* map size, max cluster allocation */ +#define NMBCLUSTERS 4096 /* max cluster allocation */ #ifndef MSGBUFSIZE #define MSGBUFSIZE (16 * PAGE_SIZE) /* default message buffer size */ @@ -76,8 +75,8 @@ */ #define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT) -#define STACKALIGNBYTES (16 - 1) -#define STACKALIGN(p) ((u_long)(p) &~ STACKALIGNBYTES) +#define STACKALIGNBYTES (16 - 1) +#define STACKALIGN(p) ((u_long)(p) &~ STACKALIGNBYTES) #endif /* _KERNEL */ -- 2.20.1