2019-10-17 18:38:19

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build

From: Paul Burton <[email protected]>

commit 2f2b4fd674cadd8c6b40eb629e140a14db4068fd upstream.

GCC 9.x automatically enables support for Loongson MMI instructions when
using some -march= flags, and then errors out when -msoft-float is
specified with:

cc1: error: ‘-mloongson-mmi’ must be used with ‘-mhard-float’

The kernel shouldn't be using these MMI instructions anyway, just as it
doesn't use floating point instructions. Explicitly disable them in
order to fix the build with GCC 9.x.

Signed-off-by: Paul Burton <[email protected]>
Fixes: 3702bba5eb4f ("MIPS: Loongson: Add GCC 4.4 support for Loongson2E")
Fixes: 6f7a251a259e ("MIPS: Loongson: Add basic Loongson 2F support")
Fixes: 5188129b8c9f ("MIPS: Loongson-3: Improve -march option and move it to Platform")
Cc: Huacai Chen <[email protected]>
Cc: Jiaxun Yang <[email protected]>
Cc: [email protected] # v2.6.32+
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
arch/mips/loongson64/Platform | 4 ++++
arch/mips/vdso/Makefile | 1 +
2 files changed, 5 insertions(+)

--- a/arch/mips/loongson64/Platform
+++ b/arch/mips/loongson64/Platform
@@ -43,6 +43,10 @@ else
$(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64)
endif

+# Some -march= flags enable MMI instructions, and GCC complains about that
+# support being enabled alongside -msoft-float. Thus explicitly disable MMI.
+cflags-y += $(call cc-option,-mno-loongson-mmi)
+
#
# Loongson Machines' Support
#
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -9,6 +9,7 @@ ccflags-vdso := \
$(filter -mmicromips,$(KBUILD_CFLAGS)) \
$(filter -march=%,$(KBUILD_CFLAGS)) \
$(filter -m%-float,$(KBUILD_CFLAGS)) \
+ $(filter -mno-loongson-%,$(KBUILD_CFLAGS)) \
-D__VDSO__

ifeq ($(cc-name),clang)



2020-08-26 21:07:47

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build

Hi,

On Wed, Oct 16, 2019 at 02:51:17PM -0700, Greg Kroah-Hartman wrote:
> From: Paul Burton <[email protected]>
>
> commit 2f2b4fd674cadd8c6b40eb629e140a14db4068fd upstream.
>
> GCC 9.x automatically enables support for Loongson MMI instructions when
> using some -march= flags, and then errors out when -msoft-float is
> specified with:
>
> cc1: error: ‘-mloongson-mmi’ must be used with ‘-mhard-float’
>
> The kernel shouldn't be using these MMI instructions anyway, just as it
> doesn't use floating point instructions. Explicitly disable them in
> order to fix the build with GCC 9.x.
>

I still see this problem when trying to compile fuloong2e_defconfig with
gcc 9.x or later. Reason seems to be that the patch was applied to
arch/mips/loongson64/Platform, but fuloong2e_defconfig uses
arch/mips/loongson2ef/Platform.

Am I missing something ?

Thanks,
Guenter

2020-09-03 09:29:29

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build

On Wed, Aug 26, 2020 at 02:06:28PM -0700, Guenter Roeck wrote:
> Hi,
>
> On Wed, Oct 16, 2019 at 02:51:17PM -0700, Greg Kroah-Hartman wrote:
> > From: Paul Burton <[email protected]>
> >
> > commit 2f2b4fd674cadd8c6b40eb629e140a14db4068fd upstream.
> >
> > GCC 9.x automatically enables support for Loongson MMI instructions when
> > using some -march= flags, and then errors out when -msoft-float is
> > specified with:
> >
> > cc1: error: ‘-mloongson-mmi’ must be used with ‘-mhard-float’
> >
> > The kernel shouldn't be using these MMI instructions anyway, just as it
> > doesn't use floating point instructions. Explicitly disable them in
> > order to fix the build with GCC 9.x.
> >
>
> I still see this problem when trying to compile fuloong2e_defconfig with
> gcc 9.x or later. Reason seems to be that the patch was applied to
> arch/mips/loongson64/Platform, but fuloong2e_defconfig uses
> arch/mips/loongson2ef/Platform.
>
> Am I missing something ?

I don't know, sorry, that would be something that Paul understands.

Paul?


2020-09-07 03:37:04

by Philippe Mathieu-Daudé

[permalink] [raw]
Subject: Re: [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build

On Thu, Sep 3, 2020 at 11:28 AM Greg Kroah-Hartman
<[email protected]> wrote:
>
> On Wed, Aug 26, 2020 at 02:06:28PM -0700, Guenter Roeck wrote:
> > Hi,
> >
> > On Wed, Oct 16, 2019 at 02:51:17PM -0700, Greg Kroah-Hartman wrote:
> > > From: Paul Burton <[email protected]>
> > >
> > > commit 2f2b4fd674cadd8c6b40eb629e140a14db4068fd upstream.
> > >
> > > GCC 9.x automatically enables support for Loongson MMI instructions when
> > > using some -march= flags, and then errors out when -msoft-float is
> > > specified with:
> > >
> > > cc1: error: ‘-mloongson-mmi’ must be used with ‘-mhard-float’
> > >
> > > The kernel shouldn't be using these MMI instructions anyway, just as it
> > > doesn't use floating point instructions. Explicitly disable them in
> > > order to fix the build with GCC 9.x.
> > >
> >
> > I still see this problem when trying to compile fuloong2e_defconfig with
> > gcc 9.x or later. Reason seems to be that the patch was applied to
> > arch/mips/loongson64/Platform, but fuloong2e_defconfig uses
> > arch/mips/loongson2ef/Platform.
> >
> > Am I missing something ?
>
> I don't know, sorry, that would be something that Paul understands.
>
> Paul?

Cc'ing Thomas who now maintains this.

2020-09-24 14:03:38

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build

On Mon, Sep 07, 2020 at 05:35:26AM +0200, Philippe Mathieu-Daudé wrote:
> On Thu, Sep 3, 2020 at 11:28 AM Greg Kroah-Hartman
> <[email protected]> wrote:
> >
> > On Wed, Aug 26, 2020 at 02:06:28PM -0700, Guenter Roeck wrote:
> > > Hi,
> > >
> > > On Wed, Oct 16, 2019 at 02:51:17PM -0700, Greg Kroah-Hartman wrote:
> > > > From: Paul Burton <[email protected]>
> > > >
> > > > commit 2f2b4fd674cadd8c6b40eb629e140a14db4068fd upstream.
> > > >
> > > > GCC 9.x automatically enables support for Loongson MMI instructions when
> > > > using some -march= flags, and then errors out when -msoft-float is
> > > > specified with:
> > > >
> > > > cc1: error: ‘-mloongson-mmi’ must be used with ‘-mhard-float’
> > > >
> > > > The kernel shouldn't be using these MMI instructions anyway, just as it
> > > > doesn't use floating point instructions. Explicitly disable them in
> > > > order to fix the build with GCC 9.x.
> > > >
> > >
> > > I still see this problem when trying to compile fuloong2e_defconfig with
> > > gcc 9.x or later. Reason seems to be that the patch was applied to
> > > arch/mips/loongson64/Platform, but fuloong2e_defconfig uses
> > > arch/mips/loongson2ef/Platform.
> > >
> > > Am I missing something ?
> >
> > I don't know, sorry, that would be something that Paul understands.
> >
> > Paul?
>
> Cc'ing Thomas who now maintains this.

I've queued a patch to fix this in mips-fixes.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]