Skip to contentSkip to conversation

m68knommu: fix non-specific 68328 choice interrupt build failure

PATCH In review Greg Ungerer 2 participants 8 messages Aug 26, 2022 – Aug 30, 2022

Subsystems (2)
lore
Share & tools
lore

Greg Ungerer

author maintainer
#0 lore raw

PATCH 1/3 m68knommu: fix non-specific 68328 choice interrupt build failure

Compiling for a classic m68k non-MMU target with no specific CPU selected fails with the following error:

arch/m68k/68000/ints.c: In function 'process_int':

Quoted 1 line
Quoted 1 line

arch/m68k/68000/ints.c:82:30: error: 'ISR' undeclared (first use in this function)

      82 |         unsigned long pend = ISR;
         |                              ^~~

This interrupt handling code is specific to the 68328 family of 68000 parts. There is a couple of variants (68EZ328, 68VZ328) and the common ancestor of them the strait 68328.

The code here includes a specific header for each variant type. But if none is selected then nothing is included to supply the appropriate register and bit flags defines.

Rearrange the includes so that at least one type is always included. At the very least the 68328 base type should be the fallback, so make that true.

---
 arch/m68k/68000/ints.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/m68k/68000/ints.c +3 -3
index cda49b12d7be..f9a5ec781408 100644
@@ -18,12 +18,12 @@
 #include <asm/io.h>
 #include <asm/machdep.h>
 
-#if defined(CONFIG_M68328)
-#include <asm/MC68328.h>
-#elif defined(CONFIG_M68EZ328)
+#if defined(CONFIG_M68EZ328)
 #include <asm/MC68EZ328.h>
 #elif defined(CONFIG_M68VZ328)
 #include <asm/MC68VZ328.h>
+#else
+#include <asm/MC68328.h>
 #endif
 
 /* assembler routines */
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 2/3 m68knommu: fix non-mmu classic 68000 legacy timer tick selection

The family of classic 68000 parts supported when in non-mmu mode all currently use the legacy timer support. Move the selection of that config option, LEGACY_TIMER_TICK, into the core CPU configuration.

This fixes compilation if no specific CPU variant is selected, since the LEGACY_TIMER_TICK option was only selected in the specific CPU variant configurations.

---
 arch/m68k/Kconfig.cpu | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
arch/m68k/Kconfig.cpu +1 -3
index e0e9e31339c1..b0504b13b089 100644
@@ -46,6 +46,7 @@ config M68000
 	select GENERIC_CSUM
 	select CPU_NO_EFFICIENT_FFS
 	select HAVE_ARCH_HASH
+	select LEGACY_TIMER_TICK
 	help
 	  The Freescale (was Motorola) 68000 CPU is the first generation of
 	  the well known M68K family of processors. The CPU core as well as
@@ -97,7 +98,6 @@ config M68060
 config M68328
 	bool
 	depends on !MMU
-	select LEGACY_TIMER_TICK
 	select M68000
 	help
 	  Motorola 68328 processor support.
@@ -105,7 +105,6 @@ config M68328
 config M68EZ328
 	bool
 	depends on !MMU
-	select LEGACY_TIMER_TICK
 	select M68000
 	help
 	  Motorola 68EX328 processor support.
@@ -113,7 +112,6 @@ config M68EZ328
 config M68VZ328
 	bool
 	depends on !MMU
-	select LEGACY_TIMER_TICK
 	select M68000
 	help
 	  Motorola 68VZ328 processor support.
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] m68knommu: fix non-mmu classic 68000 legacy timer tick selection

Quoted 9 lines · Greg Ungerer

The family of classic 68000 parts supported when in non-mmu mode all currently use the legacy timer support. Move the selection of that config option, LEGACY_TIMER_TICK, into the core CPU configuration.

This fixes compilation if no specific CPU variant is selected, since the LEGACY_TIMER_TICK option was only selected in the specific CPU variant configurations.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

author maintainer
#3 lore raw

PATCH 3/3 m68k: allow kexec on all MMU enabled CPUs

In reply to Greg Ungerer

The configuration setting for 68k kexec support limits it to only the classic 68k CPU types (so no ColdFire). However the underlying support can handle any 68k CPU that is MMU enabled - and that includes ColdFire. (Of course that support is only as good as mentioned in the current configuration help).

None of the no-MMU CPU types (classic or ColdFire) have support for kexec yet, so the configuration as it stands is not quite right, and it will fail to compile on them.

---
 arch/m68k/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/Kconfig +1 -1
index b06faf6c0b27..fa6e69ec0b38 100644
@@ -87,7 +87,7 @@ config MMU_SUN3
 
 config KEXEC
 	bool "kexec system call"
-	depends on M68KCLASSIC
+	depends on MMU
 	select KEXEC_CORE
 	help
 	  kexec is a system call that implements the ability to shutdown your
Signature · 1 line
2.25.1
#4 lore raw

Re: [PATCH 3/3] m68k: allow kexec on all MMU enabled CPUs

Hi Greg,

Quoted 11 lines · Greg Ungerer

The configuration setting for 68k kexec support limits it to only the classic 68k CPU types (so no ColdFire). However the underlying support can handle any 68k CPU that is MMU enabled - and that includes ColdFire. (Of course that support is only as good as mentioned in the current configuration help).

