Date: Wed, 6 Oct 2021 02:54:32 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 33c17670afdb - main - amd64: add pmap_page_set_memattr_noflush() Message-ID: <202110060254.1962sWgn087634@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=33c17670afdb008097858d2fff8d4c4a47d68158 commit 33c17670afdb008097858d2fff8d4c4a47d68158 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-10-05 14:12:05 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-10-06 02:53:12 +0000 amd64: add pmap_page_set_memattr_noflush() Similar to pmap_page_set_memattr() by setting MD page cache attribute to the argument. Unlike pmap_page_set_memattr(), does not flush cache for the direct mapping of the page. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32318 --- 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 aae35c5d7e07..f1ddbe548c0f 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -9379,6 +9379,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 b65668b60023..bd6a8c006813 100644 --- a/sys/amd64/include/pmap.h +++ b/sys/amd64/include/pmap.h @@ -499,6 +499,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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110060254.1962sWgn087634>