mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Steffen A. Mork" <linux-dev@morknet.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thorsten Blum <blum@kernel.org>,
	"Steffen A. Mork" <linux-dev@morknet.de>
Subject: [PATCH] m68k: amiga: lower min_low_pfn to make RAM DMA-able
Date: Thu,  5 Nov 2026 14:27:52 +0100	[thread overview]
Message-ID: <20261105132752.1226267-1-linux-dev@morknet.de> (raw)

With reference to the patch by Denis Ahrens for the MVME16x platform, this
patch works in the same way for the Amiga. Currently, all DMA-capable SCSI
controllers have ceased to function due to the same underlying issue. While
the wd33c93=nodma parameter can be used as a workaround for the wd33c93
driver on the Amiga 3000, other drivers —- such as the zorro_esp driver
(tested on a Blizzard 2060) -— fail completely once memory has been
released by free_initmem().

Applying this patch restores proper functionality to both the Amiga 3000
SCSI controller (without requiring the wd33c93=nodma parameter) and the
Blizzard 2060.

Link: https://lore.kernel.org/r/C718B642-57B9-48F3-8C0C-87DCB31A8495@h3q.com
Tested-by: Steffen A. Mork <linux-dev@morknet.de> # native Amiga 2000 with Blizzard 2060
Tested-by: Steffen A. Mork <linux-dev@morknet.de> # FS-UAE virtual Amiga 3000
Signed-off-by: Steffen A. Mork <linux-dev@morknet.de>
---
 arch/m68k/amiga/config.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 6e89e7f7e98b..c48aa3dbd837 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -24,6 +24,7 @@
 #include <linux/interrupt.h>
 #include <linux/zorro.h>
 #include <linux/module.h>
+#include <linux/memblock.h>
 #include <linux/keyboard.h>
 
 #include <asm/bootinfo.h>
@@ -854,3 +855,38 @@ static void amiga_get_hardware_list(struct seq_file *m)
 #ifdef CONFIG_VT
 EXPORT_SYMBOL_GPL(key_maps);
 #endif
+
+/*
+ * Make all system RAM available for DMA.
+ *
+ * paging_init() sets min_low_pfn to the first free page
+ * after the kernel image. free_initmem() later releases
+ * the init sections, but min_low_pfn remains unchanged.
+ *
+ * This prevents dma_capable() from mapping those pages.
+ */
+static int __init amiga_init_dma_pfn_limit(void)
+{
+	unsigned long pfn = ULONG_MAX;
+	int i;
+
+	for (i = 0; i < m68k_num_memory; i++) {
+		unsigned long mem_pfn;
+
+		mem_pfn = m68k_memory[i].addr >> PAGE_SHIFT;
+
+		if (mem_pfn < pfn)
+			pfn = mem_pfn;
+	}
+
+	if (pfn >= min_low_pfn)
+		return 0;
+
+	pr_info("Amiga: lowering min_low_pfn 0x%lx -> 0x%lx\n",
+		min_low_pfn, pfn);
+
+	min_low_pfn = pfn;
+
+	return 0;
+}
+arch_initcall(amiga_init_dma_pfn_limit);
-- 
2.43.0


                 reply	other threads:[~2026-11-05 13:28 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=20261105132752.1226267-1-linux-dev@morknet.de \
    --to=linux-dev@morknet.de \
    --cc=blum@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    /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®