git: 56c136a0d5ee - stable/13 - amd64: add pmap_page_set_memattr_noflush()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 10 Oct 2021 09:24:16 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56c136a0d5eea605f2537d79c4e110460df83a50 commit 56c136a0d5eea605f2537d79c4e110460df83a50 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-10-05 14:12:05 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-10-10 09:21:18 +0000 amd64: add pmap_page_set_memattr_noflush() (cherry picked from commit 33c17670afdb008097858d2fff8d4c4a47d68158) --- sys/amd64/amd64/pmap.c | 17 +++++++++++++++++ sys/amd64/include/pmap.h | 1 + 2 files changed, 18 insertions(+) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index b9a83cd8bbad..83f2a4c88bf7 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -9201,6 +9201,23 @@ pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) panic("memory attribute change on the direct map failed"); } +void +pmap_page_set_memattr_noflush(vm_page_t m, vm_memattr_t ma) +{ + int error; + + m->md.pat_mode = ma; + + if ((m->flags & PG_FICTITIOUS) != 0) + return; + PMAP_LOCK(kernel_pmap); + error = pmap_change_props_locked(PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)), + PAGE_SIZE, PROT_NONE, m->md.pat_mode, 0); + PMAP_UNLOCK(kernel_pmap); + if (error != 0) + panic("memory attribute change on the direct map failed"); +} + /* * Changes the specified virtual address range's memory type to that given by * the parameter "mode". The specified virtual address range must be diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h index 6fb240e6363a..0ac91d17792a 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -481,6 +481,7 @@ void *pmap_mapdev_pciecfg(vm_paddr_t pa, vm_size_t size); bool pmap_not_in_di(void); boolean_t pmap_page_is_mapped(vm_page_t m); void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); +void pmap_page_set_memattr_noflush(vm_page_t m, vm_memattr_t ma); void pmap_pinit_pml4(vm_page_t); void pmap_pinit_pml5(vm_page_t); bool pmap_ps_enabled(pmap_t pmap);