summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-12-03 19:06:13 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-12-03 19:06:13 +0000
commit65918656862c3fb71a7d65c1a06fc226956c6e1f (patch)
tree1a71fdb617fb2604569f79604873f02f8b5e9421 /sys
parentb3c523e0390f0d29a36adf0ab1ad4d6630c5e4dc (diff)
Replace simplelocks with __cpu_simple_locks for cmmu and pmap locking,
for the MULTIPROCESSOR case.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/m88k/include/cmmu.h16
-rw-r--r--sys/arch/m88k/include/pmap.h12
-rw-r--r--sys/arch/m88k/m88k/m8820x_machdep.c14
-rw-r--r--sys/arch/m88k/m88k/m88k_machdep.c4
-rw-r--r--sys/arch/m88k/m88k/pmap.c44
-rw-r--r--sys/arch/mvme88k/mvme88k/m88110.c15
6 files changed, 69 insertions, 36 deletions
diff --git a/sys/arch/m88k/include/cmmu.h b/sys/arch/m88k/include/cmmu.h
index 632b9141474..beb398c3f38 100644
--- a/sys/arch/m88k/include/cmmu.h
+++ b/sys/arch/m88k/include/cmmu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmmu.h,v 1.12 2005/12/03 14:30:05 miod Exp $ */
+/* $OpenBSD: cmmu.h,v 1.13 2005/12/03 19:06:08 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -33,16 +33,24 @@
*/
#if defined(_KERNEL) && !defined(_LOCORE)
+#ifdef MULTIPROCESSOR
/*
* This lock protects the cmmu SAR and SCR's; other ports
* can be accessed without locking it.
*
* May be used from "db_interface.c".
*/
-extern struct simplelock cmmu_cpu_lock;
+extern __cpu_simple_lock_t cmmu_cpu_lock;
-#define CMMU_LOCK simple_lock(&cmmu_cpu_lock)
-#define CMMU_UNLOCK simple_unlock(&cmmu_cpu_lock)
+#define CMMU_LOCK __cpu_simple_lock(&cmmu_cpu_lock)
+#define CMMU_UNLOCK __cpu_simple_unlock(&cmmu_cpu_lock)
+
+#else
+
+#define CMMU_LOCK do { /* nothing */ } while (0)
+#define CMMU_UNLOCK do { /* nothing */ } while (0)
+
+#endif /* MULTIPROCESSOR */
/* machine dependent cmmu function pointer structure */
struct cmmu_p {
diff --git a/sys/arch/m88k/include/pmap.h b/sys/arch/m88k/include/pmap.h
index 72f0dca4047..e37a19c4c10 100644
--- a/sys/arch/m88k/include/pmap.h
+++ b/sys/arch/m88k/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.7 2005/12/02 21:16:45 miod Exp $ */
+/* $OpenBSD: pmap.h,v 1.8 2005/12/03 19:06:08 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991 Carnegie Mellon University
@@ -23,11 +23,13 @@
struct pmap {
sdt_entry_t *pm_stab; /* virtual pointer to sdt */
- apr_t pm_apr;
- int pm_count; /* reference count */
+ apr_t pm_apr;
+ int pm_count; /* reference count */
/* cpus using of this pmap; NCPU must be <= 32 */
- u_int32_t pm_cpus;
- struct simplelock pm_lock;
+ u_int32_t pm_cpus;
+#ifdef MULTIPROCESSOR
+ __cpu_simple_lock_t pm_lock;
+#endif
struct pmap_statistics pm_stats; /* pmap statistics */
};
diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c
index 929e7711f4e..c4089fd4696 100644
--- a/sys/arch/m88k/m88k/m8820x_machdep.c
+++ b/sys/arch/m88k/m88k/m8820x_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m8820x_machdep.c,v 1.13 2005/12/03 16:52:16 miod Exp $ */
+/* $OpenBSD: m8820x_machdep.c,v 1.14 2005/12/03 19:06:11 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
*
@@ -83,13 +83,13 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/simplelock.h>
#include <uvm/uvm_extern.h>
#include <machine/asm_macro.h>
#include <machine/cmmu.h>
#include <machine/locore.h>
+#include <machine/lock.h>
#include <machine/m8820x.h>
#ifdef DDB
@@ -266,21 +266,21 @@ m8820x_cpu_configuration_print(int master)
int proctype = (pid & PID_ARN) >> ARN_SHIFT;
int procvers = (pid & PID_VN) >> VN_SHIFT;
int mmu, cnt, cpu = cpu_number();
- struct simplelock print_lock;
+ static __cpu_simple_lock_t print_lock;
#ifdef M88200_HAS_SPLIT_ADDRESS
int aline, abit, amask;
#endif
if (master)
- simple_lock_init(&print_lock);
+ __cpu_simple_lock_init(&print_lock);
- simple_lock(&print_lock);
+ __cpu_simple_lock(&print_lock);
printf("cpu%d: ", cpu);
if (proctype != ARN_88100) {
printf("unknown model arch 0x%x rev 0x%x\n",
proctype, procvers);
- simple_unlock(&print_lock);
+ __cpu_simple_unlock(&print_lock);
return;
}
@@ -344,7 +344,7 @@ m8820x_cpu_configuration_print(int master)
}
#endif
- simple_unlock(&print_lock);
+ __cpu_simple_unlock(&print_lock);
}
/*
diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c
index 3f815e42736..65d04a3076c 100644
--- a/sys/arch/m88k/m88k/m88k_machdep.c
+++ b/sys/arch/m88k/m88k/m88k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88k_machdep.c,v 1.10 2005/12/03 14:30:06 miod Exp $ */
+/* $OpenBSD: m88k_machdep.c,v 1.11 2005/12/03 19:06:11 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -56,6 +56,7 @@
#include <machine/asm_macro.h>
#include <machine/cmmu.h>
#include <machine/cpu.h>
+#include <machine/lock.h>
#include <machine/locore.h>
#include <machine/reg.h>
#ifdef M88100
@@ -80,6 +81,7 @@ void dumpconf(void);
*/
#ifdef MULTIPROCESSOR
+__cpu_simple_lock_t cmmu_cpu_lock = __SIMPLELOCK_UNLOCKED;
cpuid_t master_cpu;
#endif
diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c
index 0465714d608..d549eafbc37 100644
--- a/sys/arch/m88k/m88k/pmap.c
+++ b/sys/arch/m88k/m88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.19 2005/12/03 18:54:34 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.20 2005/12/03 19:06:11 miod Exp $ */
/*
* Copyright (c) 2001-2004, Miodrag Vallat
* Copyright (c) 1998-2001 Steve Murphree, Jr.
@@ -47,7 +47,6 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/simplelock.h>
#include <sys/proc.h>
#include <sys/malloc.h>
#include <sys/pool.h>
@@ -56,6 +55,7 @@
#include <machine/asm_macro.h>
#include <machine/cmmu.h>
+#include <machine/lock.h>
#include <machine/pmap_table.h>
#include <uvm/uvm.h>
@@ -143,8 +143,8 @@ pg_to_pvh(struct vm_page *pg)
*/
#ifdef MULTIPROCESSOR
-#define PMAP_LOCK(pmap) simple_lock(&(pmap)->pm_lock)
-#define PMAP_UNLOCK(pmap) simple_unlock(&(pmap)->pm_lock)
+#define PMAP_LOCK(pmap) __cpu_simple_lock(&(pmap)->pm_lock)
+#define PMAP_UNLOCK(pmap) __cpu_simple_unlock(&(pmap)->pm_lock)
#else
#define PMAP_LOCK(pmap) do { /* nothing */ } while (0)
#define PMAP_UNLOCK(pmap) do { /* nothing */ } while (0)
@@ -510,7 +510,7 @@ pmap_cache_ctrl(pmap_t pmap, vaddr_t s, vaddr_t e, u_int mode)
* phys_map_vaddr VA of page mapped arbitrarily for debug/IO
*
* Calls:
- * simple_lock_init
+ * __cpu_simple_lock_init
* pmap_map
*
* The physical address 'load_start' is mapped at
@@ -544,7 +544,9 @@ pmap_bootstrap(vaddr_t load_start)
pmap_table_t ptable;
extern void *etext;
- simple_lock_init(&kernel_pmap->pm_lock);
+#ifdef MULTIPROCESSOR
+ __cpu_simple_lock_init(&kernel_pmap->pm_lock);
+#endif
/*
* Allocate the kernel page table from the front of available
@@ -889,7 +891,9 @@ pmap_create(void)
* Initialize pmap structure.
*/
pmap->pm_count = 1;
- simple_lock_init(&pmap->pm_lock);
+#ifdef MULTIPROCESSOR
+ __cpu_simple_lock_init(&pmap->pm_lock);
+#endif
pmap->pm_cpus = 0;
return pmap;
@@ -1266,7 +1270,7 @@ pmap_remove(pmap_t pmap, vaddr_t s, vaddr_t e)
* pv lists
*
* Calls:
- * simple_lock
+ * __cpu_simple_lock
* pmap_pte
* pool_put
*
@@ -1313,7 +1317,9 @@ pmap_remove_all(struct vm_page *pg)
* We don't have to lock the pv list, since we have the entire pmap
* system.
*/
+#ifdef MULTIPROCESSOR
remove_all_Retry:
+#endif
pvl = pg_to_pvh(pg);
@@ -1321,8 +1327,10 @@ remove_all_Retry:
* Loop for each entry on the pv list
*/
while (pvl != NULL && (pmap = pvl->pv_pmap) != NULL) {
- if (!simple_lock_try(&pmap->pm_lock))
+#ifdef MULTIPROCESSOR
+ if (!__cpu_simple_lock_try(&pmap->pm_lock))
goto remove_all_Retry;
+#endif
va = pvl->pv_va;
pte = pmap_pte(pmap, va);
@@ -2120,7 +2128,9 @@ pmap_changebit(struct vm_page *pg, int set, int mask)
spl = splvm();
+#ifdef MULTIPROCESSOR
changebit_Retry:
+#endif
pvl = pg_to_pvh(pg);
/*
@@ -2141,9 +2151,11 @@ changebit_Retry:
/* for each listed pmap, update the affected bits */
for (pvep = pvl; pvep != NULL; pvep = pvep->pv_next) {
pmap = pvep->pv_pmap;
- if (!simple_lock_try(&pmap->pm_lock)) {
+#ifdef MULTIPROCESSOR
+ if (!__cpu_simple_lock_try(&pmap->pm_lock)) {
goto changebit_Retry;
}
+#endif
users = pmap->pm_cpus;
kflush = pmap == kernel_pmap;
@@ -2221,7 +2233,9 @@ pmap_testbit(struct vm_page *pg, int bit)
spl = splvm();
+#ifdef MULTIPROCESSOR
testbit_Retry:
+#endif
pvl = pg_to_pvh(pg);
if (pvl->pv_flags & bit) {
@@ -2249,9 +2263,11 @@ testbit_Retry:
/* for each listed pmap, check modified bit for given page */
for (pvep = pvl; pvep != NULL; pvep = pvep->pv_next) {
pmap = pvep->pv_pmap;
- if (!simple_lock_try(&pmap->pm_lock)) {
+#ifdef MULTIPROCESSOR
+ if (!__cpu_simple_lock_try(&pmap->pm_lock)) {
goto testbit_Retry;
}
+#endif
pte = pmap_pte(pmap, pvep->pv_va);
if (pte == NULL || !PDT_VALID(pte)) {
@@ -2307,7 +2323,9 @@ pmap_unsetbit(struct vm_page *pg, int bit)
spl = splvm();
+#ifdef MULTIPROCESSOR
unsetbit_Retry:
+#endif
pvl = pg_to_pvh(pg);
/*
@@ -2328,9 +2346,11 @@ unsetbit_Retry:
/* for each listed pmap, update the specified bit */
for (pvep = pvl; pvep != NULL; pvep = pvep->pv_next) {
pmap = pvep->pv_pmap;
- if (!simple_lock_try(&pmap->pm_lock)) {
+#ifdef MULTIPROCESSOR
+ if (!__cpu_simple_lock_try(&pmap->pm_lock)) {
goto unsetbit_Retry;
}
+#endif
users = pmap->pm_cpus;
kflush = pmap == kernel_pmap;
diff --git a/sys/arch/mvme88k/mvme88k/m88110.c b/sys/arch/mvme88k/mvme88k/m88110.c
index 74da1df8ab3..587fa6774e0 100644
--- a/sys/arch/mvme88k/mvme88k/m88110.c
+++ b/sys/arch/mvme88k/mvme88k/m88110.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88110.c,v 1.31 2005/12/03 18:48:22 miod Exp $ */
+/* $OpenBSD: m88110.c,v 1.32 2005/12/03 19:06:12 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* All rights reserved.
@@ -59,10 +59,10 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/simplelock.h>
#include <uvm/uvm_extern.h>
+#include <machine/lock.h>
#include <machine/cmmu.h>
#include <machine/m88110.h>
#include <machine/m88410.h>
@@ -180,19 +180,20 @@ m88110_cpu_configuration_print(int master)
int proctype = (pid & PID_ARN) >> ARN_SHIFT;
int procvers = (pid & PID_VN) >> VN_SHIFT;
int cpu = cpu_number();
- struct simplelock print_lock;
+ static __cpu_simple_lock_t print_lock;
CMMU_LOCK;
if (master)
- simple_lock_init(&print_lock);
+ __cpu_simple_lock_init(&print_lock);
- simple_lock(&print_lock);
+ __cpu_simple_lock(&print_lock);
printf("cpu%d: ", cpu);
if (proctype != ARN_88110) {
printf("unknown model arch 0x%x version 0x%x\n",
proctype, procvers);
- simple_unlock(&print_lock);
+ __cpu_simple_unlock(&print_lock);
+ CMMU_UNLOCK;
return;
}
@@ -201,7 +202,7 @@ m88110_cpu_configuration_print(int master)
printf(", external M88410 cache controller");
printf("\n");
- simple_unlock(&print_lock);
+ __cpu_simple_unlock(&print_lock);
CMMU_UNLOCK;
}