linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] m68k: Fix invalid RMW_INSNS on CPUs that lack CAS
@ 2021-07-25 10:44 Geert Uytterhoeven
  2021-07-25 15:21 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2021-07-25 10:44 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: kernel test robot, Arnd Bergmann, linux-m68k, linux-kernel,
	Geert Uytterhoeven

When enabling CONFIG_RMW_INSNS in e.g. a Coldfire build:

    {standard input}:3068: Error: invalid instruction for this architecture; needs 68020 or higher (68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060]) -- statement `casl %d4,%d0,(%a6)' ignored

Fix this by (a) adding a new config symbol to track if support for any
CPU that lacks the CAS instruction is enabled, and (b) making
CONFIG_RMW_INSNS depend on the new symbol not being set.

Fixes: 0e152d80507b75c0 ("m68k: reorganize Kconfig options to improve mmu/non-mmu selections")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 arch/m68k/Kconfig.cpu | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index 29e946394fdb4017..277d61a094637ce3 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -26,6 +26,7 @@ config COLDFIRE
 	bool "Coldfire CPU family support"
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select CPU_HAS_NO_BITFIELDS
+	select CPU_HAS_NO_CAS
 	select CPU_HAS_NO_MULDIV64
 	select GENERIC_CSUM
 	select GPIOLIB
@@ -39,6 +40,7 @@ config M68000
 	bool
 	depends on !MMU
 	select CPU_HAS_NO_BITFIELDS
+	select CPU_HAS_NO_CAS
 	select CPU_HAS_NO_MULDIV64
 	select CPU_HAS_NO_UNALIGNED
 	select GENERIC_CSUM
@@ -54,6 +56,7 @@ config M68000
 config MCPU32
 	bool
 	select CPU_HAS_NO_BITFIELDS
+	select CPU_HAS_NO_CAS
 	select CPU_HAS_NO_UNALIGNED
 	select CPU_NO_EFFICIENT_FFS
 	help
@@ -383,7 +386,7 @@ config ADVANCED
 
 config RMW_INSNS
 	bool "Use read-modify-write instructions"
-	depends on ADVANCED
+	depends on ADVANCED && !CPU_HAS_NO_CAS
 	help
 	  This allows to use certain instructions that work with indivisible
 	  read-modify-write bus cycles. While this is faster than the
@@ -450,6 +453,9 @@ config M68K_L2_CACHE
 config CPU_HAS_NO_BITFIELDS
 	bool
 
+config CPU_HAS_NO_CAS
+	bool
+
 config CPU_HAS_NO_MULDIV64
 	bool
 
-- 
2.25.1


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

* Re: [PATCH] m68k: Fix invalid RMW_INSNS on CPUs that lack CAS
  2021-07-25 10:44 [PATCH] m68k: Fix invalid RMW_INSNS on CPUs that lack CAS Geert Uytterhoeven
@ 2021-07-25 15:21 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2021-07-25 15:21 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Greg Ungerer, kernel test robot, Arnd Bergmann, linux-m68k,
	Linux Kernel Mailing List

On Sun, Jul 25, 2021 at 3:02 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> When enabling CONFIG_RMW_INSNS in e.g. a Coldfire build:
>
>     {standard input}:3068: Error: invalid instruction for this architecture; needs 68020 or higher (68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060]) -- statement `casl %d4,%d0,(%a6)' ignored
>
> Fix this by (a) adding a new config symbol to track if support for any
> CPU that lacks the CAS instruction is enabled, and (b) making
> CONFIG_RMW_INSNS depend on the new symbol not being set.
>
> Fixes: 0e152d80507b75c0 ("m68k: reorganize Kconfig options to improve mmu/non-mmu selections")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Arnd Bergmann <arnd@arndb.de>

> @@ -54,6 +56,7 @@ config M68000
>  config MCPU32
>         bool
>         select CPU_HAS_NO_BITFIELDS
> +       select CPU_HAS_NO_CAS
>         select CPU_HAS_NO_UNALIGNED
>         select CPU_NO_EFFICIENT_FFS
>         help

As far as I can see, there are no users for CONFIG_MCPU32
after M68360 was removed in linux-4.6, but as long as the
option is there, it makes sense to keep it correct.

     Arnd

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

end of thread, other threads:[~2021-07-25 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-25 10:44 [PATCH] m68k: Fix invalid RMW_INSNS on CPUs that lack CAS Geert Uytterhoeven
2021-07-25 15:21 ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).