linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Update compilation flags with core specific options
@ 2013-07-02 11:20 Catalin Udma
  2013-07-09 23:48 ` Scott Wood
  2013-07-24  0:11 ` Scott Wood
  0 siblings, 2 replies; 5+ messages in thread
From: Catalin Udma @ 2013-07-02 11:20 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Catalin Udma

If CONFIG_E500 is enabled, the compilation flags are updated
specifying the target core -mcpu=e5500/e500mc/8540
Also remove -Wa,-me500, being incompatible with -mcpu=e5500/e6500
The assembler option is redundant if the -mcpu= flag is set.
The patch fixes the kernel compilation problem for e5500/e6500
when using gcc option -mcpu=e5500/e6500.

Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
---
 arch/powerpc/Makefile |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 0624909..82808b5 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -140,6 +140,18 @@ ifeq ($(CONFIG_6xx),y)
 KBUILD_CFLAGS		+= -mcpu=powerpc
 endif
 
+ifeq ($(CONFIG_E500),y)
+ifeq ($(CONFIG_64BIT),y)
+KBUILD_CFLAGS		+= -mcpu=e5500
+else
+ifeq ($(CONFIG_PPC_E500MC),y)
+KBUILD_CFLAGS		+= -mcpu=e500mc
+else
+KBUILD_CFLAGS		+= -mcpu=8540
+endif
+endif
+endif
+
 # Work around a gcc code-gen bug with -fno-omit-frame-pointer.
 ifeq ($(CONFIG_FUNCTION_TRACER),y)
 KBUILD_CFLAGS		+= -mno-sched-epilog
@@ -147,7 +159,6 @@ endif
 
 cpu-as-$(CONFIG_4xx)		+= -Wa,-m405
 cpu-as-$(CONFIG_ALTIVEC)	+= -Wa,-maltivec
-cpu-as-$(CONFIG_E500)		+= -Wa,-me500
 cpu-as-$(CONFIG_E200)		+= -Wa,-me200
 
 KBUILD_AFLAGS += $(cpu-as-y)
-- 
1.7.8

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

* Re: [PATCH] Update compilation flags with core specific options
  2013-07-02 11:20 [PATCH] Update compilation flags with core specific options Catalin Udma
@ 2013-07-09 23:48 ` Scott Wood
  2013-07-24  0:11 ` Scott Wood
  1 sibling, 0 replies; 5+ messages in thread
From: Scott Wood @ 2013-07-09 23:48 UTC (permalink / raw)
  To: Catalin Udma; +Cc: linuxppc-dev

On 07/02/2013 06:20:04 AM, Catalin Udma wrote:
> If CONFIG_E500 is enabled, the compilation flags are updated
> specifying the target core -mcpu=3De5500/e500mc/8540
> Also remove -Wa,-me500, being incompatible with -mcpu=3De5500/e6500
> The assembler option is redundant if the -mcpu=3D flag is set.
> The patch fixes the kernel compilation problem for e5500/e6500
> when using gcc option -mcpu=3De5500/e6500.

Another reason to do this is that currently, the assembler is replacing =20
lwsync with sync on 64-bit kernels (it doesn't happen on 32-bit because =20
we generate the lwsync at runtime) due to the -Wa,-me500.

-Scott=

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

* Re: [PATCH] Update compilation flags with core specific options
  2013-07-02 11:20 [PATCH] Update compilation flags with core specific options Catalin Udma
  2013-07-09 23:48 ` Scott Wood
@ 2013-07-24  0:11 ` Scott Wood
  2013-07-24 16:25   ` Udma Catalin-Dan-B32721
  1 sibling, 1 reply; 5+ messages in thread
From: Scott Wood @ 2013-07-24  0:11 UTC (permalink / raw)
  To: Catalin Udma; +Cc: linuxppc-dev

On 07/02/2013 06:20:04 AM, Catalin Udma wrote:
> If CONFIG_E500 is enabled, the compilation flags are updated
> specifying the target core -mcpu=3De5500/e500mc/8540
> Also remove -Wa,-me500, being incompatible with -mcpu=3De5500/e6500
> The assembler option is redundant if the -mcpu=3D flag is set.
> The patch fixes the kernel compilation problem for e5500/e6500
> when using gcc option -mcpu=3De5500/e6500.
>=20
> Signed-off-by: Catalin Udma <catalin.udma@freescale.com>
> ---
>  arch/powerpc/Makefile |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
>=20
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 0624909..82808b5 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -140,6 +140,18 @@ ifeq ($(CONFIG_6xx),y)
>  KBUILD_CFLAGS		+=3D -mcpu=3Dpowerpc
>  endif
>=20
> +ifeq ($(CONFIG_E500),y)
> +ifeq ($(CONFIG_64BIT),y)
> +KBUILD_CFLAGS		+=3D -mcpu=3De5500
> +else
> +ifeq ($(CONFIG_PPC_E500MC),y)
> +KBUILD_CFLAGS		+=3D -mcpu=3De500mc
> +else
> +KBUILD_CFLAGS		+=3D -mcpu=3D8540
> +endif
> +endif
> +endif
> +
>  # Work around a gcc code-gen bug with -fno-omit-frame-pointer.
>  ifeq ($(CONFIG_FUNCTION_TRACER),y)
>  KBUILD_CFLAGS		+=3D -mno-sched-epilog
> @@ -147,7 +159,6 @@ endif
>=20
>  cpu-as-$(CONFIG_4xx)		+=3D -Wa,-m405
>  cpu-as-$(CONFIG_ALTIVEC)	+=3D -Wa,-maltivec
> -cpu-as-$(CONFIG_E500)		+=3D -Wa,-me500
>  cpu-as-$(CONFIG_E200)		+=3D -Wa,-me200
>=20
>  KBUILD_AFLAGS +=3D $(cpu-as-y)

This breaks the vdso for e500v1/v2 (userspace dies with SIGILL), since =20
KBUILD_CFLAGS doesn't get used when building asm files, and the vdso =20
uses mftbu/mftbl which are not being assembled to the form that =20
e500v1/v2 support.

We should be setting -mcpu=3Dwhatever and -msoft-float in both CFLAGS and =20
AFLAGS, since we don't call "as" directly, and target selection should =20
not differ based on whether we're building a C file or an asm file.

-Scott=

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

* RE: [PATCH] Update compilation flags with core specific options
  2013-07-24  0:11 ` Scott Wood
