All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] m68k: Enable memtest functionality
@ 2021-11-12  0:36 Finn Thain
  2021-11-12  8:05 ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Finn Thain @ 2021-11-12  0:36 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Mike Rapoport, Sam Creasey, Jonathan Corbet, linux-doc,
	linux-kernel, linux-m68k

Enable the memtest functionality and rearrange some code to prevent it
from clobbering the initrd.

The CONFIG_BLK_DEV_INITRD symbol was conditional on !defined(CONFIG_SUN3).
For simplicity, remove that test on the basis that m68k_ramdisk.size == 0
on Sun 3.

The SLIME source code at
http://sammy.net/sun3/ftp/pub/m68k/sun3/slime/slime-2.0.tar.gz
indicates that no BI_RAMDISK entry is ever passed to the kernel due
to #ifdef 0 around the relevant code.

Cc: Mike Rapoport <rppt@kernel.org>
Cc: Sam Creasey <sammy@sammy.net>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
---
Are there any other Linux bootloaders on Sun 3?
---
Changed since v1:
 - Updated documentation.
---
 Documentation/admin-guide/kernel-parameters.txt |  2 +-
 arch/m68k/Kconfig                               |  1 +
 arch/m68k/kernel/setup_mm.c                     | 15 ++++++---------
 arch/m68k/mm/motorola.c                         |  2 ++
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 43dc35fe5bc0..ac42b421a95c 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2924,7 +2924,7 @@
 			both parameters are enabled, hugetlb_free_vmemmap takes
 			precedence over memory_hotplug.memmap_on_memory.
 
-	memtest=	[KNL,X86,ARM,PPC,RISCV] Enable memtest
+	memtest=	[KNL,X86,ARM,M68K,PPC,RISCV] Enable memtest
 			Format: <integer>
 			default : 0 <disable>
 			Specifies the number of memtest passes to be
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 0b50da08a9c5..0e96066b3c46 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -9,6 +9,7 @@ config M68K
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
 	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
 	select ARCH_NO_PREEMPT if !COLDFIRE
+	select ARCH_USE_MEMTEST
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
 	select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 4b51bfd38e5f..49e573b94326 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -338,13 +338,6 @@ void __init setup_arch(char **cmdline_p)
 		panic("No configuration setup");
 	}
 
-	paging_init();
-
-#ifdef CONFIG_NATFEAT
-	nf_init();
-#endif
-
-#ifndef CONFIG_SUN3
 #ifdef CONFIG_BLK_DEV_INITRD
 	if (m68k_ramdisk.size) {
 		memblock_reserve(m68k_ramdisk.addr, m68k_ramdisk.size);
@@ -354,6 +347,12 @@ void __init setup_arch(char **cmdline_p)
 	}
 #endif
 
+	paging_init();
+
+#ifdef CONFIG_NATFEAT
+	nf_init();
+#endif
+
 #ifdef CONFIG_ATARI
 	if (MACH_IS_ATARI)
 		atari_stram_reserve_pages((void *)availmem);
@@ -364,8 +363,6 @@ void __init setup_arch(char **cmdline_p)
 	}
 #endif
 
