| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.328 2015/11/11 17:54:17 skrll Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.329 2015/11/13 07:55:18 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 2003 Wasabi Systems, Inc. | | 4 | * Copyright 2003 Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Steve C. Woodford for Wasabi Systems, Inc. | | 7 | * Written by Steve C. Woodford for Wasabi Systems, Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -207,27 +207,27 @@ | | | @@ -207,27 +207,27 @@ |
207 | #include <sys/kmem.h> | | 207 | #include <sys/kmem.h> |
208 | #include <sys/cdefs.h> | | 208 | #include <sys/cdefs.h> |
209 | #include <sys/cpu.h> | | 209 | #include <sys/cpu.h> |
210 | #include <sys/sysctl.h> | | 210 | #include <sys/sysctl.h> |
211 | #include <sys/bus.h> | | 211 | #include <sys/bus.h> |
212 | #include <sys/atomic.h> | | 212 | #include <sys/atomic.h> |
213 | #include <sys/kernhist.h> | | 213 | #include <sys/kernhist.h> |
214 | | | 214 | |
215 | #include <uvm/uvm.h> | | 215 | #include <uvm/uvm.h> |
216 | #include <uvm/pmap/pmap_pvt.h> | | 216 | #include <uvm/pmap/pmap_pvt.h> |
217 | | | 217 | |
218 | #include <arm/locore.h> | | 218 | #include <arm/locore.h> |
219 | | | 219 | |
220 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.328 2015/11/11 17:54:17 skrll Exp $"); | | 220 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.329 2015/11/13 07:55:18 skrll Exp $"); |
221 | | | 221 | |
222 | //#define PMAP_DEBUG | | 222 | //#define PMAP_DEBUG |
223 | #ifdef PMAP_DEBUG | | 223 | #ifdef PMAP_DEBUG |
224 | | | 224 | |
225 | /* XXX need to get rid of all refs to this */ | | 225 | /* XXX need to get rid of all refs to this */ |
226 | int pmap_debug_level = 0; | | 226 | int pmap_debug_level = 0; |
227 | | | 227 | |
228 | /* | | 228 | /* |
229 | * for switching to potentially finer grained debugging | | 229 | * for switching to potentially finer grained debugging |
230 | */ | | 230 | */ |
231 | #define PDB_FOLLOW 0x0001 | | 231 | #define PDB_FOLLOW 0x0001 |
232 | #define PDB_INIT 0x0002 | | 232 | #define PDB_INIT 0x0002 |
233 | #define PDB_ENTER 0x0004 | | 233 | #define PDB_ENTER 0x0004 |
| @@ -4999,27 +4999,31 @@ pmap_deactivate(struct lwp *l) | | | @@ -4999,27 +4999,31 @@ pmap_deactivate(struct lwp *l) |
4999 | curcpu()->ci_lastlwp = NULL; | | 4999 | curcpu()->ci_lastlwp = NULL; |
5000 | | | 5000 | |
5001 | pm->pm_activated = false; | | 5001 | pm->pm_activated = false; |
5002 | #endif | | 5002 | #endif |
5003 | UVMHIST_LOG(maphist, " <-- done", 0, 0, 0, 0); | | 5003 | UVMHIST_LOG(maphist, " <-- done", 0, 0, 0, 0); |
5004 | } | | 5004 | } |
5005 | | | 5005 | |
5006 | void | | 5006 | void |
5007 | pmap_update(pmap_t pm) | | 5007 | pmap_update(pmap_t pm) |
5008 | { | | 5008 | { |
5009 | | | 5009 | |
5010 | if (pm->pm_remove_all) { | | 5010 | if (pm->pm_remove_all) { |
5011 | #ifdef ARM_MMU_EXTENDED | | 5011 | #ifdef ARM_MMU_EXTENDED |
5012 | KASSERTMSG(curcpu()->ci_pmap_cur != pm || pm->pm_pai[0].pai_asid == curcpu()->ci_pmap_asid_cur, "pmap/asid %p/%#x != %s cur pmap/asid %p/%#x", pm, pm->pm_pai[0].pai_asid, curcpu()->ci_data.cpu_name, curcpu()->ci_pmap_cur, curcpu()->ci_pmap_asid_cur); | | 5012 | KASSERTMSG(curcpu()->ci_pmap_cur != pm |
| | | 5013 | || pm->pm_pai[0].pai_asid == curcpu()->ci_pmap_asid_cur, |
| | | 5014 | "pmap/asid %p/%#x != %s cur pmap/asid %p/%#x", pm, |
| | | 5015 | pm->pm_pai[0].pai_asid, curcpu()->ci_data.cpu_name, |
| | | 5016 | curcpu()->ci_pmap_cur, curcpu()->ci_pmap_asid_cur); |
5013 | /* | | 5017 | /* |
5014 | * Finish up the pmap_remove_all() optimisation by flushing | | 5018 | * Finish up the pmap_remove_all() optimisation by flushing |
5015 | * all our ASIDs. | | 5019 | * all our ASIDs. |
5016 | */ | | 5020 | */ |
5017 | pmap_tlb_asid_release_all(pm); | | 5021 | pmap_tlb_asid_release_all(pm); |
5018 | #else | | 5022 | #else |
5019 | /* | | 5023 | /* |
5020 | * Finish up the pmap_remove_all() optimisation by flushing | | 5024 | * Finish up the pmap_remove_all() optimisation by flushing |
5021 | * the TLB. | | 5025 | * the TLB. |
5022 | */ | | 5026 | */ |
5023 | pmap_tlb_flushID(pm); | | 5027 | pmap_tlb_flushID(pm); |
5024 | #endif | | 5028 | #endif |
5025 | pm->pm_remove_all = false; | | 5029 | pm->pm_remove_all = false; |
| @@ -5028,27 +5032,32 @@ pmap_update(pmap_t pm) | | | @@ -5028,27 +5032,32 @@ pmap_update(pmap_t pm) |
5028 | #ifdef ARM_MMU_EXTENDED | | 5032 | #ifdef ARM_MMU_EXTENDED |
5029 | #if defined(MULTIPROCESSOR) | | 5033 | #if defined(MULTIPROCESSOR) |
5030 | armreg_bpiallis_write(0); | | 5034 | armreg_bpiallis_write(0); |
5031 | #else | | 5035 | #else |
5032 | armreg_bpiall_write(0); | | 5036 | armreg_bpiall_write(0); |
5033 | #endif | | 5037 | #endif |
5034 | | | 5038 | |
5035 | #if defined(MULTIPROCESSOR) && PMAP_MAX_TLB > 1 | | 5039 | #if defined(MULTIPROCESSOR) && PMAP_MAX_TLB > 1 |
5036 | u_int pending = atomic_swap_uint(&pmap->pm_shootdown_pending, 0); | | 5040 | u_int pending = atomic_swap_uint(&pmap->pm_shootdown_pending, 0); |
5037 | if (pending && pmap_tlb_shootdown_bystanders(pmap)) { | | 5041 | if (pending && pmap_tlb_shootdown_bystanders(pmap)) { |
5038 | PMAP_COUNT(shootdown_ipis); | | 5042 | PMAP_COUNT(shootdown_ipis); |
5039 | } | | 5043 | } |
5040 | #endif | | 5044 | #endif |
5041 | KASSERTMSG(curcpu()->ci_pmap_cur != pm || pm->pm_pai[0].pai_asid == curcpu()->ci_pmap_asid_cur, "pmap/asid %p/%#x != %s cur pmap/asid %p/%#x", pm, pm->pm_pai[0].pai_asid, curcpu()->ci_data.cpu_name, curcpu()->ci_pmap_cur, curcpu()->ci_pmap_asid_cur); | | 5045 | |
| | | 5046 | KASSERTMSG(curcpu()->ci_pmap_cur != pm |
| | | 5047 | || pm->pm_pai[0].pai_asid == curcpu()->ci_pmap_asid_cur, |
| | | 5048 | "pmap/asid %p/%#x != %s cur pmap/asid %p/%#x", pm, |
| | | 5049 | pm->pm_pai[0].pai_asid, curcpu()->ci_data.cpu_name, |
| | | 5050 | curcpu()->ci_pmap_cur, curcpu()->ci_pmap_asid_cur); |
5042 | #else | | 5051 | #else |
5043 | if (pmap_is_current(pm)) { | | 5052 | if (pmap_is_current(pm)) { |
5044 | /* | | 5053 | /* |
5045 | * If we're dealing with a current userland pmap, move its L1 | | 5054 | * If we're dealing with a current userland pmap, move its L1 |
5046 | * to the end of the LRU. | | 5055 | * to the end of the LRU. |
5047 | */ | | 5056 | */ |
5048 | if (pm != pmap_kernel()) | | 5057 | if (pm != pmap_kernel()) |
5049 | pmap_use_l1(pm); | | 5058 | pmap_use_l1(pm); |
5050 | | | 5059 | |
5051 | /* | | 5060 | /* |
5052 | * We can assume we're done with frobbing the cache/tlb for | | 5061 | * We can assume we're done with frobbing the cache/tlb for |
5053 | * now. Make sure any future pmap ops don't skip cache/tlb | | 5062 | * now. Make sure any future pmap ops don't skip cache/tlb |
5054 | * flushes. | | 5063 | * flushes. |