Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/fdt Free kva for rndseed and efirng when done.



details:   https://anonhg.NetBSD.org/src/rev/f5204be791d2
branches:  trunk
changeset: 932741:f5204be791d2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu May 14 19:26:28 2020 +0000

description:
Free kva for rndseed and efirng when done.

The physical pages remain forever reserved because it's not convenient
to unreserve them at the moment after we reserved them during
fdt_build_bootconifg, but it's just two pages so not that big a deal.

diffstat:

 sys/arch/evbarm/fdt/fdt_machdep.c |  17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r f0984446a5a7 -r f5204be791d2 sys/arch/evbarm/fdt/fdt_machdep.c
--- a/sys/arch/evbarm/fdt/fdt_machdep.c Thu May 14 19:25:16 2020 +0000
+++ b/sys/arch/evbarm/fdt/fdt_machdep.c Thu May 14 19:26:28 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.70 2020/05/14 19:24:35 riastradh Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.71 2020/05/14 19:26:28 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.70 2020/05/14 19:24:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.71 2020/05/14 19:26:28 riastradh Exp $");
 
 #include "opt_machdep.h"
 #include "opt_bootconfig.h"
@@ -396,6 +396,17 @@
 }
 
 static void
+fdt_unmap_range(void *ptr, uint64_t size)
+{
+       const char *start = ptr, *end = start + size;
+       const vaddr_t startva = trunc_page((vaddr_t)(uintptr_t)start);
+       const vaddr_t endva = round_page((vaddr_t)(uintptr_t)end);
+
+       pmap_kremove(startva, endva - startva);
+       pmap_update(pmap_kernel());
+}
+
+static void
 fdt_probe_initrd(uint64_t *pstart, uint64_t *pend)
 {
        *pstart = *pend = 0;
@@ -439,6 +450,7 @@
        if (rndseed == NULL)
                return;
        rnd_seed(rndseed, rndseed_size);
+       fdt_unmap_range(rndseed, rndseed_size);
 }
 
 static void
@@ -466,6 +478,7 @@
            RND_FLAG_DEFAULT);
        rnd_add_data(&efirng_source, efirng, efirng_size, 0);
        explicit_memset(efirng, 0, efirng_size);
+       fdt_unmap_range(efirng, efirng_size);
 }
 
 #ifdef EFI_RUNTIME



Home | Main Index | Thread Index | Old Index