summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2011-01-05 22:16:14 +0000
committermiod <miod@openbsd.org>2011-01-05 22:16:14 +0000
commit10d5fe2dd9dc0e104750da9559a1942cc035418d (patch)
treec086294436162f96e19b3a69f524657c2110ff82
parentNow that pmap_copy_page() no longer needs to flush a couple contiguous tlb (diff)
downloadwireguard-openbsd-10d5fe2dd9dc0e104750da9559a1942cc035418d.tar.xz
wireguard-openbsd-10d5fe2dd9dc0e104750da9559a1942cc035418d.zip
Make copypage() and zeropage() per-cpu function pointers, and use a
different version on 88110, which does load allocate of to-be-completely-overwritten cache lines.
-rw-r--r--sys/arch/m88k/include/cpu.h8
-rw-r--r--sys/arch/m88k/m88k/m8820x_machdep.c8
-rw-r--r--sys/arch/m88k/m88k/pmap.c8
-rw-r--r--sys/arch/m88k/m88k/subr.S59
-rw-r--r--sys/arch/mvme88k/mvme88k/m88110.c11
5 files changed, 83 insertions, 11 deletions
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index aecac92f45b..e14afe7f851 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.51 2010/12/23 20:05:08 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.52 2011/01/05 22:16:14 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -106,6 +106,12 @@ struct cpu_info {
(uint32_t psr, __cpu_simple_lock_t *lock, uint csr);
/*
+ * Other processor-dependent routines
+ */
+ void (*ci_zeropage)(vaddr_t);
+ void (*ci_copypage)(vaddr_t, vaddr_t);
+
+ /*
* The following fields are used differently depending on
* the processor type. Think of them as an anonymous union
* of two anonymous structs.
diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c
index a7e6a6fe082..7e8f58a925d 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.46 2011/01/05 22:14:29 miod Exp $ */
+/* $OpenBSD: m8820x_machdep.c,v 1.47 2011/01/05 22:16:16 miod Exp $ */
/*
* Copyright (c) 2004, 2007, 2010, 2011, Miodrag Vallat.
*
@@ -84,6 +84,9 @@
#include <machine/m8820x.h>
#include <machine/psl.h>
+extern void m8820x_zeropage(vaddr_t);
+extern void m8820x_copypage(vaddr_t, vaddr_t);
+
cpuid_t m8820x_init(void);
void m8820x_cpu_configuration_print(int);
void m8820x_shutdown(void);
@@ -481,6 +484,9 @@ m8820x_initialize_cpu(cpuid_t cpu)
*/
apr &= ~CACHE_INH;
m8820x_cmmu_set_reg(CMMU_SAPR, apr, MODE_VAL, cpu, INST_CMMU);
+
+ ci->ci_zeropage = m8820x_zeropage;
+ ci->ci_copypage = m8820x_copypage;
}
/*
diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c
index f5990b034c2..927ae6fb2b9 100644
--- a/sys/arch/m88k/m88k/pmap.c
+++ b/sys/arch/m88k/m88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.60 2011/01/05 22:14:29 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.61 2011/01/05 22:16:16 miod Exp $ */
/*
* Copyright (c) 2001-2004, 2010, Miodrag Vallat.
@@ -1417,7 +1417,6 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg)
{
paddr_t src = VM_PAGE_TO_PHYS(srcpg);
paddr_t dst = VM_PAGE_TO_PHYS(dstpg);
- extern void copypage(vaddr_t, vaddr_t);
DPRINTF(CD_COPY, ("pmap_copy_page(%p,%p) pa %p %p\n",
srcpg, dstpg, src, dst));
@@ -1426,7 +1425,7 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg)
kernel_apr_cmode != userland_apr_cmode)
cmmu_dcache_wb(cpu_number(), src, PAGE_SIZE);
#endif
- copypage((vaddr_t)src, (vaddr_t)dst);
+ curcpu()->ci_copypage((vaddr_t)src, (vaddr_t)dst);
}
/*
@@ -1437,10 +1436,9 @@ void
pmap_zero_page(struct vm_page *pg)
{
paddr_t pa = VM_PAGE_TO_PHYS(pg);
- extern void zeropage(vaddr_t);
DPRINTF(CD_ZERO, ("pmap_zero_page(%p) pa %p\n", pg, pa));
- zeropage((vaddr_t)pa);
+ curcpu()->ci_zeropage((vaddr_t)pa);
}
/*
diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S
index 98c5733911b..bca43ad73a5 100644
--- a/sys/arch/m88k/m88k/subr.S
+++ b/sys/arch/m88k/m88k/subr.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.S,v 1.19 2010/12/23 20:05:08 miod Exp $ */
+/* $OpenBSD: subr.S,v 1.20 2011/01/05 22:16:16 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -1103,12 +1103,15 @@ GLOBAL(esigcode)
/*
* Helper functions for pmap_copy_page() and pmap_zero_page().
*/
+
+#ifdef M88100
+
/*
* void copypage(vaddr_t src, vaddr_t dst);
*
* This copies PAGE_SIZE bytes from src to dst in 32 byte chunks.
*/
-ENTRY(copypage)
+ENTRY(m8820x_copypage)
addu r12, r2, PAGE_SIZE
1:
ld.d r4, r2, 0x00
@@ -1130,7 +1133,7 @@ ENTRY(copypage)
*
* This zeroes PAGE_SIZE bytes from src to dst in 64 byte chunks.
*/
-ENTRY(zeropage)
+ENTRY(m8820x_zeropage)
addu r12, r2, PAGE_SIZE
or r3, r1, r0
or r1, r0, r0
@@ -1148,6 +1151,56 @@ ENTRY(zeropage)
bb1 ne, r4, 1b
jmp r3
+#endif /* M88100 */
+
+#ifdef M88110
+
+/*
+ * void copypage(vaddr_t src, vaddr_t dst);
+ *
+ * This copies PAGE_SIZE bytes from src to dst in 32 byte chunks (one
+ * cache line).
+ */
+ENTRY(m88110_copypage)
+ addu r12, r2, PAGE_SIZE
+1:
+ ld.h r0, r2, 0x00 # load allocate
+ ld.d r4, r2, 0x00
+ ld.d r6, r2, 0x08
+ st.d r4, r3, 0x00
+ ld.d r8, r2, 0x10
+ st.d r6, r3, 0x08
+ ld.d r10, r2, 0x18
+ st.d r8, r3, 0x10
+ addu r2, r2, 0x20
+ st.d r10, r3, 0x18
+ cmp r4, r2, r12
+ addu r3, r3, 0x20
+ bb1 ne, r4, 1b
+ jmp r1
+
+/*
+ * void zeropage(vaddr_t dst);
+ *
+ * This zeroes PAGE_SIZE bytes from src to dst in 32 byte chunks.
+ */
+ENTRY(m88110_zeropage)
+ addu r12, r2, PAGE_SIZE
+ or r3, r1, r0
+ or r1, r0, r0
+1:
+ ld.h r0, r2, 0x00 # load allocate
+ st.d r0, r2, 0x00
+ st.d r0, r2, 0x08
+ st.d r0, r2, 0x10
+ st.d r0, r2, 0x18
+ addu r2, r2, 0x20
+ cmp r4, r2, r12
+ bb1 ne, r4, 1b
+ jmp r3
+
+#endif /* M88110 */
+
/*
* PSR initialization code, invoked from locore on every processor startup.
*/
diff --git a/sys/arch/mvme88k/mvme88k/m88110.c b/sys/arch/mvme88k/mvme88k/m88110.c
index 6183761a5c6..c0f79a24f93 100644
--- a/sys/arch/mvme88k/mvme88k/m88110.c
+++ b/sys/arch/mvme88k/mvme88k/m88110.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88110.c,v 1.72 2011/01/05 22:14:39 miod Exp $ */
+/* $OpenBSD: m88110.c,v 1.73 2011/01/05 22:16:16 miod Exp $ */
/*
* Copyright (c) 2010, 2011, Miodrag Vallat.
@@ -89,6 +89,9 @@
#include <mvme88k/dev/busswreg.h>
#include <machine/mvme197.h>
+extern void m88110_zeropage(vaddr_t);
+extern void m88110_copypage(vaddr_t, vaddr_t);
+
cpuid_t m88110_init(void);
cpuid_t m88410_init(void);
void m88110_setup_board_config(void);
@@ -290,10 +293,13 @@ m88110_cpu_number(void)
void
m88110_initialize_cpu(cpuid_t cpu)
{
+ struct cpu_info *ci;
u_int ictl, dctl;
int i;
int procvers = (get_cpu_pid() & PID_VN) >> VN_SHIFT;
+ ci = &m88k_cpus[cpu];
+
/* clear BATCs */
for (i = 0; i < 8; i++) {
set_dir(i);
@@ -367,6 +373,9 @@ m88110_initialize_cpu(cpuid_t cpu)
set_isr(0);
set_dsr(0);
+
+ ci->ci_zeropage = m88110_zeropage;
+ ci->ci_copypage = m88110_copypage;
}
void