mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] m68k: mm: Set min_low_pfn to the start of RAM
@ 2026-12-03 23:55 Daniel Palmer
  0 siblings, 0 replies; only message in thread
From: Daniel Palmer @ 2026-12-03 23:55 UTC (permalink / raw)
  To: geert, linux-m68k
  Cc: linux-kernel, visitorckw, laurent, Daniel Palmer, Daniel Palmer,
	Denis Ahrens, Steffen A. Mork

Currently min_low_pfn is the first page after the kernel image.

Freeing the init sections causes some memory at the tail of the kernel
image to be freed and become available to be allocated.

Since commit b12d66278dd6 ("dma-direct: check for overflows on 32 bit DMA addresses")
dma_capable() checks the memory that is about to be used for DMA isn't
below min_low_pfn so if memory allocated from the freed init sections
is passed in it'll be rejected because it is below min_low_pfn resulting
in DMA not working for SCSI etc.

The kernel image itself is protected by memblock_reserve() so we can
just set min_low_pfn to the lowest RAM pfn without having to worry
about the kernel get stomped on.

This also means the workaround the virt machine had is no longer
needed so get rid of that too.

Fixes: b12d66278dd6 ("dma-direct: check for overflows on 32 bit DMA addresses")
Tested-by: Daniel Palmer <daniel@thingy.jp> # Amiga 4000, MVME147
Tested-by: Denis Ahrens <denis@h3q.com> # MVME177
Tested-by: Steffen A. Mork <linux-dev@morknet.de> # Amiga 2000, Amiga 3000 (FS-UAE)
Signed-off-by: Daniel Palmer <daniel@0x0f.com>
---
 arch/m68k/mm/motorola.c   | 2 +-
 arch/m68k/virt/platform.c | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index f3efa0d13963..ad7777541100 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -511,7 +511,7 @@ void __init paging_init(void)
 
 	high_memory = phys_to_virt(max_addr) + 1;
 
-	min_low_pfn = availmem >> PAGE_SHIFT;
+	min_low_pfn = min_addr >> PAGE_SHIFT;
 	max_pfn = max_low_pfn = (max_addr >> PAGE_SHIFT) + 1;
 
 	/* Reserve kernel text/data/bss and the memory allocated in head.S */
diff --git a/arch/m68k/virt/platform.c b/arch/m68k/virt/platform.c
index 764f556b4b32..1b3b99dd9557 100644
--- a/arch/m68k/virt/platform.c
+++ b/arch/m68k/virt/platform.c
@@ -41,9 +41,6 @@ static int __init virt_platform_init(void)
 	if (!MACH_IS_VIRT)
 		return -ENODEV;
 
-	/* We need this to have DMA'able memory provided to goldfish-tty */
-	min_low_pfn = 0;
-
 	pdev1 = platform_device_register_simple("goldfish_tty",
 						PLATFORM_DEVID_NONE,
 						goldfish_tty_res,
-- 
2.55.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 23:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-03 23:55 [PATCH] m68k: mm: Set min_low_pfn to the start of RAM Daniel Palmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®