| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.339 2016/08/03 15:59:58 skrll Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.340 2016/08/04 08:46:06 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.339 2016/08/03 15:59:58 skrll Exp $"); | | 220 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.340 2016/08/04 08:46:06 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 |
| @@ -5012,30 +5012,31 @@ pmap_remove_all_complete(pmap_t pm) | | | @@ -5012,30 +5012,31 @@ pmap_remove_all_complete(pmap_t pm) |
5012 | * Finish up the pmap_remove_all() optimisation by flushing | | 5012 | * Finish up the pmap_remove_all() optimisation by flushing |
5013 | * all our ASIDs. | | 5013 | * all our ASIDs. |
5014 | */ | | 5014 | */ |
5015 | #ifdef MULTIPROCESSOR | | 5015 | #ifdef MULTIPROCESSOR |
5016 | // This should be the last CPU with this pmap onproc | | 5016 | // This should be the last CPU with this pmap onproc |
5017 | // KASSERT(!kcpuset_isotherset(pm->pm_onproc, cpu_index(curcpu()))); | | 5017 | // KASSERT(!kcpuset_isotherset(pm->pm_onproc, cpu_index(curcpu()))); |
5018 | #if PMAP_TLB_MAX > 1 | | 5018 | #if PMAP_TLB_MAX > 1 |
5019 | for (u_int i = 0; !kcpuset_iszero(pm->pm_active); i++) { | | 5019 | for (u_int i = 0; !kcpuset_iszero(pm->pm_active); i++) { |
5020 | KASSERT(i < pmap_ntlbs); | | 5020 | KASSERT(i < pmap_ntlbs); |
5021 | struct pmap_tlb_info * const ti = pmap_tlbs[i]; | | 5021 | struct pmap_tlb_info * const ti = pmap_tlbs[i]; |
5022 | #else | | 5022 | #else |
5023 | struct pmap_tlb_info * const ti = &pmap_tlb0_info; | | 5023 | struct pmap_tlb_info * const ti = &pmap_tlb0_info; |
5024 | #endif | | 5024 | #endif |
| | | 5025 | struct cpu_info * const ci = curcpu(); |
5025 | TLBINFO_LOCK(ti); | | 5026 | TLBINFO_LOCK(ti); |
5026 | struct pmap_asid_info * const pai = PMAP_PAI(pm, ti); | | 5027 | struct pmap_asid_info * const pai = PMAP_PAI(pm, ti); |
5027 | if (PMAP_PAI_ASIDVALID_P(pai, ti)) { | | 5028 | if (PMAP_PAI_ASIDVALID_P(pai, ti)) { |
5028 | if (kcpuset_isset(pm->pm_onproc, cpu_index(curcpu()))) { | | 5029 | if (kcpuset_isset(pm->pm_onproc, cpu_index(ci))) { |
5029 | #if PMAP_TLB_MAX == 1 | | 5030 | #if PMAP_TLB_MAX == 1 |
5030 | KASSERT(cpu_tlb_info(ci) == ti); | | 5031 | KASSERT(cpu_tlb_info(ci) == ti); |
5031 | | | 5032 | |
5032 | tlb_invalidate_asids(pai->pai_asid, | | 5033 | tlb_invalidate_asids(pai->pai_asid, |
5033 | pai->pai_asid); | | 5034 | pai->pai_asid); |
5034 | #else | | 5035 | #else |
5035 | if (cpu_tlb_info(ci) == ti) { | | 5036 | if (cpu_tlb_info(ci) == ti) { |
5036 | tlb_invalidate_asids(pai->pai_asid, | | 5037 | tlb_invalidate_asids(pai->pai_asid, |
5037 | pai->pai_asid); | | 5038 | pai->pai_asid); |
5038 | } else { | | 5039 | } else { |
5039 | pm->pm_shootdown_needed = 1; | | 5040 | pm->pm_shootdown_needed = 1; |
5040 | } | | 5041 | } |
5041 | #endif | | 5042 | #endif |