* [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build [not found] <20191016214805.727399379@linuxfoundation.org> @ 2019-10-16 21:51 ` Greg Kroah-Hartman 2020-08-26 21:06 ` Guenter Roeck 2019-10-16 21:51 ` [PATCH 4.19 67/81] MIPS: elf_hwcap: Export userspace ASEs Greg Kroah-Hartman 1 sibling, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2019-10-16 21:51 UTC (permalink / raw) To: linux-kernel Cc: Greg Kroah-Hartman, stable, Paul Burton, Huacai Chen, Jiaxun Yang, linux-mips From: Paul Burton <paul.burton@mips.com> 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 <paul.burton@mips.com> 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 <chenhc@lemote.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: stable@vger.kernel.org # v2.6.32+ Cc: linux-mips@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- 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) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build 2019-10-16 21:51 ` [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build Greg Kroah-Hartman @ 2020-08-26 21:06 ` Guenter Roeck 2020-09-03 9:26 ` Greg Kroah-Hartman 0 siblings, 1 reply; 6+ messages in thread From: Guenter Roeck @ 2020-08-26 21:06 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: linux-kernel, stable, Paul Burton, Huacai Chen, Jiaxun Yang, linux-mips Hi, On Wed, Oct 16, 2019 at 02:51:17PM -0700, Greg Kroah-Hartman wrote: > From: Paul Burton <paul.burton@mips.com> > > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build 2020-08-26 21:06 ` Guenter Roeck @ 2020-09-03 9:26 ` Greg Kroah-Hartman 2020-09-07 3:35 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 6+ messages in thread From: Greg Kroah-Hartman @ 2020-09-03 9:26 UTC (permalink / raw) To: Guenter Roeck Cc: linux-kernel, stable, Paul Burton, Huacai Chen, Jiaxun Yang, linux-mips 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 <paul.burton@mips.com> > > > > 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? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build 2020-09-03 9:26 ` Greg Kroah-Hartman @ 2020-09-07 3:35 ` Philippe Mathieu-Daudé 2020-09-24 13:54 ` Thomas Bogendoerfer 0 siblings, 1 reply; 6+ messages in thread From: Philippe Mathieu-Daudé @ 2020-09-07 3:35 UTC (permalink / raw) To: Greg Kroah-Hartman, Thomas Bogendoerfer Cc: Guenter Roeck, open list, stable, Paul Burton, Huacai Chen, Jiaxun Yang, open list:BROADCOM NVRAM DRIVER On Thu, Sep 3, 2020 at 11:28 AM Greg Kroah-Hartman <gregkh@linuxfoundation.org> 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 <paul.burton@mips.com> > > > > > > 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. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build 2020-09-07 3:35 ` Philippe Mathieu-Daudé @ 2020-09-24 13:54 ` Thomas Bogendoerfer 0 siblings, 0 replies; 6+ messages in thread From: Thomas Bogendoerfer @ 2020-09-24 13:54 UTC (permalink / raw) To: Philippe Mathieu-Daudé Cc: Greg Kroah-Hartman, Guenter Roeck, open list, stable, Paul Burton, Huacai Chen, Jiaxun Yang, open list:BROADCOM NVRAM DRIVER 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 > <gregkh@linuxfoundation.org> 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 <paul.burton@mips.com> > > > > > > > > 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 ] ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4.19 67/81] MIPS: elf_hwcap: Export userspace ASEs [not found] <20191016214805.727399379@linuxfoundation.org> 2019-10-16 21:51 ` [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build Greg Kroah-Hartman @ 2019-10-16 21:51 ` Greg Kroah-Hartman 1 sibling, 0 replies; 6+ messages in thread From: Greg Kroah-Hartman @ 2019-10-16 21:51 UTC (permalink / raw) To: linux-kernel Cc: Greg Kroah-Hartman, stable, Meng Zhuo, Jiaxun Yang, linux-mips, Paul Burton From: Jiaxun Yang <jiaxun.yang@flygoat.com> commit 38dffe1e4dde1d3174fdce09d67370412843ebb5 upstream. A Golang developer reported MIPS hwcap isn't reflecting instructions that the processor actually supported so programs can't apply optimized code at runtime. Thus we export the ASEs that can be used in userspace programs. Reported-by: Meng Zhuo <mengzhuo1203@gmail.com> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: linux-mips@vger.kernel.org Cc: Paul Burton <paul.burton@mips.com> Cc: <stable@vger.kernel.org> # 4.14+ Signed-off-by: Paul Burton <paul.burton@mips.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- arch/mips/include/uapi/asm/hwcap.h | 11 +++++++++++ arch/mips/kernel/cpu-probe.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) --- a/arch/mips/include/uapi/asm/hwcap.h +++ b/arch/mips/include/uapi/asm/hwcap.h @@ -6,5 +6,16 @@ #define HWCAP_MIPS_R6 (1 << 0) #define HWCAP_MIPS_MSA (1 << 1) #define HWCAP_MIPS_CRC32 (1 << 2) +#define HWCAP_MIPS_MIPS16 (1 << 3) +#define HWCAP_MIPS_MDMX (1 << 4) +#define HWCAP_MIPS_MIPS3D (1 << 5) +#define HWCAP_MIPS_SMARTMIPS (1 << 6) +#define HWCAP_MIPS_DSP (1 << 7) +#define HWCAP_MIPS_DSP2 (1 << 8) +#define HWCAP_MIPS_DSP3 (1 << 9) +#define HWCAP_MIPS_MIPS16E2 (1 << 10) +#define HWCAP_LOONGSON_MMI (1 << 11) +#define HWCAP_LOONGSON_EXT (1 << 12) +#define HWCAP_LOONGSON_EXT2 (1 << 13) #endif /* _UAPI_ASM_HWCAP_H */ --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -2105,6 +2105,39 @@ void cpu_probe(void) elf_hwcap |= HWCAP_MIPS_MSA; } + if (cpu_has_mips16) + elf_hwcap |= HWCAP_MIPS_MIPS16; + + if (cpu_has_mdmx) + elf_hwcap |= HWCAP_MIPS_MDMX; + + if (cpu_has_mips3d) + elf_hwcap |= HWCAP_MIPS_MIPS3D; + + if (cpu_has_smartmips) + elf_hwcap |= HWCAP_MIPS_SMARTMIPS; + + if (cpu_has_dsp) + elf_hwcap |= HWCAP_MIPS_DSP; + + if (cpu_has_dsp2) + elf_hwcap |= HWCAP_MIPS_DSP2; + + if (cpu_has_dsp3) + elf_hwcap |= HWCAP_MIPS_DSP3; + + if (cpu_has_mips16e2) + elf_hwcap |= HWCAP_MIPS_MIPS16E2; + + if (cpu_has_loongson_mmi) + elf_hwcap |= HWCAP_LOONGSON_MMI; + + if (cpu_has_loongson_ext) + elf_hwcap |= HWCAP_LOONGSON_EXT; + + if (cpu_has_loongson_ext2) + elf_hwcap |= HWCAP_LOONGSON_EXT2; + if (cpu_has_vz) cpu_probe_vz(c); ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-09-24 13:59 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20191016214805.727399379@linuxfoundation.org>
2019-10-16 21:51 ` [PATCH 4.19 66/81] MIPS: Disable Loongson MMI instructions for kernel build Greg Kroah-Hartman
2020-08-26 21:06 ` Guenter Roeck
2020-09-03 9:26 ` Greg Kroah-Hartman
2020-09-07 3:35 ` Philippe Mathieu-Daudé
2020-09-24 13:54 ` Thomas Bogendoerfer
2019-10-16 21:51 ` [PATCH 4.19 67/81] MIPS: elf_hwcap: Export userspace ASEs Greg Kroah-Hartman
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).