| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.143 2022/10/23 07:04:44 skrll Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.144 2022/10/28 06:22:26 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org> | | 4 | * Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | | 19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | | 20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | | 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.143 2022/10/23 07:04:44 skrll Exp $"); | | 30 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.144 2022/10/28 06:22:26 skrll Exp $"); |
31 | | | 31 | |
32 | #include "opt_arm_debug.h" | | 32 | #include "opt_arm_debug.h" |
33 | #include "opt_cpuoptions.h" | | 33 | #include "opt_cpuoptions.h" |
34 | #include "opt_ddb.h" | | 34 | #include "opt_ddb.h" |
35 | #include "opt_efi.h" | | 35 | #include "opt_efi.h" |
36 | #include "opt_modular.h" | | 36 | #include "opt_modular.h" |
37 | #include "opt_multiprocessor.h" | | 37 | #include "opt_multiprocessor.h" |
38 | #include "opt_pmap.h" | | 38 | #include "opt_pmap.h" |
39 | #include "opt_uvmhist.h" | | 39 | #include "opt_uvmhist.h" |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/types.h> | | 42 | #include <sys/types.h> |
43 | | | 43 | |
| @@ -189,27 +189,26 @@ PMAP_COUNTER(unwire_failure, "pmap_unwir | | | @@ -189,27 +189,26 @@ PMAP_COUNTER(unwire_failure, "pmap_unwir |
189 | #define PDPSWEEP_TRIGGER 512 | | 189 | #define PDPSWEEP_TRIGGER 512 |
190 | | | 190 | |
191 | static pt_entry_t *_pmap_pte_lookup_l3(struct pmap *, vaddr_t); | | 191 | static pt_entry_t *_pmap_pte_lookup_l3(struct pmap *, vaddr_t); |
192 | static pt_entry_t *_pmap_pte_lookup_bs(struct pmap *, vaddr_t, vsize_t *); | | 192 | static pt_entry_t *_pmap_pte_lookup_bs(struct pmap *, vaddr_t, vsize_t *); |
193 | static pt_entry_t _pmap_pte_adjust_prot(pt_entry_t, vm_prot_t, vm_prot_t, bool); | | 193 | static pt_entry_t _pmap_pte_adjust_prot(pt_entry_t, vm_prot_t, vm_prot_t, bool); |
194 | static pt_entry_t _pmap_pte_adjust_cacheflags(pt_entry_t, u_int); | | 194 | static pt_entry_t _pmap_pte_adjust_cacheflags(pt_entry_t, u_int); |
195 | static void _pmap_remove(struct pmap *, vaddr_t, vaddr_t, bool, | | 195 | static void _pmap_remove(struct pmap *, vaddr_t, vaddr_t, bool, |
196 | struct pv_entry **); | | 196 | struct pv_entry **); |
197 | static int _pmap_enter(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int, bool); | | 197 | static int _pmap_enter(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int, bool); |
198 | static int _pmap_get_pdp(struct pmap *, vaddr_t, bool, int, paddr_t *, | | 198 | static int _pmap_get_pdp(struct pmap *, vaddr_t, bool, int, paddr_t *, |
199 | struct vm_page **); | | 199 | struct vm_page **); |
200 | | | 200 | |
201 | static struct pmap kernel_pmap __cacheline_aligned; | | 201 | static struct pmap kernel_pmap __cacheline_aligned; |
202 | | | | |
203 | struct pmap * const kernel_pmap_ptr = &kernel_pmap; | | 202 | struct pmap * const kernel_pmap_ptr = &kernel_pmap; |
204 | | | 203 | |
205 | #if defined(EFI_RUNTIME) | | 204 | #if defined(EFI_RUNTIME) |
206 | static struct pmap efirt_pmap __cacheline_aligned; | | 205 | static struct pmap efirt_pmap __cacheline_aligned; |
207 | | | 206 | |
208 | pmap_t | | 207 | pmap_t |
209 | pmap_efirt(void) | | 208 | pmap_efirt(void) |
210 | { | | 209 | { |
211 | return &efirt_pmap; | | 210 | return &efirt_pmap; |
212 | } | | 211 | } |
213 | #endif | | 212 | #endif |
214 | | | 213 | |
215 | static vaddr_t pmap_maxkvaddr; | | 214 | static vaddr_t pmap_maxkvaddr; |
| @@ -2863,27 +2862,25 @@ pmap_is_referenced(struct vm_page *pg) | | | @@ -2863,27 +2862,25 @@ pmap_is_referenced(struct vm_page *pg) |
2863 | return false; | | 2862 | return false; |
2864 | } | | 2863 | } |
2865 | | | 2864 | |
2866 | /* get pointer to kernel segment L2 or L3 table entry */ | | 2865 | /* get pointer to kernel segment L2 or L3 table entry */ |
2867 | pt_entry_t * | | 2866 | pt_entry_t * |
2868 | kvtopte(vaddr_t va) | | 2867 | kvtopte(vaddr_t va) |
2869 | { | | 2868 | { |
2870 | KASSERT(IN_RANGE(va, VM_MIN_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS)); | | 2869 | KASSERT(IN_RANGE(va, VM_MIN_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS)); |
2871 | | | 2870 | |
2872 | return _pmap_pte_lookup_bs(pmap_kernel(), va, NULL); | | 2871 | return _pmap_pte_lookup_bs(pmap_kernel(), va, NULL); |
2873 | } | | 2872 | } |
2874 | | | 2873 | |
2875 | #ifdef DDB | | 2874 | #ifdef DDB |
2876 | | | | |
2877 | void | | 2875 | void |
2878 | pmap_db_pmap_print(struct pmap *pm, | | 2876 | pmap_db_pmap_print(struct pmap *pm, |
2879 | void (*pr)(const char *, ...) __printflike(1, 2)) | | 2877 | void (*pr)(const char *, ...) __printflike(1, 2)) |
2880 | { | | 2878 | { |
2881 | struct pmap_asid_info * const pai = PMAP_PAI(pm, cpu_tlb_info(ci)); | | 2879 | struct pmap_asid_info * const pai = PMAP_PAI(pm, cpu_tlb_info(ci)); |
2882 | | | 2880 | |
2883 | pr(" pm_asid = %d\n", pai->pai_asid); | | 2881 | pr(" pm_asid = %d\n", pai->pai_asid); |
2884 | pr(" pm_l0table = %p\n", pm->pm_l0table); | | 2882 | pr(" pm_l0table = %p\n", pm->pm_l0table); |
2885 | pr(" pm_l0table_pa = %lx\n", pm->pm_l0table_pa); | | 2883 | pr(" pm_l0table_pa = %lx\n", pm->pm_l0table_pa); |
2886 | pr(" pm_activated = %d\n\n", pm->pm_activated); | | 2884 | pr(" pm_activated = %d\n\n", pm->pm_activated); |
2887 | } | | 2885 | } |
2888 | #endif /* DDB */ | | 2886 | #endif /* DDB */ |
2889 | | | | |