@ 2013-07-24 16:25   ` Udma Catalin-Dan-B32721
  2013-07-24 17:45     ` Scott Wood
  0 siblings, 1 reply; 5+ messages in thread
From: Udma Catalin-Dan-B32721 @ 2013-07-24 16:25 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: linuxppc-dev@lists.ozlabs.org

> This breaks the vdso for e500v1/v2 (userspace dies with SIGILL), since
> KBUILD_CFLAGS doesn't get used when building asm files, and the vdso
> uses mftbu/mftbl which are not being assembled to the form that
> e500v1/v2 support.
>=20
> We should be setting -mcpu=3Dwhatever and -msoft-float in both CFLAGS and
> AFLAGS, since we don't call "as" directly, and target selection should
> not differ based on whether we're building a C file or an asm file.
>=20
> -Scott
[CU] Thank you, Scott. I'll update also AFLAGS.

I have some questions about how you reproduce the SIGILL issue.
I tried to reproduce the issue looking to gettimeofday.S, that uses
mftbu/mftbl. In my tests, I obtained the same output when compiling this fi=
le
for p1021rdb before and after this patch, and also after adding -mcpu to
AFLAGS: "objdump -d arch/powerpc/kernel/vdso32/gettimeofday.o" looks the sa=
me
for the cases mentioned above:
   "mftbu r3" from .S file is decoded to "mfspr   r3,269" in "objdump -d" o=
utput

Indeed, for -mcpu=3D601/power3, the "objdump -d" output is "mftbu r3" and a=
ccording to
powerISA this instruction would cause Illegal Instruction error handler to =
be invoked
and permits the sw to emulate the instruction.

Regards,
Catalin

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

* Re: [PATCH] Update compilation flags with core specific options
  2013-07-24 16:25   ` Udma Catalin-Dan-B32721
@ 2013-07-24 17:45     ` Scott Wood
  0 siblings, 0 replies; 5+ messages in thread
From: Scott Wood @ 2013-07-24 17:45 UTC (permalink / raw)
  To: Udma Catalin-Dan-B32721; +Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org

On 07/24/2013 11:25:52 AM, Udma Catalin-Dan-B32721 wrote:
> > This breaks the vdso for e500v1/v2 (userspace dies with SIGILL), =20
> since
> > KBUILD_CFLAGS doesn't get used when building asm files, and the vdso
> > uses mftbu/mftbl which are not being assembled to the form that
> > e500v1/v2 support.
> >
> > We should be setting -mcpu=3Dwhatever and -msoft-float in both CFLAGS =20
> and
> > AFLAGS, since we don't call "as" directly, and target selection =20
> should
> > not differ based on whether we're building a C file or an asm file.
> >
> > -Scott
> [CU] Thank you, Scott. I'll update also AFLAGS.
>=20
> I have some questions about how you reproduce the SIGILL issue.
> I tried to reproduce the issue looking to gettimeofday.S, that uses
> mftbu/mftbl. In my tests, I obtained the same output when compiling =20
> this file
> for p1021rdb before and after this patch, and also after adding -mcpu =20
> to
> AFLAGS: "objdump -d arch/powerpc/kernel/vdso32/gettimeofday.o" looks =20
> the same
> for the cases mentioned above:
>    "mftbu r3" from .S file is decoded to "mfspr   r3,269" in "objdump =20
> -d" output
>=20
> Indeed, for -mcpu=3D601/power3, the "objdump -d" output is "mftbu r3" =20
> and according to
> powerISA this instruction would cause Illegal Instruction error =20
> handler to be invoked
> and permits the sw to emulate the instruction.

It probably depends on what the default is for your toolchain.

-Scott=

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

end of thread, other threads:[~2013-07-24 17:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-02 11:20 [PATCH] Update compilation flags with core specific options Catalin Udma
2013-07-09 23:48 ` Scott Wood
2013-07-24  0:11 ` Scott Wood
2013-07-24 16:25   ` Udma Catalin-Dan-B32721
2013-07-24 17:45     ` Scott Wood

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