mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] m68k: amiga: lower min_low_pfn to make RAM DMA-able
@ 2026-11-05 13:27 Steffen A. Mork
  2026-12-03 10:50 ` Daniel Palmer
  0 siblings, 1 reply; 6+ messages in thread
From: Steffen A. Mork @ 2026-11-05 13:27 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-m68k, linux-kernel, Thorsten Blum, Steffen A. Mork

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] m68k: amiga: lower min_low_pfn to make RAM DMA-able
  2026-11-05 13:27 [PATCH] m68k: amiga: lower min_low_pfn to make RAM DMA-able Steffen A. Mork
@ 2026-12-03 10:50 ` Daniel Palmer
  2026-12-03 12:57   ` Steffen A. Mork
  2026-12-03 20:58   ` Denis Ahrens
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Palmer @ 2026-12-03 10:50 UTC (permalink / raw)
  To: Steffen A. Mork
  Cc: Geert Uytterhoeven, linux-m68k, linux-kernel, Thorsten Blum,
	Denis Ahrens

Hi Steffen,

On Thu, 5 Nov 2026 at 22:30, Steffen A. Mork <linux-dev@morknet.de> wrote:
>
> 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().

Can you check if the following works for you?:

  --- a/arch/m68k/mm/motorola.c
  +++ b/arch/m68k/mm/motorola.c
  @@ void __init paging_init(void)
          unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0, };
          unsigned long min_addr, max_addr;
          unsigned long addr;
          int i;
  @@
          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;

Cheers,

Daniel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] m68k: amiga: lower min_low_pfn to make RAM DMA-able
  2026-12-03 10:50 ` Daniel Palmer
@ 2026-12-03 12:57   ` Steffen A. Mork
  2026-12-03 13:39     ` Daniel Palmer
  2026-12-03 20:58   ` Denis Ahrens
  1 sibling, 1 reply; 6+ messages in thread
From: Steffen A. Mork @ 2026-12-03 12:57 UTC (permalink / raw)
  To: Daniel Palmer
  Cc: Geert Uytterhoeven, linux-m68k, linux-kernel, Thorsten Blum,
	Denis Ahrens

Am 03.12.26 um 11:50 schrieb Daniel Palmer:
> Hi Steffen,
Hi Daniel,

> On Thu, 5 Nov 2026 at 22:30, Steffen A. Mork <linux-dev@morknet.de> wrote:
>>
>> 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().
> 
> Can you check if the following works for you?:
This simply works. :-)

>   --- a/arch/m68k/mm/motorola.c
>   +++ b/arch/m68k/mm/motorola.c
>   @@ void __init paging_init(void)
>           unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0, };
>           unsigned long min_addr, max_addr;
>           unsigned long addr;
>           int i;
>   @@
>           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;
> 
It's a better place to fix a whole architecture rather than distinct
platforms.

Tested-by: Steffen A. Mork <linux-dev@morknet.de> # native Amiga 2000
with Blizzard 2060Tested-by: Steffen A. Mork <linux-dev@morknet.de> #
FS-UAE virtual Amiga 3000

> Cheers,
>
> Daniel
-- 
Steffen


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] m68k: amiga: lower min_low_pfn to make RAM DMA-able
  2026-12-03 12:57   ` Steffen A. Mork
@ 2026-12-03 13:39     ` Daniel Palmer
  2026-12-03 13:42       ` Steffen A. Mork
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Palmer @ 2026-12-03 13:39 UTC (permalink / raw)
  To: Steffen A. Mork
  Cc: Geert Uytterhoeven, linux-m68k, linux-kernel, Thorsten Blum,
	Denis Ahrens

Hi Steffen,

On Thu, 3 Dec 2026 at 21:58, Steffen A. Mork <linux-dev@morknet.de> wrote:
> > Can you check if the following works for you?:
> This simply works. :-)

Awesome. Once I've checked the machines I have all still boot I'll
send a cleaned up version.

Since you have an Amiga and an 060 do you mind me CC'ing on Amiga/060
patches in the future?

Cheers,

Daniel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] m68k: amiga: lower min_low_pfn to make RAM DMA-able
  2026-12-03 13:39     ` Daniel Palmer
@ 2026-12-03 13:42       ` Steffen A. Mork
  0 siblings, 0 replies; 6+ messages in thread
From: Steffen A. Mork @ 2026-12-03 13:42 UTC (permalink / raw)
  To: Daniel Palmer
  Cc: Geert Uytterhoeven, linux-m68k, linux-kernel, Thorsten Blum,
	Denis Ahrens

>>> Can you check if the following works for you?:
>> This simply works. :-)
> 
> Awesome. Once I've checked the machines I have all still boot I'll
> send a cleaned up version.
> 
> Since you have an Amiga and an 060 do you mind me CC'ing on Amiga/060
> patches in the future?
Of course. :-)

> Cheers,
Cheers

> Daniel
-- 
Steffen


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] m68k: amiga: lower min_low_pfn to make RAM DMA-able
  2026-12-03 10:50 ` Daniel Palmer
  2026-12-03 12:57   ` Steffen A. Mork
@ 2026-12-03 20:58   ` Denis Ahrens
  1 sibling, 0 replies; 6+ messages in thread
From: Denis Ahrens @ 2026-12-03 20:58 UTC (permalink / raw)
  To: Daniel Palmer
  Cc: Steffen A. Mork, Geert Uytterhoeven, linux-m68k, linux-kernel,
	Thorsten Blum


> On 3. Dec 2026, at 11:50, Daniel Palmer <daniel@0x0f.com> wrote:
> 
> Hi Steffen,
> 
> On Thu, 5 Nov 2026 at 22:30, Steffen A. Mork <linux-dev@morknet.de> wrote:
>> 
>> 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().

The new patch works here on a MVME177.

Denis

> Can you check if the following works for you?:
> 
>  --- a/arch/m68k/mm/motorola.c
>  +++ b/arch/m68k/mm/motorola.c
>  @@ void __init paging_init(void)
>          unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0, };
>          unsigned long min_addr, max_addr;
>          unsigned long addr;
>          int i;
>  @@
>          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;
> 
> Cheers,
> 
> Daniel
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-03 20:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 13:27 [PATCH] m68k: amiga: lower min_low_pfn to make RAM DMA-able Steffen A. Mork
2026-12-03 10:50 ` Daniel Palmer
2026-12-03 12:57   ` Steffen A. Mork
2026-12-03 13:39     ` Daniel Palmer
2026-12-03 13:42       ` Steffen A. Mork
2026-12-03 20:58   ` Denis Ahrens

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®