Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm/pmap MI PMAP EFI_RUNTIME support
details: https://anonhg.NetBSD.org/src/rev/d488cb9c2698
branches: trunk
changeset: 372136:d488cb9c2698
user: skrll <skrll%NetBSD.org@localhost>
date: Fri Oct 28 07:16:34 2022 +0000
description:
MI PMAP EFI_RUNTIME support
diffstat:
sys/arch/aarch64/conf/files.aarch64 | 3 +-
sys/arch/arm/conf/files.arm | 3 +-
sys/arch/x86/conf/files.x86 | 4 +--
sys/conf/files | 4 ++-
sys/uvm/pmap/pmap.c | 38 ++++++++++++++++++++++++++++++++----
5 files changed, 39 insertions(+), 13 deletions(-)
diffs (166 lines):
diff -r c4d837ee17fb -r d488cb9c2698 sys/arch/aarch64/conf/files.aarch64
--- a/sys/arch/aarch64/conf/files.aarch64 Fri Oct 28 06:22:26 2022 +0000
+++ b/sys/arch/aarch64/conf/files.aarch64 Fri Oct 28 07:16:34 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.aarch64,v 1.39 2022/10/15 11:07:38 jmcneill Exp $
+# $NetBSD: files.aarch64,v 1.40 2022/10/28 07:16:34 skrll Exp $
defflag opt_cpuoptions.h AARCH64_ALIGNMENT_CHECK
defflag opt_cpuoptions.h AARCH64_EL0_STACK_ALIGNMENT_CHECK
@@ -47,7 +47,6 @@
file arch/arm/arm/psci_arm.S psci
# EFI support
-defflag opt_efi.h EFI_RUNTIME
file arch/arm/arm/efi_runtime.c efi_runtime
# PMAP options
diff -r c4d837ee17fb -r d488cb9c2698 sys/arch/arm/conf/files.arm
--- a/sys/arch/arm/conf/files.arm Fri Oct 28 06:22:26 2022 +0000
+++ b/sys/arch/arm/conf/files.arm Fri Oct 28 07:16:34 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.arm,v 1.166 2022/04/02 11:16:07 skrll Exp $
+# $NetBSD: files.arm,v 1.167 2022/10/28 07:16:34 skrll Exp $
# temporary define to allow easy moving to ../arch/arm/arm32
defflag ARM32
@@ -109,7 +109,6 @@
file arch/arm/arm/psci_arm.S psci
# EFI support
-defflag opt_efi.h EFI_RUNTIME
file arch/arm/arm/efi_runtime.c efi_runtime
# New PMAP options
diff -r c4d837ee17fb -r d488cb9c2698 sys/arch/x86/conf/files.x86
--- a/sys/arch/x86/conf/files.x86 Fri Oct 28 06:22:26 2022 +0000
+++ b/sys/arch/x86/conf/files.x86 Fri Oct 28 07:16:34 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.x86,v 1.124 2022/09/24 11:05:18 riastradh Exp $
+# $NetBSD: files.x86,v 1.125 2022/10/28 07:16:34 skrll Exp $
# options for MP configuration through the MP spec
defflag opt_mpbios.h MPBIOS MPDEBUG MPBIOS_SCANPCI
@@ -21,8 +21,6 @@
# Option to have a static kernel memory layout
defflag opt_kaslr.h NO_X86_ASLR
-defflag opt_efi.h EFI_RUNTIME
-
defflag SVS
defflag PCPU_IDT
diff -r c4d837ee17fb -r d488cb9c2698 sys/conf/files
--- a/sys/conf/files Fri Oct 28 06:22:26 2022 +0000
+++ b/sys/conf/files Fri Oct 28 07:16:34 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files,v 1.1301 2022/07/24 18:04:48 mrg Exp $
+# $NetBSD: files,v 1.1302 2022/10/28 07:16:34 skrll Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20171118
@@ -144,6 +144,8 @@
defparam opt_maxlwp.h MAXLWP
+defflag opt_efi.h EFI_RUNTIME
+
# compatibility options
#
defflag opt_compat_netbsd.h COMPAT_NETBSD
diff -r c4d837ee17fb -r d488cb9c2698 sys/uvm/pmap/pmap.c
--- a/sys/uvm/pmap/pmap.c Fri Oct 28 06:22:26 2022 +0000
+++ b/sys/uvm/pmap/pmap.c Fri Oct 28 07:16:34 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.71 2022/10/27 06:20:41 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.72 2022/10/28 07:16:34 skrll Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.71 2022/10/27 06:20:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.72 2022/10/28 07:16:34 skrll Exp $");
/*
* Manages physical address maps.
@@ -96,6 +96,7 @@
*/
#include "opt_ddb.h"
+#include "opt_efi.h"
#include "opt_modular.h"
#include "opt_multiprocessor.h"
#include "opt_sysv.h"
@@ -157,6 +158,7 @@
PMAP_COUNTER(uncached_mappings, "uncached pages mapped");
PMAP_COUNTER(unmanaged_mappings, "unmanaged pages mapped");
PMAP_COUNTER(pvtracked_mappings, "pv-tracked unmanaged pages mapped");
+PMAP_COUNTER(efirt_mappings, "EFI RT pages mapped");
PMAP_COUNTER(managed_mappings, "managed pages mapped");
PMAP_COUNTER(mappings, "pages mapped");
PMAP_COUNTER(remappings, "pages remapped");
@@ -237,6 +239,22 @@
struct pmap * const kernel_pmap_ptr = &kernel_pmap_store.kernel_pmap;
+#if defined(EFI_RUNTIME)
+static struct pmap efirt_pmap;
+
+pmap_t
+pmap_efirt(void)
+{
+ return &efirt_pmap;
+}
+#else
+static inline pt_entry_t
+pte_make_enter_efirt(paddr_t pa, vm_prot_t prot, u_int flags)
+{
+ panic("not supported");
+}
+#endif
+
/* The current top of kernel VM - gets updated by pmap_growkernel */
vaddr_t pmap_curmaxkvaddr;
@@ -1354,6 +1372,11 @@
{
const bool wired = (flags & PMAP_WIRED) != 0;
const bool is_kernel_pmap_p = (pmap == pmap_kernel());
+#if defined(EFI_RUNTIME)
+ const bool is_efirt_pmap_p = (pmap == pmap_efirt());
+#else
+ const bool is_efirt_pmap_p = false;
+#endif
u_int update_flags = (flags & VM_PROT_ALL) != 0 ? PMAP_TLB_INSERT : 0;
#ifdef UVMHIST
struct kern_history * const histp =
@@ -1411,6 +1434,8 @@
PMAP_COUNT(pvtracked_mappings);
#endif
+ } else if (is_efirt_pmap_p) {
+ PMAP_COUNT(efirt_mappings);
} else {
/*
* Assumption: if it is not part of our managed memory
@@ -1421,11 +1446,14 @@
PMAP_COUNT(unmanaged_mappings);
}
- KASSERTMSG(mdpg == NULL || mdpp == NULL, "mdpg %p mdpp %p", mdpg, mdpp);
+ KASSERTMSG(mdpg == NULL || mdpp == NULL || is_efirt_pmap_p,
+ "mdpg %p mdpp %p efirt %s", mdpg, mdpp,
+ is_efirt_pmap_p ? "true" : "false");
struct vm_page_md *md = (mdpg != NULL) ? mdpg : mdpp;
- pt_entry_t npte = pte_make_enter(pa, md, prot, flags,
- is_kernel_pmap_p);
+ pt_entry_t npte = is_efirt_pmap_p ?
+ pte_make_enter_efirt(pa, prot, flags) :
+ pte_make_enter(pa, md, prot, flags, is_kernel_pmap_p);
kpreempt_disable();
Home |
Main Index |
Thread Index |
Old Index