| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pmap.c,v 1.107 2020/04/15 09:41:09 skrll Exp $ */ | | 1 | /* $NetBSD: pmap.c,v 1.108 2020/04/15 15:22:37 skrll Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2001, 2002 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 Matthew Fredette. | | 8 | * by Matthew Fredette. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -55,27 +55,27 @@ | | | @@ -55,27 +55,27 @@ |
55 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | | 55 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
56 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | | 56 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
57 | * THE POSSIBILITY OF SUCH DAMAGE. | | 57 | * THE POSSIBILITY OF SUCH DAMAGE. |
58 | */ | | 58 | */ |
59 | /* | | 59 | /* |
60 | * References: | | 60 | * References: |
61 | * 1. PA7100LC ERS, Hewlett-Packard, March 30 1999, Public version 1.0 | | 61 | * 1. PA7100LC ERS, Hewlett-Packard, March 30 1999, Public version 1.0 |
62 | * 2. PA7300LC ERS, Hewlett-Packard, March 18 1996, Version 1.0 | | 62 | * 2. PA7300LC ERS, Hewlett-Packard, March 18 1996, Version 1.0 |
63 | * 3. PA-RISC 1.1 Architecture and Instruction Set Reference Manual, | | 63 | * 3. PA-RISC 1.1 Architecture and Instruction Set Reference Manual, |
64 | * Hewlett-Packard, February 1994, Third Edition | | 64 | * Hewlett-Packard, February 1994, Third Edition |
65 | */ | | 65 | */ |
66 | | | 66 | |
67 | #include <sys/cdefs.h> | | 67 | #include <sys/cdefs.h> |
68 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.107 2020/04/15 09:41:09 skrll Exp $"); | | 68 | __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2020/04/15 15:22:37 skrll Exp $"); |
69 | | | 69 | |
70 | #include "opt_cputype.h" | | 70 | #include "opt_cputype.h" |
71 | | | 71 | |
72 | #include <sys/param.h> | | 72 | #include <sys/param.h> |
73 | #include <sys/mutex.h> | | 73 | #include <sys/mutex.h> |
74 | #include <sys/proc.h> | | 74 | #include <sys/proc.h> |
75 | #include <sys/rwlock.h> | | 75 | #include <sys/rwlock.h> |
76 | #include <sys/systm.h> | | 76 | #include <sys/systm.h> |
77 | | | 77 | |
78 | #include <uvm/uvm.h> | | 78 | #include <uvm/uvm.h> |
79 | #include <uvm/uvm_page_array.h> | | 79 | #include <uvm/uvm_page_array.h> |
80 | | | 80 | |
81 | #include <machine/cpu.h> | | 81 | #include <machine/cpu.h> |
| @@ -527,33 +527,33 @@ pmap_check_alias(struct vm_page *pg, vad | | | @@ -527,33 +527,33 @@ pmap_check_alias(struct vm_page *pg, vad |
527 | struct vm_page_md * const md = VM_PAGE_TO_MD(pg); | | 527 | struct vm_page_md * const md = VM_PAGE_TO_MD(pg); |
528 | struct pv_entry *pve; | | 528 | struct pv_entry *pve; |
529 | int ret = 0; | | 529 | int ret = 0; |
530 | | | 530 | |
531 | /* check for non-equ aliased mappings */ | | 531 | /* check for non-equ aliased mappings */ |
532 | for (pve = md->pvh_list; pve; pve = pve->pv_next) { | | 532 | for (pve = md->pvh_list; pve; pve = pve->pv_next) { |
533 | vaddr_t pva = pve->pv_va & PV_VAMASK; | | 533 | vaddr_t pva = pve->pv_va & PV_VAMASK; |
534 | | | 534 | |
535 | pte |= pmap_vp_find(pve->pv_pmap, pva); | | 535 | pte |= pmap_vp_find(pve->pv_pmap, pva); |
536 | if ((va & HPPA_PGAOFF) != (pva & HPPA_PGAOFF) && | | 536 | if ((va & HPPA_PGAOFF) != (pva & HPPA_PGAOFF) && |
537 | (pte & PTE_PROT(TLB_WRITE))) { | | 537 | (pte & PTE_PROT(TLB_WRITE))) { |
538 | | | 538 | |
539 | DPRINTF(PDB_FOLLOW|PDB_ALIAS, | | 539 | DPRINTF(PDB_FOLLOW|PDB_ALIAS, |
540 | ("%s: aliased writable mapping 0x%x:0x%lx\n", | | 540 | ("%s: aliased writable mapping 0x%x:0x%lx\n", |
541 | __func__, pve->pv_pmap->pm_space, pve->pv_va)); | | 541 | __func__, pve->pv_pmap->pm_space, pve->pv_va)); |
542 | ret++; | | 542 | ret++; |
543 | } | | 543 | } |
544 | } | | 544 | } |
545 | | | 545 | |
546 | return (ret); | | 546 | return (ret); |
547 | } | | 547 | } |
548 | | | 548 | |
549 | /* | | 549 | /* |
550 | * This allocates and returns a new struct pv_entry. | | 550 | * This allocates and returns a new struct pv_entry. |
551 | */ | | 551 | */ |
552 | static inline struct pv_entry * | | 552 | static inline struct pv_entry * |
553 | pmap_pv_alloc(void) | | 553 | pmap_pv_alloc(void) |
554 | { | | 554 | { |
555 | struct pv_entry *pv; | | 555 | struct pv_entry *pv; |
556 | | | 556 | |
557 | DPRINTF(PDB_FOLLOW|PDB_PV, ("%s()\n", __func__)); | | 557 | DPRINTF(PDB_FOLLOW|PDB_PV, ("%s()\n", __func__)); |
558 | | | 558 | |
559 | pv = pool_get(&pmap_pv_pool, PR_NOWAIT); | | 559 | pv = pool_get(&pmap_pv_pool, PR_NOWAIT); |
| @@ -1285,27 +1285,27 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd | | | @@ -1285,27 +1285,27 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd |
1285 | pmap->pm_stats.wired_count++; | | 1285 | pmap->pm_stats.wired_count++; |
1286 | if (ptp) | | 1286 | if (ptp) |
1287 | ptp->wire_count++; | | 1287 | ptp->wire_count++; |
1288 | } | | 1288 | } |
1289 | | | 1289 | |
1290 | if (pmap_initialized && (pg = PHYS_TO_VM_PAGE(pa))) { | | 1290 | if (pmap_initialized && (pg = PHYS_TO_VM_PAGE(pa))) { |
1291 | if (!pve && !(pve = pmap_pv_alloc())) { | | 1291 | if (!pve && !(pve = pmap_pv_alloc())) { |
1292 | if (flags & PMAP_CANFAIL) { | | 1292 | if (flags & PMAP_CANFAIL) { |
1293 | PMAP_UNLOCK(pmap); | | 1293 | PMAP_UNLOCK(pmap); |
1294 | return (ENOMEM); | | 1294 | return (ENOMEM); |
1295 | } | | 1295 | } |
1296 | panic("%s: no pv entries available", __func__); | | 1296 | panic("%s: no pv entries available", __func__); |
1297 | } | | 1297 | } |
1298 | pte |= PTE_PROT(pmap_prot(pmap, prot)); | | 1298 | pte |= PTE_PROT(pmap_prot(pmap, prot)); |
1299 | if (pmap_check_alias(pg, va, pte)) | | 1299 | if (pmap_check_alias(pg, va, pte)) |
1300 | pmap_page_remove(pg); | | 1300 | pmap_page_remove(pg); |
1301 | pmap_pv_enter(pg, pve, pmap, va, ptp, 0); | | 1301 | pmap_pv_enter(pg, pve, pmap, va, ptp, 0); |
1302 | } else if (pve) { | | 1302 | } else if (pve) { |
1303 | pmap_pv_free(pve); | | 1303 | pmap_pv_free(pve); |
1304 | } | | 1304 | } |
1305 | | | 1305 | |
1306 | enter: | | 1306 | enter: |
1307 | /* preserve old ref & mod */ | | 1307 | /* preserve old ref & mod */ |
1308 | pte = pa | PTE_PROT(pmap_prot(pmap, prot)) | | | 1308 | pte = pa | PTE_PROT(pmap_prot(pmap, prot)) | |
1309 | (pte & PTE_PROT(TLB_UNCACHEABLE|TLB_DIRTY|TLB_REFTRAP)); | | 1309 | (pte & PTE_PROT(TLB_UNCACHEABLE|TLB_DIRTY|TLB_REFTRAP)); |
1310 | | | 1310 | |
1311 | if (pg != NULL) { | | 1311 | if (pg != NULL) { |