Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt Size boot_physmem with FDT_MEMORY_RANGES.



details:   https://anonhg.NetBSD.org/src/rev/c80e3c206e19
branches:  trunk
changeset: 372260:c80e3c206e19
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Nov 04 10:51:16 2022 +0000

description:
Size boot_physmem with FDT_MEMORY_RANGES.

This effectively increases the size from 64 to 256 entries for Arm kernels.
It turns out on large systems that memory can be quite fragmented by UEFI.
Increasing the size of this just kicks the can down the road, we need a
better solution to deal with boot_physmem/fdt_memory/bootparams.dram
sizing.

diffstat:

 sys/arch/evbarm/fdt/fdt_machdep.c |  9 ++++-----
 sys/dev/fdt/fdt_memory.c          |  8 ++------
 sys/dev/fdt/fdt_memory.h          |  8 +++++++-
 3 files changed, 13 insertions(+), 12 deletions(-)

diffs (89 lines):

diff -r d921c386f071 -r c80e3c206e19 sys/arch/evbarm/fdt/fdt_machdep.c
--- a/sys/arch/evbarm/fdt/fdt_machdep.c Fri Nov 04 09:06:25 2022 +0000
+++ b/sys/arch/evbarm/fdt/fdt_machdep.c Fri Nov 04 10:51:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.98 2022/10/21 05:51:08 skrll Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.99 2022/11/04 10:51:17 jmcneill 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.98 2022/10/21 05:51:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.99 2022/11/04 10:51:17 jmcneill Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bootconfig.h"
@@ -185,9 +185,8 @@
        bc->dramblocks++;
 }
 
-#define MAX_PHYSMEM 64
 static int nfdt_physmem = 0;
-static struct boot_physmem fdt_physmem[MAX_PHYSMEM];
+static struct boot_physmem fdt_physmem[FDT_MEMORY_RANGES];
 
 static void
 fdt_add_boot_physmem(const struct fdt_memory *m, void *arg)
@@ -204,7 +203,7 @@
 
        struct boot_physmem *bp = &fdt_physmem[nfdt_physmem++];
 
-       KASSERT(nfdt_physmem <= MAX_PHYSMEM);
+       KASSERT(nfdt_physmem <= FDT_MEMORY_RANGES);
 
        bp->bp_start = atop(saddr);
        bp->bp_pages = atop(eaddr) - bp->bp_start;
diff -r d921c386f071 -r c80e3c206e19 sys/dev/fdt/fdt_memory.c
--- a/sys/dev/fdt/fdt_memory.c  Fri Nov 04 09:06:25 2022 +0000
+++ b/sys/dev/fdt/fdt_memory.c  Fri Nov 04 10:51:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_memory.c,v 1.7 2022/10/20 11:38:21 skrll Exp $ */
+/* $NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "opt_fdt.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.7 2022/10/20 11:38:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.8 2022/11/04 10:51:16 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/queue.h>
@@ -41,10 +41,6 @@
 #include <dev/fdt/fdtvar.h>
 #include <dev/fdt/fdt_memory.h>
 
-#ifndef FDT_MEMORY_RANGES
-#define FDT_MEMORY_RANGES      256
-#endif
-
 struct fdt_memory_range {
        struct fdt_memory               mr_mem;
        bool                            mr_used;
diff -r d921c386f071 -r c80e3c206e19 sys/dev/fdt/fdt_memory.h
--- a/sys/dev/fdt/fdt_memory.h  Fri Nov 04 09:06:25 2022 +0000
+++ b/sys/dev/fdt/fdt_memory.h  Fri Nov 04 10:51:16 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_memory.h,v 1.1 2020/12/12 09:27:31 skrll Exp $ */
+/* $NetBSD: fdt_memory.h,v 1.2 2022/11/04 10:51:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,6 +32,12 @@
 #ifndef _DEV_FDT_FDT_MEMORY_H_
 #define _DEV_FDT_FDT_MEMORY_H_
 
+#include "opt_fdt.h"
+
+#ifndef FDT_MEMORY_RANGES
+#define FDT_MEMORY_RANGES 256
+#endif
+
 struct fdt_memory {
        uint64_t        start;
        uint64_t        end;



Home | Main Index | Thread Index | Old Index