All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: Cleanup DSP ASE detection
@ 2018-10-15 18:26 Paul Burton
  2018-10-15 23:40 ` Langer, Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Burton @ 2018-10-15 18:26 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Burton

Currently we hardcode a list of files for which we specify that the
toolchain has DSP ASE support when building for MIPSr2 only. This has a
number of problems:

  1) It doesn't actually ensure that the toolchain supports the DSP ASE
     at all.

  2) It's fragile if we try to use DSP ASE macros in other files.

  3) It makes no provision for MIPSr6 & later systems which also support
     the DSP ASE & end up using the .word directive implementation of
     the DSP macros.

Fix this by detecting assembler support for the DSP ASE globally, not
just for a small set of files, and not just for MIPSr2.

Signed-off-by: Paul Burton <paul.burton@mips.com>
---
 arch/mips/Makefile               |  2 ++
 arch/mips/include/asm/mipsregs.h |  2 +-
 arch/mips/kernel/Makefile        | 18 ------------------
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index c28b9bf617d5..a8f8ca8ccf89 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -231,6 +231,8 @@ toolchain-xpa				:= $(call cc-option-yn,$(xpa-cflags-y) -mxpa)
 cflags-$(toolchain-xpa)			+= -DTOOLCHAIN_SUPPORTS_XPA
 toolchain-crc				:= $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mcrc)
 cflags-$(toolchain-crc)			+= -DTOOLCHAIN_SUPPORTS_CRC
+toolchain-dsp				:= $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mdsp)
+cflags-$(toolchain-crc)			+= -DTOOLCHAIN_SUPPORTS_DSP
 
 #
 # Firmware support
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index a1187e516e47..2493bda9d03e 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -2287,7 +2287,7 @@ do {									\
 	_write_32bit_cp1_register(dest, val, )
 #endif
 
-#ifdef HAVE_AS_DSP
+#ifdef TOOLCHAIN_SUPPORTS_DSP
 #define rddsp(mask)							\
 ({									\
 	unsigned int __dspctl;						\
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index f10e1e15e1c6..210c2802cf4d 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -113,22 +113,4 @@ obj-$(CONFIG_MIPS_CPC)		+= mips-cpc.o
 obj-$(CONFIG_CPU_PM)		+= pm.o
 obj-$(CONFIG_MIPS_CPS_PM)	+= pm-cps.o
 
-#
-# DSP ASE supported for MIPS32 or MIPS64 Release 2 cores only. It is not
-# safe to unconditionnaly use the assembler -mdsp / -mdspr2 switches
-# here because the compiler may use DSP ASE instructions (such as lwx) in
-# code paths where we cannot check that the CPU we are running on supports it.
-# Proper abstraction using HAVE_AS_DSP and macros is done in
-# arch/mips/include/asm/mipsregs.h.
-#
-ifeq ($(CONFIG_CPU_MIPSR2), y)
-CFLAGS_DSP 			= -DHAVE_AS_DSP
-
-CFLAGS_signal.o			= $(CFLAGS_DSP)
-CFLAGS_signal32.o		= $(CFLAGS_DSP)
-CFLAGS_process.o		= $(CFLAGS_DSP)
-CFLAGS_branch.o			= $(CFLAGS_DSP)
-CFLAGS_ptrace.o			= $(CFLAGS_DSP)
-endif
-
 CPPFLAGS_vmlinux.lds		:= $(KBUILD_CFLAGS)
-- 
2.19.1

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

* RE: [PATCH] MIPS: Cleanup DSP ASE detection
  2018-10-15 18:26 [PATCH] MIPS: Cleanup DSP ASE detection Paul Burton
@ 2018-10-15 23:40 ` Langer, Thomas
  2018-10-16 16:38   ` Paul Burton
  0 siblings, 1 reply; 3+ messages in thread
From: Langer, Thomas @ 2018-10-15 23:40 UTC (permalink / raw)
  To: Paul Burton, linux-mips; +Cc: Paul Burton

Hi Paul,

> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index c28b9bf617d5..a8f8ca8ccf89 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -231,6 +231,8 @@ toolchain-xpa				:= $(call cc-option-
> yn,$(xpa-cflags-y) -mxpa)
>  cflags-$(toolchain-xpa)			+= -DTOOLCHAIN_SUPPORTS_XPA
>  toolchain-crc				:= $(call cc-option-yn,$(mips-cflags)
> -Wa$(comma)-mcrc)
>  cflags-$(toolchain-crc)			+= -DTOOLCHAIN_SUPPORTS_CRC
> +toolchain-dsp				:= $(call cc-option-yn,$(mips-cflags)
> -Wa$(comma)-mdsp)
> +cflags-$(toolchain-crc)			+= -DTOOLCHAIN_SUPPORTS_DSP

                      ^^^
                      dsp

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

* Re: [PATCH] MIPS: Cleanup DSP ASE detection
  2018-10-15 23:40 ` Langer, Thomas
@ 2018-10-16 16:38   ` Paul Burton
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Burton @ 2018-10-16 16:38 UTC (permalink / raw)
  To: Langer, Thomas; +Cc: linux-mips, Paul Burton

Hi Thomas,

On Mon, Oct 15, 2018 at 11:40:04PM +0000, Langer, Thomas wrote:
> Hi Paul,
> 
> > diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> > index c28b9bf617d5..a8f8ca8ccf89 100644
> > --- a/arch/mips/Makefile
> > +++ b/arch/mips/Makefile
> > @@ -231,6 +231,8 @@ toolchain-xpa				:= $(call cc-option-
> > yn,$(xpa-cflags-y) -mxpa)
> >  cflags-$(toolchain-xpa)			+= -DTOOLCHAIN_SUPPORTS_XPA
> >  toolchain-crc				:= $(call cc-option-yn,$(mips-cflags)
> > -Wa$(comma)-mcrc)
> >  cflags-$(toolchain-crc)			+= -DTOOLCHAIN_SUPPORTS_CRC
> > +toolchain-dsp				:= $(call cc-option-yn,$(mips-cflags)
> > -Wa$(comma)-mdsp)
> > +cflags-$(toolchain-crc)			+= -DTOOLCHAIN_SUPPORTS_DSP
> 
>                       ^^^
>                       dsp

Indeed... well spotted!

Thanks,
    Paul

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

end of thread, other threads:[~2018-10-16 16:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 18:26 [PATCH] MIPS: Cleanup DSP ASE detection Paul Burton
2018-10-15 23:40 ` Langer, Thomas
2018-10-16 16:38   ` Paul Burton

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.