summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2022-09-05 19:18:57 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2022-09-05 19:18:57 +0000
commit5e3753904c4e665e0e6ada849352fc123116a9cc (patch)
tree6663d0a720339997bf53b60d1c3107163c249059
parent98e5d2e2f02164a07ddb337bb12302db826f4161 (diff)
Don't ignore memory blocks smaller than 64KB. Some EFI implementations
(such as the one on the x13s) allocate memory with the EfiBootSevicesData type in a semi-random fashion. Ignoring small regions with that type results in different memory maps between boots of the same kernel. This causes problems with upcoming hibernate support. The decision to ignore small regions was made because we do this on amd64 to work arounmd broken BIOS implementations and because of fears that we would run out of physical memory segments in UVM. We have some reasons to believe that we can trust the EFI memory map on arm64 and the risk of running out of physical memory segments is mitigated by the fact that we try to merge memory regions before loading them into UVM. If for some reason we see a significant drop in physical memory on certain machines, we should probably increase the number of items in the array we use to store memory regions and/or increase the number of physical memory segments in UVM. ok mlarkin@
-rw-r--r--sys/arch/arm64/arm64/machdep.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/arch/arm64/arm64/machdep.c b/sys/arch/arm64/arm64/machdep.c
index baa6c2c7d22..41be380880d 100644
--- a/sys/arch/arm64/arm64/machdep.c
+++ b/sys/arch/arm64/arm64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.71 2022/08/29 17:13:57 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.72 2022/09/05 19:18:56 kettenis Exp $ */
/*
* Copyright (c) 2014 Patrick Wildt <patrick@blueri.se>
* Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org>
@@ -963,8 +963,7 @@ initarm(struct arm64_bootparams *abp)
/*
* Load all memory marked as EfiConventionalMemory,
* EfiBootServicesCode or EfiBootServicesData.
- * Don't bother with blocks smaller than 64KB. The
- * initial 64MB memory block should be marked as
+ * The initial 64MB memory block should be marked as
* EfiLoaderData so it won't be added here.
*/
for (i = 0; i < mmap_size / mmap_desc_size; i++) {
@@ -974,10 +973,9 @@ initarm(struct arm64_bootparams *abp)
desc->VirtualStart, desc->NumberOfPages,
desc->Attribute);
#endif
- if ((desc->Type == EfiConventionalMemory ||
- desc->Type == EfiBootServicesCode ||
- desc->Type == EfiBootServicesData) &&
- desc->NumberOfPages >= 16) {
+ if (desc->Type == EfiConventionalMemory ||
+ desc->Type == EfiBootServicesCode ||
+ desc->Type == EfiBootServicesData) {
reg.addr = desc->PhysicalStart;
reg.size = ptoa(desc->NumberOfPages);
memreg_add(&reg);