diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2005-09-25 20:55:16 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2005-09-25 20:55:16 +0000 |
commit | 32d39117d55efd5f59740cb603ac1cb5972966f7 (patch) | |
tree | eedd41fc6df8de2b013aa528ae5a49920d201c7f /sys | |
parent | 56105db4443c9fe5708cf92279632c9410d5ba0a (diff) |
Change the size parameter of cmmu_flush_tlb() from bytes to pages. This makes
things easier for the callers, and allows us to inline the "fewer than 4 pages"
situation for speed.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/m88k/include/cmmu.h | 4 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m8820x_machdep.c | 43 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m88k_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/pmap.c | 21 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/vm_machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/mainbus.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m88110.c | 7 |
7 files changed, 41 insertions, 46 deletions
diff --git a/sys/arch/m88k/include/cmmu.h b/sys/arch/m88k/include/cmmu.h index 18c5cbda4d8..6a31cbaf8bb 100644 --- a/sys/arch/m88k/include/cmmu.h +++ b/sys/arch/m88k/include/cmmu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmmu.h,v 1.8 2005/04/27 14:09:45 miod Exp $ */ +/* $OpenBSD: cmmu.h,v 1.9 2005/09/25 20:55:13 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -57,7 +57,7 @@ struct cmmu_p { unsigned (*cmmu_cpu_number_func)(void); void (*cmmu_set_sapr_func)(unsigned, unsigned); void (*cmmu_set_uapr_func)(unsigned); - void (*cmmu_flush_tlb_func)(unsigned, unsigned, vaddr_t, vsize_t); + void (*cmmu_flush_tlb_func)(unsigned, unsigned, vaddr_t, u_int); void (*cmmu_flush_cache_func)(int, paddr_t, psize_t); void (*cmmu_flush_inst_cache_func)(int, paddr_t, psize_t); void (*cmmu_flush_data_cache_func)(int, paddr_t, psize_t); diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c index a45a06a4d10..77b406fa4fa 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.6 2005/07/01 14:09:26 miod Exp $ */ +/* $OpenBSD: m8820x_machdep.c,v 1.7 2005/09/25 20:55:14 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * @@ -111,7 +111,7 @@ void m8820x_cmmu_shutdown_now(void); void m8820x_cmmu_parity_enable(void); void m8820x_cmmu_set_sapr(unsigned, unsigned); void m8820x_cmmu_set_uapr(unsigned); -void m8820x_cmmu_flush_tlb(unsigned, unsigned, vaddr_t, vsize_t); +void m8820x_cmmu_flush_tlb(unsigned, unsigned, vaddr_t, u_int); void m8820x_cmmu_flush_cache(int, paddr_t, psize_t); void m8820x_cmmu_flush_inst_cache(int, paddr_t, psize_t); void m8820x_cmmu_flush_data_cache(int, paddr_t, psize_t); @@ -161,7 +161,7 @@ struct cmmu_p cmmu8820x = { * access to SRAM. * * MVME188 configuration 6, with 4 CMMUs par CPU, also forces a split on - * A14 address bit. + * A14 address bit (A16 for 88204). * * Under OpenBSD, we will only split on A12 and A14 address bits, since we * do not want to waste CMMU resources on the SRAM, and user/supervisor @@ -509,8 +509,7 @@ m8820x_cmmu_set_uapr(unsigned ap) * flush any tlb */ void -m8820x_cmmu_flush_tlb(unsigned cpu, unsigned kernel, vaddr_t vaddr, - vsize_t size) +m8820x_cmmu_flush_tlb(unsigned cpu, unsigned kernel, vaddr_t vaddr, u_int count) { int s = splhigh(); @@ -521,29 +520,35 @@ m8820x_cmmu_flush_tlb(unsigned cpu, unsigned kernel, vaddr_t vaddr, * do any here. Invalidations of up to three pages are performed * as page invalidations, otherwise the entire tlb is flushed. * - * Note that this code relies upon size being a multiple of - * a page and vaddr being page-aligned. + * Note that this code relies upon vaddr being page-aligned. */ - if (size == PAGE_SIZE) { /* most frequent situation */ - m8820x_cmmu_set(CMMU_SAR, vaddr, - ADDR_VAL, cpu, 0, vaddr); - m8820x_cmmu_set(CMMU_SCR, - kernel ? CMMU_FLUSH_SUPER_PAGE : CMMU_FLUSH_USER_PAGE, - ADDR_VAL, cpu, 0, vaddr); - } else if (size > 3 * PAGE_SIZE) { + switch (count) { + default: m8820x_cmmu_set(CMMU_SCR, kernel ? CMMU_FLUSH_SUPER_ALL : CMMU_FLUSH_USER_ALL, 0, cpu, 0, 0); - } else - while (size != 0) { - m8820x_cmmu_set(CMMU_SAR, vaddr, + break; + case 3: + m8820x_cmmu_set(CMMU_SAR, vaddr, ADDR_VAL, cpu, 0, vaddr); + m8820x_cmmu_set(CMMU_SCR, + kernel ? CMMU_FLUSH_SUPER_PAGE : CMMU_FLUSH_USER_PAGE, ADDR_VAL, cpu, 0, vaddr); + vaddr += PAGE_SIZE; + /* FALLTHROUGH */ + case 2: + m8820x_cmmu_set(CMMU_SAR, vaddr, ADDR_VAL, cpu, 0, vaddr); m8820x_cmmu_set(CMMU_SCR, kernel ? CMMU_FLUSH_SUPER_PAGE : CMMU_FLUSH_USER_PAGE, ADDR_VAL, cpu, 0, vaddr); - - size -= PAGE_SIZE; vaddr += PAGE_SIZE; + /* FALLTHROUGH */ + case 1: /* most frequent situation */ + case 0: + m8820x_cmmu_set(CMMU_SAR, vaddr, ADDR_VAL, cpu, 0, vaddr); + m8820x_cmmu_set(CMMU_SCR, + kernel ? CMMU_FLUSH_SUPER_PAGE : CMMU_FLUSH_USER_PAGE, + ADDR_VAL, cpu, 0, vaddr); + break; } CMMU_UNLOCK; diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c index 931b5026d92..bb177893c5d 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.3 2005/04/30 16:44:08 miod Exp $ */ +/* $OpenBSD: m88k_machdep.c,v 1.4 2005/09/25 20:55:14 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -114,7 +114,7 @@ load_u_area(struct proc *p) *t = p->p_md.md_upte[i]; va += PAGE_SIZE; } - cmmu_flush_tlb(cpu_number(), 1, UADDR, USPACE); + cmmu_flush_tlb(cpu_number(), 1, UADDR, UPAGES); } /* diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c index b61c8447ee2..6c985e948f9 100644 --- a/sys/arch/m88k/m88k/pmap.c +++ b/sys/arch/m88k/m88k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.11 2005/09/15 21:07:05 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.12 2005/09/25 20:55:14 miod Exp $ */ /* * Copyright (c) 2001-2004, Miodrag Vallat * Copyright (c) 1998-2001 Steve Murphree, Jr. @@ -224,13 +224,13 @@ flush_atc_entry(long users, vaddr_t va, boolean_t kernel) while ((cpu = ff1(users)) != 32) { if (cpu_sets[cpu]) { /* just checking to make sure */ - cmmu_flush_tlb(cpu, kernel, va, PAGE_SIZE); + cmmu_flush_tlb(cpu, kernel, va, 1); } users &= ~(1 << cpu); } #else if (users != 0) - cmmu_flush_tlb(cpu_number(), kernel, va, PAGE_SIZE); + cmmu_flush_tlb(cpu_number(), kernel, va, 1); #endif } @@ -255,13 +255,6 @@ pmap_pte(pmap_t pmap, vaddr_t virt) { sdt_entry_t *sdt; -#ifdef DEBUG - /*XXX will this change if physical memory is not contiguous? */ - /* take a look at PDTIDX XXXnivas */ - if (pmap == PMAP_NULL) - panic("pmap_pte: pmap is NULL"); -#endif - sdt = SDTENT(pmap, virt); /* * Check whether page table exists. @@ -752,7 +745,7 @@ pmap_bootstrap(vaddr_t load_start) for (i = 0; i < MAX_CPUS; i++) if (cpu_sets[i]) { cmmu_flush_tlb(i, TRUE, VM_MIN_KERNEL_ADDRESS, - VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS); + btoc(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS)); /* Load supervisor pointer to segment table. */ cmmu_set_sapr(i, kernel_pmap->pm_apr); #ifdef DEBUG @@ -828,7 +821,7 @@ pmap_zero_page(struct vm_page *pg) * We don't need the flush_atc_entry() dance, as these pages are * bound to only one cpu. */ - cmmu_flush_tlb(cpu, TRUE, va, PAGE_SIZE); + cmmu_flush_tlb(cpu, TRUE, va, 1); /* * The page is likely to be a non-kernel mapping, and as @@ -1997,7 +1990,7 @@ pmap_activate(struct proc *p) cmmu_set_uapr(pmap->pm_apr); cmmu_flush_tlb(cpu, FALSE, VM_MIN_ADDRESS, - VM_MAX_ADDRESS - VM_MIN_ADDRESS); + btoc(VM_MAX_ADDRESS - VM_MIN_ADDRESS)); /* * Mark that this cpu is using the pmap. @@ -2078,7 +2071,7 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) * We don't need the flush_atc_entry() dance, as these pages are * bound to only one cpu. */ - cmmu_flush_tlb(cpu, TRUE, dstva, 2 * PAGE_SIZE); + cmmu_flush_tlb(cpu, TRUE, dstva, 2); /* * The source page is likely to be a non-kernel mapping, and as diff --git a/sys/arch/m88k/m88k/vm_machdep.c b/sys/arch/m88k/m88k/vm_machdep.c index 45439bb17c6..493f33d110d 100644 --- a/sys/arch/m88k/m88k/vm_machdep.c +++ b/sys/arch/m88k/m88k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.4 2004/11/09 15:02:22 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.5 2005/09/25 20:55:14 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. @@ -277,7 +277,7 @@ vmapbuf(bp, len) * new pages get mapped in. */ - cmmu_flush_tlb(cpu_number(), 1, kva, len); + cmmu_flush_tlb(cpu_number(), 1, kva, btoc(len)); bp->b_data = (caddr_t)(kva + off); while (len > 0) { diff --git a/sys/arch/mvme88k/dev/mainbus.c b/sys/arch/mvme88k/dev/mainbus.c index bc82805a4ce..045afcd841f 100644 --- a/sys/arch/mvme88k/dev/mainbus.c +++ b/sys/arch/mvme88k/dev/mainbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mainbus.c,v 1.14 2004/11/09 15:02:23 miod Exp $ */ +/* $OpenBSD: mainbus.c,v 1.15 2005/09/25 20:55:15 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 2004, Miodrag Vallat. @@ -175,8 +175,6 @@ mapiodev(pa, size) if (error != 0) return NULL; - cmmu_flush_tlb(cpu_number(), 1, iova, size); /* necessary? */ - tva = iova; while (size != 0) { pmap_enter(vm_map_pmap(iomap_map), tva, ppa, diff --git a/sys/arch/mvme88k/mvme88k/m88110.c b/sys/arch/mvme88k/mvme88k/m88110.c index df6ee5d1929..b171567fe9f 100644 --- a/sys/arch/mvme88k/mvme88k/m88110.c +++ b/sys/arch/mvme88k/mvme88k/m88110.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88110.c,v 1.22 2005/09/06 19:43:00 miod Exp $ */ +/* $OpenBSD: m88110.c,v 1.23 2005/09/25 20:55:15 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * All rights reserved. @@ -105,7 +105,7 @@ void m88110_cmmu_parity_enable(void); unsigned m88110_cmmu_cpu_number(void); void m88110_cmmu_set_sapr(unsigned, unsigned); void m88110_cmmu_set_uapr(unsigned); -void m88110_cmmu_flush_tlb(unsigned, unsigned, vaddr_t, vsize_t); +void m88110_cmmu_flush_tlb(unsigned, unsigned, vaddr_t, u_int); void m88110_cmmu_flush_cache(int, paddr_t, psize_t); void m88110_cmmu_flush_inst_cache(int, paddr_t, psize_t); void m88110_cmmu_flush_data_cache(int, paddr_t, psize_t); @@ -369,8 +369,7 @@ m88110_cmmu_set_uapr(unsigned ap) * flush any tlb */ void -m88110_cmmu_flush_tlb(unsigned cpu, unsigned kernel, vaddr_t vaddr, - vsize_t size) +m88110_cmmu_flush_tlb(unsigned cpu, unsigned kernel, vaddr_t vaddr, u_int count) { u_int32_t psr; |