summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTianyi Chen <hi@tychen.cc>2026-09-10 07:55:28 +0800
committerMike Rapoport (Microsoft) <rppt@kernel.org>2026-09-10 13:10:20 +0300
commitf68c01000a6c3bddbf415b6e50a201196ec78358 (patch)
tree6008f488bac9acfb7479de980fea305defac0ff5
parent6e33dc90df108c76899dc544a42d17adcba61668 (diff)
downloadlinux-next-f68c01000a6c3bddbf415b6e50a201196ec78358.tar.gz
linux-next-f68c01000a6c3bddbf415b6e50a201196ec78358.zip
memblock tests: model the low allocation limit within dummy memory
The simulator represents physical addresses using the address of its allocated buffer. That buffer can lie above the default ARCH_LOW_ADDRESS_LIMIT, preventing meaningful memblock_alloc_low() tests. Use the architecture override in asm/dma.h to place the limit halfway through the memory registered by setup_memblock(). Resolve the limit after allocating the buffer, leaving registered memory on both sides. Assisted-by: LLM Signed-off-by: Tianyi Chen <hi@tychen.cc> Link: https://patch.msgid.link/f16c272cd52316b83c35d87987b4d8687c4a3182.1788997523.git.hi@tychen.cc Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
-rw-r--r--tools/testing/memblock/asm/dma.h6
-rw-r--r--tools/testing/memblock/tests/common.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/memblock/asm/dma.h b/tools/testing/memblock/asm/dma.h
index 13ff8e5d22ef..6607408dcf25 100644
--- a/tools/testing/memblock/asm/dma.h
+++ b/tools/testing/memblock/asm/dma.h
@@ -2,4 +2,10 @@
#ifndef _TOOLS_DMA_H
#define _TOOLS_DMA_H
+#include <linux/types.h>
+
+phys_addr_t dummy_physical_memory_low_limit(void);
+
+#define ARCH_LOW_ADDRESS_LIMIT dummy_physical_memory_low_limit()
+
#endif
diff --git a/tools/testing/memblock/tests/common.c b/tools/testing/memblock/tests/common.c
index 3250c8e5124b..ac032610a56e 100644
--- a/tools/testing/memblock/tests/common.c
+++ b/tools/testing/memblock/tests/common.c
@@ -118,6 +118,12 @@ phys_addr_t dummy_physical_memory_base(void)
return (phys_addr_t)memory_block.base;
}
+phys_addr_t dummy_physical_memory_low_limit(void)
+{
+ /* The low limit is halfway through memory registered by setup_memblock(). */
+ return dummy_physical_memory_base() + MEM_SIZE / 2;
+}
+
static void usage(const char *prog)
{
BUILD_BUG_ON(ARRAY_SIZE(help_opts) != ARRAY_SIZE(long_opts) - 1);