git: 3d7c37425ee0 - main - amd64 pmap: Catch up with pctrie changes

From: Alan Cox <alc_at_FreeBSD.org>
Date: Fri, 28 Jul 2023 20:17:51 UTC
The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=3d7c37425ee07186c65d424306c1b295c30fa592

commit 3d7c37425ee07186c65d424306c1b295c30fa592
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2023-07-28 20:13:13 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2023-07-28 20:13:13 +0000

    amd64 pmap: Catch up with pctrie changes
    
    Recent changes to the pctrie code make it necessary to initialize the
    kernel pmap's rangeset for PKU.
---
 sys/amd64/amd64/pmap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index a4b8c6dc4c06..c1968fc11844 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -1995,6 +1995,10 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 	kernel_pmap->pm_stats.resident_count = res;
 	vm_radix_init(&kernel_pmap->pm_root);
 	kernel_pmap->pm_flags = pmap_flags;
+	if ((cpu_stdext_feature2 & CPUID_STDEXT2_PKU) != 0) {
+		rangeset_init(&kernel_pmap->pm_pkru, pkru_dup_range,
+		    pkru_free_range, kernel_pmap, M_NOWAIT);
+	}
 
 	/*
 	 * The kernel pmap is always active on all CPUs.  Once CPUs are