From nobody Sun Oct 10 09:24:16 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2AC8B12DF515; Sun, 10 Oct 2021 09:24:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HRxMT0hbgz3NG9; Sun, 10 Oct 2021 09:24:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 048BF2D59; Sun, 10 Oct 2021 09:24:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 19A9OG4w003491; Sun, 10 Oct 2021 09:24:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 19A9OG0w003490; Sun, 10 Oct 2021 09:24:16 GMT (envelope-from git) Date: Sun, 10 Oct 2021 09:24:16 GMT Message-Id: <202110100924.19A9OG0w003490@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 56c136a0d5ee - stable/13 - amd64: add pmap_page_set_memattr_noflush() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 56c136a0d5eea605f2537d79c4e110460df83a50 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=56c136a0d5eea605f2537d79c4e110460df83a50 commit 56c136a0d5eea605f2537d79c4e110460df83a50 Author: Konstantin Belousov AuthorDate: 2021-10-05 14:12:05 +0000 Commit: Konstantin Belousov 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);