Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/arch/evbarm/fdt Free kva for rndseed and efirng wh...



details:   https://anonhg.NetBSD.org/src-all/rev/2c758363df51
branches:  trunk
changeset: 932728:2c758363df51
user:      Taylor R Campbell <riastradh%NetBSD.org@localhost>
date:      Thu May 14 19:07:12 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 |  13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diffs (37 lines):

diff -r 746bb3cee79c -r 2c758363df51 sys/arch/evbarm/fdt/fdt_machdep.c
--- a/sys/arch/evbarm/fdt/fdt_machdep.c Thu May 14 18:40:44 2020 +0000
+++ b/sys/arch/evbarm/fdt/fdt_machdep.c Thu May 14 19:07:12 2020 +0000
@@ -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