-#endif /* !CONFIG_SUN3 */
-
 /* set ISA defs early as possible */
 #if defined(CONFIG_ISA) && defined(MULTI_ISA)
 	if (MACH_IS_Q40) {
diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
index 9f3f77785aa7..5b6575eb6d02 100644
--- a/arch/m68k/mm/motorola.c
+++ b/arch/m68k/mm/motorola.c
@@ -455,6 +455,8 @@ void __init paging_init(void)
 
 	flush_tlb_all();
 
+	early_memtest(min_addr, max_addr);
+
 	/*
 	 * initialize the bad page table and bad page to point
 	 * to a couple of allocated pages
-- 
2.26.3


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

* Re: [PATCH] m68k: Enable memtest functionality
  2021-11-12  0:36 [PATCH] m68k: Enable memtest functionality Finn Thain
@ 2021-11-12  8:05 ` Geert Uytterhoeven
  2021-11-12 12:34   ` Mike Rapoport
  2021-11-12 21:03   ` Finn Thain
  0 siblings, 2 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-11-12  8:05 UTC (permalink / raw)
  To: Finn Thain
  Cc: Mike Rapoport, Sam Creasey, Jonathan Corbet,
	open list:DOCUMENTATION, Linux Kernel Mailing List, linux-m68k

Hi Finn,

On Fri, Nov 12, 2021 at 1:37 AM Finn Thain <fthain@linux-m68k.org> wrote:
> Enable the memtest functionality and rearrange some code to prevent it
> from clobbering the initrd.
>
> The CONFIG_BLK_DEV_INITRD symbol was conditional on !defined(CONFIG_SUN3).
> For simplicity, remove that test on the basis that m68k_ramdisk.size == 0
> on Sun 3.
>
> The SLIME source code at
> http://sammy.net/sun3/ftp/pub/m68k/sun3/slime/slime-2.0.tar.gz
> indicates that no BI_RAMDISK entry is ever passed to the kernel due
> to #ifdef 0 around the relevant code.
>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Sam Creasey <sammy@sammy.net>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Signed-off-by: Finn Thain <fthain@linux-m68k.org>

Thanks for your patch!

> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -9,6 +9,7 @@ config M68K
>         select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
>         select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
>         select ARCH_NO_PREEMPT if !COLDFIRE
> +       select ARCH_USE_MEMTEST

if MMU_MOTOROLA?

>         select ARCH_WANT_IPC_PARSE_VERSION
>         select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
>         select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
> diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> index 4b51bfd38e5f..49e573b94326 100644
> --- a/arch/m68k/kernel/setup_mm.c
> +++ b/arch/m68k/kernel/setup_mm.c
> @@ -338,13 +338,6 @@ void __init setup_arch(char **cmdline_p)
>                 panic("No configuration setup");
>         }
>
> -       paging_init();
> -
> -#ifdef CONFIG_NATFEAT
> -       nf_init();
> -#endif
> -
> -#ifndef CONFIG_SUN3
>  #ifdef CONFIG_BLK_DEV_INITRD
>         if (m68k_ramdisk.size) {
>                 memblock_reserve(m68k_ramdisk.addr, m68k_ramdisk.size);

Does this still work, given the initrd is part of memory that used
to be added before (in paging_init(), but now is added later?
(I'm no memblock expert, so that might be a silly question ;-)

> @@ -354,6 +347,12 @@ void __init setup_arch(char **cmdline_p)
>         }
>  #endif
>
> +       paging_init();
> +
> +#ifdef CONFIG_NATFEAT
> +       nf_init();
> +#endif
> +
>  #ifdef CONFIG_ATARI
>         if (MACH_IS_ATARI)
>                 atari_stram_reserve_pages((void *)availmem);
> @@ -364,8 +363,6 @@ void __init setup_arch(char **cmdline_p)
>         }
>  #endif
>
> -#endif /* !CONFIG_SUN3 */
> -
>  /* set ISA defs early as possible */
>  #if defined(CONFIG_ISA) && defined(MULTI_ISA)
>         if (MACH_IS_Q40) {
> diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
> index 9f3f77785aa7..5b6575eb6d02 100644
> --- a/arch/m68k/mm/motorola.c
> +++ b/arch/m68k/mm/motorola.c
> @@ -455,6 +455,8 @@ void __init paging_init(void)
>
>         flush_tlb_all();
>
> +       early_memtest(min_addr, max_addr);

So this is available only if MMU_MOTOROLA, not for Sun-3, Coldfire,
or nommu.

> +
>         /*
>          * initialize the bad page table and bad page to point
>          * to a couple of allocated pages

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] m68k: Enable memtest functionality
  2021-11-12  8:05 ` Geert Uytterhoeven
@ 2021-11-12 12:34   ` Mike Rapoport
  2021-11-12 21:03   ` Finn Thain
  1 sibling, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2021-11-12 12:34 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Finn Thain, Sam Creasey, Jonathan Corbet,
	open list:DOCUMENTATION, Linux Kernel Mailing List, linux-m68k

On Fri, Nov 12, 2021 at 09:05:31AM +0100, Geert Uytterhoeven wrote:
> Hi Finn,
> 
> On Fri, Nov 12, 2021 at 1:37 AM Finn Thain <fthain@linux-m68k.org> wrote:
> > Enable the memtest functionality and rearrange some code to prevent it
> > from clobbering the initrd.
> >
> > The CONFIG_BLK_DEV_INITRD symbol was conditional on !defined(CONFIG_SUN3).
> > For simplicity, remove that test on the basis that m68k_ramdisk.size == 0
> > on Sun 3.
> >
> > The SLIME source code at
> > http://sammy.net/sun3/ftp/pub/m68k/sun3/slime/slime-2.0.tar.gz
> > indicates that no BI_RAMDISK entry is ever passed to the kernel due
> > to #ifdef 0 around the relevant code.
> >
> > Cc: Mike Rapoport <rppt@kernel.org>
> > Cc: Sam Creasey <sammy@sammy.net>
> > Cc: Jonathan Corbet <corbet@lwn.net>
> > Signed-off-by: Finn Thain <fthain@linux-m68k.org>
> 
> Thanks for your patch!
> 
> > --- a/arch/m68k/Kconfig
> > +++ b/arch/m68k/Kconfig
> > @@ -9,6 +9,7 @@ config M68K
> >         select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
> >         select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
> >         select ARCH_NO_PREEMPT if !COLDFIRE
> > +       select ARCH_USE_MEMTEST
> 
> if MMU_MOTOROLA?
> 
> >         select ARCH_WANT_IPC_PARSE_VERSION
> >         select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
> >         select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
> > diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
> > index 4b51bfd38e5f..49e573b94326 100644
> > --- a/arch/m68k/kernel/setup_mm.c
> > +++ b/arch/m68k/kernel/setup_mm.c
> > @@ -338,13 +338,6 @@ void __init setup_arch(char **cmdline_p)
> >                 panic("No configuration setup");
> >         }
> >
> > -       paging_init();
> > -
> > -#ifdef CONFIG_NATFEAT
> > -       nf_init();
> > -#endif
> > -
> > -#ifndef CONFIG_SUN3
> >  #ifdef CONFIG_BLK_DEV_INITRD
> >         if (m68k_ramdisk.size) {
> >                 memblock_reserve(m68k_ramdisk.addr, m68k_ramdisk.size);
> 
> Does this still work, given the initrd is part of memory that used
> to be added before (in paging_init(), but now is added later?
> (I'm no memblock expert, so that might be a silly question ;-)

memblock allows reserving non-existing memory just fine. 
 
> > @@ -354,6 +347,12 @@ void __init setup_arch(char **cmdline_p)
> >         }
> >  #endif
> >
> > +       paging_init();
> > +
> > +#ifdef CONFIG_NATFEAT
> > +       nf_init();
> > +#endif
> > +
> >  #ifdef CONFIG_ATARI
> >         if (MACH_IS_ATARI)
> >                 atari_stram_reserve_pages((void *)availmem);
> > @@ -364,8 +363,6 @@ void __init setup_arch(char **cmdline_p)
> >         }
> >  #endif
> >
> > -#endif /* !CONFIG_SUN3 */
> > -
> >  /* set ISA defs early as possible */
> >  #if defined(CONFIG_ISA) && defined(MULTI_ISA)
> >         if (MACH_IS_Q40) {
> > diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c
> > index 9f3f77785aa7..5b6575eb6d02 100644
> > --- a/arch/m68k/mm/motorola.c
> > +++ b/arch/m68k/mm/motorola.c
> > @@ -455,6 +455,8 @@ void __init paging_init(void)
> >
> >         flush_tlb_all();
> >
> > +       early_memtest(min_addr, max_addr);
> 
> So this is available only if MMU_MOTOROLA, not for Sun-3, Coldfire,
> or nommu.
> 
> > +
> >         /*
> >          * initialize the bad page table and bad page to point
> >          * to a couple of allocated pages
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds

-- 
Sincerely yours,
Mike.

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

* Re: [PATCH] m68k: Enable memtest functionality
  2021-11-12  8:05 ` Geert Uytterhoeven
  2021-11-12 12:34   ` Mike Rapoport
@ 2021-11-12 21:03   ` Finn Thain
  1 sibling, 0 replies; 4+ messages in thread
From: Finn Thain @ 2021-11-12 21:03 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Mike Rapoport, Sam Creasey, Jonathan Corbet, linux-doc,
	linux-kernel, linux-m68k

On Fri, 12 Nov 2021, Geert Uytterhoeven wrote:

> > index 9f3f77785aa7..5b6575eb6d02 100644
> > --- a/arch/m68k/mm/motorola.c
> > +++ b/arch/m68k/mm/motorola.c
> > @@ -455,6 +455,8 @@ void __init paging_init(void)
> >
> >         flush_tlb_all();
> >
> > +       early_memtest(min_addr, max_addr);
> 
> So this is available only if MMU_MOTOROLA, not for Sun-3, Coldfire, or 
> nommu.
> 

That's because I can't test the others. If anyone would be willing to test 
a patch like this for Coldfire etc., please let me know and I'll send one.

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

end of thread, other threads:[~2021-11-12 21:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12  0:36 [PATCH] m68k: Enable memtest functionality Finn Thain
2021-11-12  8:05 ` Geert Uytterhoeven
2021-11-12 12:34   ` Mike Rapoport
2021-11-12 21:03   ` Finn Thain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.