None of the no-MMU CPU types (classic or ColdFire) have support for kexec yet, so the configuration as it stands is not quite right, and it will fail to compile on them.

Thanks for your patch!

arch/m68k/Kconfig config MMU_SUN3 · line 93

Quoted 11 lines
arch/m68k/Kconfig +1 -1
@@ -87,7 +87,7 @@ config MMU_SUN3
 
 config KEXEC
        bool "kexec system call"
-       depends on M68KCLASSIC
+       depends on MMU
        select KEXEC_CORE
        help
          kexec is a system call that implements the ability to shutdown your

Don't you need changes to arch/m68k/kernel/relocate_kernel.S, which supports 68020+ only?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

author maintainer
#5 lore raw

Re: [PATCH 3/3] m68k: allow kexec on all MMU enabled CPUs

Hi Geert,

Quoted 19 lines · Geert Uytterhoeven
Quoted 11 lines · Greg Ungerer

The configuration setting for 68k kexec support limits it to only the classic 68k CPU types (so no ColdFire). However the underlying support can handle any 68k CPU that is MMU enabled - and that includes ColdFire. (Of course that support is only as good as mentioned in the current configuration help).

None of the no-MMU CPU types (classic or ColdFire) have support for kexec yet, so the configuration as it stands is not quite right, and it will fail to compile on them.

Thanks for your patch!

Quoted 4 lines
arch/m68k/Kconfig +0 -0
@@ -87,7 +87,7 @@ config MMU_SUN3
 
Quoted 10 lines

arch/m68k/Kconfig config MMU_SUN3 · line 93

Quoted 7 lines
arch/m68k/Kconfig +1 -1
  config KEXEC
         bool "kexec system call"
-       depends on M68KCLASSIC
+       depends on MMU
         select KEXEC_CORE
         help
           kexec is a system call that implements the ability to shutdown your

Don't you need changes to arch/m68k/kernel/relocate_kernel.S, which supports 68020+ only?

I suspect so looking at that now. It compiles ok, but without a check for MMU type specific to ColdFire it will likely fail. I didn't dig into it too deeply, my primary goal with to fix compilation for the non-MMU targets.

I started out testing it with this:

    depends on M68KCLASSIC && MMU

And that works and fixes the problem I was most interested in.
But then I figured that perhaps it is better to allow if for ColdFire with MMU enabled.

I didn't want to go down the rabbit hole of trying to get it working on non-MMU platforms (and ColdFire with MMU enabled either really).

So I would be just as happy to limit it to M68KCLASSIC and MMU for now?

Regards
Greg

Quoted 10 lines

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

#6 lore raw

Re: [PATCH 3/3] m68k: allow kexec on all MMU enabled CPUs

Hi Greg,

Quoted 38 lines · Greg Ungerer
Quoted 17 lines · Geert Uytterhoeven
Quoted 16 lines · Greg Ungerer

The configuration setting for 68k kexec support limits it to only the classic 68k CPU types (so no ColdFire). However the underlying support can handle any 68k CPU that is MMU enabled - and that includes ColdFire. (Of course that support is only as good as mentioned in the current configuration help).

None of the no-MMU CPU types (classic or ColdFire) have support for kexec yet, so the configuration as it stands is not quite right, and it will fail to compile on them.

arch/m68k/Kconfig +0 -0
@@ -87,7 +87,7 @@ config MMU_SUN3
 
Quoted 10 lines

arch/m68k/Kconfig config MMU_SUN3 · line 93

Quoted 7 lines
arch/m68k/Kconfig +1 -1
  config KEXEC
         bool "kexec system call"
-       depends on M68KCLASSIC
+       depends on MMU
         select KEXEC_CORE
         help
           kexec is a system call that implements the ability to shutdown your

Don't you need changes to arch/m68k/kernel/relocate_kernel.S, which supports 68020+ only?

I suspect so looking at that now. It compiles ok, but without a check for MMU type specific to ColdFire it will likely fail. I didn't dig into it too deeply, my primary goal with to fix compilation for the non-MMU targets.

I started out testing it with this:

     depends on M68KCLASSIC && MMU
Quoted 7 lines

And that works and fixes the problem I was most interested in.
But then I figured that perhaps it is better to allow if for ColdFire with MMU enabled.

I didn't want to go down the rabbit hole of trying to get it working on non-MMU platforms (and ColdFire with MMU enabled either really).

So I would be just as happy to limit it to M68KCLASSIC and MMU for now?

That sounds fine to me.
Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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

maintainer Reviewed-by on v1 1/3
#7 lore raw
In reply to Greg Ungerer
Quoted 16 lines · Greg Ungerer

Compiling for a classic m68k non-MMU target with no specific CPU selected fails with the following error:

   arch/m68k/68000/ints.c: In function 'process_int':
Quoted 1 line
Quoted 1 line

arch/m68k/68000/ints.c:82:30: error: 'ISR' undeclared (first use in this function)

      82 |         unsigned long pend = ISR;
         |                              ^~~

This interrupt handling code is specific to the 68328 family of 68000 parts. There is a couple of variants (68EZ328, 68VZ328) and the common ancestor of them the strait 68328.

The code here includes a specific header for each variant type. But if none is selected then nothing is included to supply the appropriate register and bit flags defines.

Quoted 6 lines

Rearrange the includes so that at least one type is always included. At the very least the 68328 base type should be the fallback, so make that true.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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