mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Palmer <daniel@0x0f.com>
To: geert@linux-m68k.org, linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org, visitorckw@gmail.com,
	laurent@vivier.eu, Daniel Palmer <daniel@0x0f.com>,
	Daniel Palmer <daniel@thingy.jp>, Denis Ahrens <denis@h3q.com>,
	"Steffen A. Mork" <linux-dev@morknet.de>
Subject: [PATCH] m68k: mm: Set min_low_pfn to the start of RAM
Date: Fri,  4 Dec 2026 08:55:21 +0900	[thread overview]
Message-ID: <20261203235521.2914377-1-daniel@0x0f.com> (raw)

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


                 reply	other threads:[~2026-12-03 23:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203235521.2914377-1-daniel@0x0f.com \
    --to=daniel@0x0f.com \
    --cc=daniel@thingy.jp \
    --cc=denis@h3q.com \
    --cc=geert@linux-m68k.org \
    --cc=laurent@vivier.eu \
    --cc=linux-dev@morknet.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=visitorckw@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®