| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap_machdep.c,v 1.27 2020/03/11 13:30:31 thorpej Exp $ */ | | 1 | /* $NetBSD: pmap_machdep.c,v 1.28 2020/07/30 07:31:30 skrll Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center and by Chris G. Demetriou. | | 9 | * NASA Ames Research Center and by Chris G. Demetriou. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -57,27 +57,27 @@ | | | @@ -57,27 +57,27 @@ |
57 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 57 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
58 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 58 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
59 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 59 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 60 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 61 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 62 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
63 | * SUCH DAMAGE. | | 63 | * SUCH DAMAGE. |
64 | * | | 64 | * |
65 | * @(#)pmap.c 8.4 (Berkeley) 1/26/94 | | 65 | * @(#)pmap.c 8.4 (Berkeley) 1/26/94 |
66 | */ | | 66 | */ |
67 | | | 67 | |
68 | #include <sys/cdefs.h> | | 68 | #include <sys/cdefs.h> |
69 | | | 69 | |
70 | __KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.27 2020/03/11 13:30:31 thorpej Exp $"); | | 70 | __KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.28 2020/07/30 07:31:30 skrll Exp $"); |
71 | | | 71 | |
72 | /* | | 72 | /* |
73 | * Manages physical address maps. | | 73 | * Manages physical address maps. |
74 | * | | 74 | * |
75 | * In addition to hardware address maps, this | | 75 | * In addition to hardware address maps, this |
76 | * module is called upon to provide software-use-only | | 76 | * module is called upon to provide software-use-only |
77 | * maps which may or may not be stored in the same | | 77 | * maps which may or may not be stored in the same |
78 | * form as hardware maps. These pseudo-maps are | | 78 | * form as hardware maps. These pseudo-maps are |
79 | * used to store intermediate results from copy | | 79 | * used to store intermediate results from copy |
80 | * operations to and from address spaces. | | 80 | * operations to and from address spaces. |
81 | * | | 81 | * |
82 | * Since the information managed by this module is | | 82 | * Since the information managed by this module is |
83 | * also stored by the logical address mapping module, | | 83 | * also stored by the logical address mapping module, |
| @@ -694,30 +694,30 @@ pmap_md_page_syncicache(struct vm_page * | | | @@ -694,30 +694,30 @@ pmap_md_page_syncicache(struct vm_page * |
694 | PAGE_SIZE); | | 694 | PAGE_SIZE); |
695 | } | | 695 | } |
696 | #ifdef MULTIPROCESSOR | | 696 | #ifdef MULTIPROCESSOR |
697 | pv_entry_t pv = &mdpg->mdpg_first; | | 697 | pv_entry_t pv = &mdpg->mdpg_first; |
698 | const register_t va = (intptr_t)trunc_page(pv->pv_va); | | 698 | const register_t va = (intptr_t)trunc_page(pv->pv_va); |
699 | pmap_tlb_syncicache(va, onproc); | | 699 | pmap_tlb_syncicache(va, onproc); |
700 | #endif | | 700 | #endif |
701 | } | | 701 | } |
702 | | | 702 | |
703 | struct vm_page * | | 703 | struct vm_page * |
704 | pmap_md_alloc_poolpage(int flags) | | 704 | pmap_md_alloc_poolpage(int flags) |
705 | { | | 705 | { |
706 | /* | | 706 | /* |
707 | * On 32bit kernels, we must make sure that we only allocate pages that | | 707 | * The VM_FREELIST used for pool pages is only set on 32bit kernels. |
708 | * can be mapped via KSEG0. On 64bit kernels, try to allocated from | | 708 | * This is to must make sure that we only allocate pages that |
709 | * the first 4G. If all memory is in KSEG0/4G, then we can just | | 709 | * can be mapped via KSEG0. On 64bit kernels, all memory can be |
710 | * use the default freelist otherwise we must use the pool page list. | | 710 | * mapped via XKPHYS so just use the default freelist. |
711 | */ | | 711 | */ |
712 | if (mips_poolpage_vmfreelist != VM_FREELIST_DEFAULT) | | 712 | if (mips_poolpage_vmfreelist != VM_FREELIST_DEFAULT) |
713 | return uvm_pagealloc_strat(NULL, 0, NULL, flags, | | 713 | return uvm_pagealloc_strat(NULL, 0, NULL, flags, |
714 | UVM_PGA_STRAT_ONLY, mips_poolpage_vmfreelist); | | 714 | UVM_PGA_STRAT_ONLY, mips_poolpage_vmfreelist); |
715 | | | 715 | |
716 | return uvm_pagealloc(NULL, 0, NULL, flags); | | 716 | return uvm_pagealloc(NULL, 0, NULL, flags); |
717 | } | | 717 | } |
718 | | | 718 | |
719 | vaddr_t | | 719 | vaddr_t |
720 | pmap_md_map_poolpage(paddr_t pa, size_t len) | | 720 | pmap_md_map_poolpage(paddr_t pa, size_t len) |
721 | { | | 721 | { |
722 | | | 722 | |
723 | struct vm_page * const pg = PHYS_TO_VM_PAGE(pa); | | 723 | struct vm_page * const pg = PHYS_TO_VM_PAGE(pa); |