Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH 1/2] mips: .../swab.h: fix a compiling failure
@ 2014-08-20  3:14 chenj
  2014-08-20  3:14 ` [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3 chenj
  2014-08-25 12:07 ` [PATCH 1/2] mips: .../swab.h: fix a compiling failure Ralf Baechle
  0 siblings, 2 replies; 11+ messages in thread
From: chenj @ 2014-08-20  3:14 UTC (permalink / raw)
  To: linux-mips; +Cc: chenhc, ralf, chenj

It was introduced in commit
"mips: use wsbh/dsbh/dshd on Loongson3A"
(http://patchwork.linux-mips.org/patch/7542/)

Signed-off-by: Jie Chen <chenj@lemote.com>
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/include/uapi/asm/swab.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/uapi/asm/swab.h b/arch/mips/include/uapi/asm/swab.h
index 20b884a..8f2d184 100644
--- a/arch/mips/include/uapi/asm/swab.h
+++ b/arch/mips/include/uapi/asm/swab.h
@@ -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));
-- 
1.9.0

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

* [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
  2014-08-20  3:14 [PATCH 1/2] mips: .../swab.h: fix a compiling failure chenj
@ 2014-08-20  3:14 ` chenj
  2014-08-20 10:04   ` James Hogan
  2014-08-20 10:53   ` Ralf Baechle
  2014-08-25 12:07 ` [PATCH 1/2] mips: .../swab.h: fix a compiling failure Ralf Baechle
  1 sibling, 2 replies; 11+ messages in thread
From: chenj @ 2014-08-20  3:14 UTC (permalink / raw)
  To: linux-mips; +Cc: chenhc, ralf, chenj

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.

Signed-off-by: Jie Chen <chenj@lemote.com>
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
 arch/mips/loongson/Platform | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
index 0ac20eb..5f527d1 100644
--- a/arch/mips/loongson/Platform
+++ b/arch/mips/loongson/Platform
@@ -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
 #
-- 
1.9.0

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

* Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
  2014-08-20  3:14 ` [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3 chenj
@ 2014-08-20 10:04   ` James Hogan
  2014-08-20 10:04     ` James Hogan
  2014-08-20 10:53   ` Ralf Baechle
  1 sibling, 1 reply; 11+ messages in thread
From: James Hogan @ 2014-08-20 10:04 UTC (permalink / raw)
  To: chenj, linux-mips; +Cc: chenhc, ralf

Hi,

On 20/08/14 04:14, chenj wrote:
> diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
> index 0ac20eb..5f527d1 100644
> --- a/arch/mips/loongson/Platform
> +++ b/arch/mips/loongson/Platform
> @@ -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

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

* Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
  2014-08-20 10:04   ` James Hogan
@ 2014-08-20 10:04     ` James Hogan
  0 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2014-08-20 10:04 UTC (permalink / raw)
  To: chenj, linux-mips; +Cc: chenhc, ralf

Hi,

On 20/08/14 04:14, chenj wrote:
> diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
> index 0ac20eb..5f527d1 100644
> --- a/arch/mips/loongson/Platform
> +++ b/arch/mips/loongson/Platform
> @@ -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

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

* Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
  2014-08-20  3:14 ` [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3 chenj
  2014-08-20 10:04   ` James Hogan
@ 2014-08-20 10:53   ` Ralf Baechle
  2014-08-20 11:59     ` Chen Jie
  1 sibling, 1 reply; 11+ messages in thread
From: Ralf Baechle @ 2014-08-20 10:53 UTC (permalink / raw)
  To: chenj, Maciej W. Rozycki; +Cc: linux-mips, chenhc

On Wed, Aug 20, 2014 at 11:14:48AM +0800, chenj wrote:

> +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

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

* Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
  2014-08-20 10:53   ` Ralf Baechle
@ 2014-08-20 11:59     ` Chen Jie
  2014-08-25 12:12       ` Ralf Baechle
  0 siblings, 1 reply; 11+ messages in thread
From: Chen Jie @ 2014-08-20 11:59 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Maciej W. Rozycki, Linux MIPS Mailing List,
	陈华才, 王锐

2014-08-20 18:53 GMT+08:00 Ralf Baechle <ralf@linux-mips.org>:
> On Wed, Aug 20, 2014 at 11:14:48AM +0800, chenj wrote:
>
>> +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.
When this symbol will be defined? With option '-march=loongson3a'?

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

* Re: [PATCH 1/2] mips: .../swab.h: fix a compiling failure
  2014-08-20  3:14 [PATCH 1/2] mips: .../swab.h: fix a compiling failure chenj
  2014-08-20  3:14 ` [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3 chenj
@ 2014-08-25 12:07 ` Ralf Baechle
  1 sibling, 0 replies; 11+ messages in thread
From: Ralf Baechle @ 2014-08-25 12:07 UTC (permalink / raw)
  To: chenj; +Cc: linux-mips, chenhc

On Wed, Aug 20, 2014 at 11:14:47AM +0800, chenj wrote:

> 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

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

* Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
  2014-08-20 11:59     ` Chen Jie
@ 2014-08-25 12:12       ` Ralf Baechle
  2014-08-25 19:35         ` Maciej W. Rozycki
  0 siblings, 1 reply; 11+ messages in thread
From: Ralf Baechle @ 2014-08-25 12:12 UTC (permalink / raw)
  To: Chen Jie
  Cc: Maciej W. Rozycki, Linux MIPS Mailing List,
	陈华才, 王锐

On Wed, Aug 20, 2014 at 07:59:41PM +0800, Chen Jie wrote:

> 2014-08-20 18:53 GMT+08:00 Ralf Baechle <ralf@linux-mips.org>:
> > On Wed, Aug 20, 2014 at 11:14:48AM +0800, chenj wrote:
> >
> >> +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.
> 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

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

* Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
  2014-08-25 12:12       ` Ralf Baechle
@ 2014-08-25 19:35         ` Maciej W. Rozycki
  2014-08-25 19:41           ` Ralf Baechle
  0 siblings, 1 reply; 11+ messages in thread
From: Maciej W. Rozycki @ 2014-08-25 19:35 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Chen Jie, Linux MIPS Mailing List, 陈华才,
	王锐

On Mon, 25 Aug 2014, Ralf Baechle wrote:

> > >> +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.
> > 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

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

* Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
  2014-08-25 19:35         ` Maciej W. Rozycki
@ 2014-08-25 19:41           ` Ralf Baechle
  2014-08-26  1:12             ` Chen Jie
  0 siblings, 1 reply; 11+ messages in thread
From: Ralf Baechle @ 2014-08-25 19:41 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Chen Jie, Linux MIPS Mailing List, 陈华才,
	王锐

On Mon, Aug 25, 2014 at 08:35:17PM +0100, Maciej W. Rozycki wrote:

> On Mon, 25 Aug 2014, Ralf Baechle wrote:
> 
> > > >> +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.
> > > 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'?

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

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

* Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
  2014-08-25 19:41           ` Ralf Baechle
@ 2014-08-26  1:12             ` Chen Jie
  0 siblings, 0 replies; 11+ messages in thread
From: Chen Jie @ 2014-08-26  1:12 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Maciej W. Rozycki, Linux MIPS Mailing List,
	陈华才, 王锐

Hi Ralf,

2014-08-26 3:41 GMT+08:00 Ralf Baechle <ralf@linux-mips.org>:
> On Mon, Aug 25, 2014 at 08:35:17PM +0100, Maciej W. Rozycki wrote:
>
>> On Mon, 25 Aug 2014, Ralf Baechle wrote:
>>
>> > > >> +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.
>> > > 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'?
>
> 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(){}
>  ^
> $
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:
> Any reason not to just refer directly to CONFIG_CPU_LOONGSON3 from 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.

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

end of thread, other threads:[~2014-08-26  1:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20  3:14 [PATCH 1/2] mips: .../swab.h: fix a compiling failure chenj
2014-08-20  3:14 ` [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3 chenj
2014-08-20 10:04   ` James Hogan
2014-08-20 10:04     ` James Hogan
2014-08-20 10:53   ` Ralf Baechle
2014-08-20 11:59     ` Chen Jie
2014-08-25 12:12       ` Ralf Baechle
2014-08-25 19:35         ` Maciej W. Rozycki
2014-08-25 19:41           ` Ralf Baechle
2014-08-26  1:12             ` Chen Jie
2014-08-25 12:07 ` [PATCH 1/2] mips: .../swab.h: fix a compiling failure Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox