mips: .../swab.h: fix a compiling failure
PATCH 1/2 mips: .../swab.h: fix a compiling failure
It was introduced in commit
"mips: use wsbh/dsbh/dshd on Loongson3A"
(http://patchwork.linux-mips.org/patch/7542/)
--- arch/mips/include/uapi/asm/swab.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/include/uapi/asm/swab.h +2 -2
@@ -55,8 +55,8 @@ static inline __attribute_const__ __u64 __arch_swab64(__u64 x) __asm__(" .set push \n" " .set arch=mips64r2 \n" -" dsbh %0, %1\n" -" dshd %0, %0" +" dsbh %0, %1 \n" +" dshd %0, %0 \n" " .set pop \n" :"=r" (x) :"r" (x));
Signature · 1 line
1.9.0
PATCH 1/1 mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
commit "mips: use wsbh/dsbh/dshd on Loongson 3A"
(http://patchwork.linux-mips.org/patch/7542/) forgot to define this switch, hence the optimized path in arch/mips/include/uapi/asm/swab.h is not enabled on Loongson3.
--- arch/mips/loongson/Platform | 3 +++ 1 file changed, 3 insertions(+)
arch/mips/loongson/Platform +3 -0
@@ -22,6 +22,9 @@ ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS endif endif +# Define _MIPS_ARCH_LOONGSON3A for Loongson3 +cflags-$(CONFIG_CPU_LOONGSON3) += -D_MIPS_ARCH_LOONGSON3A + # # Loongson Machines' Support #
Signature · 1 line
1.9.0
Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
Hi,
arch/mips/loongson/Platform ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS · line 26
Quoted 10 lines · chenj
arch/mips/loongson/Platform +2
-0@@ -22,6 +22,9 @@ ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS endif endif +# Define _MIPS_ARCH_LOONGSON3A for Loongson3 +cflags-$(CONFIG_CPU_LOONGSON3) += -D_MIPS_ARCH_LOONGSON3A
Any reason not to just refer directly to CONFIG_CPU_LOONGSON3 from the source rather than adding an intermediate definition?
Cheers
James
Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
In reply to chenjQuoted 1 line · chenj
+cflags-$(CONFIG_CPU_LOONGSON3) += -D_MIPS_ARCH_LOONGSON3A
The _MIPS_ARCH_* namespace belongs to GCC. While it seems current GCC does not define this symbol _MIPS_ARCH_LOONGSON3A runs into the danger of causing a conflict when GCC eventually will define the symbol.
Ralf
Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
2014-08-20 18:53 GMT+08:00 Ralf Baechle <[email protected]>:
Quoted 7 lines · chenj
Quoted 2 lines
+cflags-$(CONFIG_CPU_LOONGSON3) += -D_MIPS_ARCH_LOONGSON3A
The _MIPS_ARCH_* namespace belongs to GCC. While it seems current GCC does not define this symbol
_MIPS_ARCH_LOONGSON3Aruns into the danger of causing a conflict when GCC eventually will define the symbol.
When this symbol will be defined? With option '-march=loongson3a'?
Quoted 3 lines · chenj
It was introduced in commit
"mips: use wsbh/dsbh/dshd on Loongson3A"
(http://patchwork.linux-mips.org/patch/7542/)
Thanks, folded into the original patch.
Ralf
Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
In reply to Chen JieQuoted 9 lines · Chen Jie
2014-08-20 18:53 GMT+08:00 Ralf Baechle <[email protected]>:
Quoted 7 lines · chenj
Quoted 2 lines
+cflags-$(CONFIG_CPU_LOONGSON3) += -D_MIPS_ARCH_LOONGSON3A
The _MIPS_ARCH_* namespace belongs to GCC. While it seems current GCC does not define this symbol
_MIPS_ARCH_LOONGSON3Aruns into the danger of causing a conflict when GCC eventually will define the symbol.When this symbol will be defined? With option '-march=loongson3a'?
Well, not currently (at least not in my gcc 4.9.0) - but it might. In fact, I'm wondering why it doesn't. Maciej?
Ralf
Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
Quoted 9 lines · Ralf Baechle
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
+cflags-$(CONFIG_CPU_LOONGSON3) += -D_MIPS_ARCH_LOONGSON3A
The _MIPS_ARCH_* namespace belongs to GCC. While it seems current GCC does not define this symbol
_MIPS_ARCH_LOONGSON3Aruns into the danger of causing a conflict when GCC eventually will define the symbol.When this symbol will be defined? With option '-march=loongson3a'?
Well, not currently (at least not in my gcc 4.9.0) - but it might. In fact, I'm wondering why it doesn't. Maciej?
No idea, a _MIPS_ARCH_foo macro gets defined automagically by GCC
whenever `-march=foo' is in effect (be it implicitly or with the use of a command-line option), so there should be one.
Has support for "loongson3a" been present in 4.9.x (it is in trunk)? If
so, then what _MIPS_ARCH_* macro gets defined for `-march=loongson3a'?
Maciej
Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
Quoted 12 lines · Maciej W. Rozycki
Quoted 9 lines · Ralf Baechle
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
+cflags-$(CONFIG_CPU_LOONGSON3) += -D_MIPS_ARCH_LOONGSON3A
The _MIPS_ARCH_* namespace belongs to GCC. While it seems current GCC does not define this symbol
_MIPS_ARCH_LOONGSON3Aruns into the danger of causing a conflict when GCC eventually will define the symbol.When this symbol will be defined? With option '-march=loongson3a'?
Well, not currently (at least not in my gcc 4.9.0) - but it might. In fact, I'm wondering why it doesn't. Maciej?
Quoted 6 lines
No idea, a
_MIPS_ARCH_foomacro gets defined automagically by GCC
whenever `-march=foo' is in effect (be it implicitly or with the use of a command-line option), so there should be one.Has support for "loongson3a" been present in 4.9.x (it is in trunk)? If
so, then what _MIPS_ARCH_* macro gets defined for `-march=loongson3a'?
Hmm - I must have fatfingered something. Now I'm getting:
$ mips-linux-gcc < /dev/null -E -C -dM -march=loongson3a - | grep _MIPS_ARCH #define _MIPS_ARCH_LOONGSON3A 1 #define _MIPS_ARCH "loongson3a" $
So that would conflict with a manual definition, thus the patch would not be acceptable as it because:
$ cat > c.c << EOF
foo(){}
EOF
$ mips-linux-gcc -D_MIPS_ARCH_LOONGSON3A -march=loongson3a -Wall -c c.c
c.c:1:1: warning: return type defaults to ‘int’ [-Wreturn-type]
foo(){}
^
c.c: In function ‘foo’:
c.c:1:1: warning: control reaches end of non-void function [-Wreturn-type]
foo(){}
^
$Ralf
Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
Hi Ralf,
2014-08-26 3:41 GMT+08:00 Ralf Baechle <[email protected]>:
Quoted 31 lines · Maciej W. Rozycki
Quoted 13 lines · Ralf Baechle
Quoted 10 lines
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
+cflags-$(CONFIG_CPU_LOONGSON3) += -D_MIPS_ARCH_LOONGSON3A
The _MIPS_ARCH_* namespace belongs to GCC. While it seems current GCC does not define this symbol
_MIPS_ARCH_LOONGSON3Aruns into the danger of causing a conflict when GCC eventually will define the symbol.When this symbol will be defined? With option '-march=loongson3a'?
Well, not currently (at least not in my gcc 4.9.0) - but it might. In fact, I'm wondering why it doesn't. Maciej?
Quoted 6 lines
No idea, a
_MIPS_ARCH_foomacro gets defined automagically by GCC
whenever `-march=foo' is in effect (be it implicitly or with the use of a command-line option), so there should be one.Has support for "loongson3a" been present in 4.9.x (it is in trunk)? If
so, then what _MIPS_ARCH_* macro gets defined for `-march=loongson3a'?Hmm - I must have fatfingered something. Now I'm getting:
$ mips-linux-gcc < /dev/null -E -C -dM -march=loongson3a - | grep _MIPS_ARCH #define _MIPS_ARCH_LOONGSON3A 1 #define _MIPS_ARCH "loongson3a" $So that would conflict with a manual definition, thus the patch would not be acceptable as it because:
Quoted 12 lines
$ cat > c.c << EOF
foo(){}
EOF
$ mips-linux-gcc -D_MIPS_ARCH_LOONGSON3A -march=loongson3a -Wall -c c.c
c.c:1:1: warning: return type defaults to ‘int’ [-Wreturn-type]
foo(){}
^
c.c: In function ‘foo’:
c.c:1:1: warning: control reaches end of non-void function [-Wreturn-type]
foo(){}
^
$Thanks for the explanation. We will enable "-march=loongson3a" and do some test internally to make sure doing so wouldn't cause any problems.
To James:
Quoted 5 lines
Any reason not to just refer directly to
CONFIG_CPU_LOONGSON3from the source rather than adding an intermediate definition?Cheers
James
I guess it's because "arch/mips/include/uapi/asm/swab.h" is in "uapi/" directory(http://lwn.net/Articles/507794/), that means it contains "user-space API-related definitions", hence using CONFIG_CPU_LOONGSON3 is not suitable there.