diff mbox

[Question] Is little endian supported on all the platforms?

Message ID 1441019966.31779.1.camel@ellerman.id.au (mailing list archive)
State Not Applicable
Headers show

Commit Message

Michael Ellerman Aug. 31, 2015, 11:19 a.m. UTC
On Mon, 2015-08-31 at 15:53 +0800, Boqun Feng wrote:
> On Mon, Aug 31, 2015 at 04:52:38PM +1000, Benjamin Herrenschmidt wrote:
> > On Mon, 2015-08-31 at 14:44 +0800, Boqun Feng wrote:
> > > Hi all,
> > > 
> > > I hit a strange build error on v4.2, when I try to build a LE kernel
> > > with a slightly modification of the ppc64_defconfig. What I did is just
> > > make ppc64_defconfig and make menuconfig to set CPU_LITTLE_ENDIAN=y, and
> > > then build the kernel.
> > > 
> > > I did a little research myself, and found out the error is because of
> > > trying to build a LE kernel with CONFIG_PPC_PS3=y. So a simple way to
> > > reproduce is:
> > 
> > First, LE isn't supported on PS/3 :-) It's only supported on POWER8
> > machines (and *some* P7 machines and only when running as KVM guest).
> 
> Got it, thank you ;-)
> 
> So should we modify Kconfigs of all the platform to reflect this?

Yes. Maybe something like this?




> > But the specific problem you are having looks like a differnet issue
> > with the PS3 boot wrapper.
> > 
> 
> But could the reason of this be that the building process of the PS3
> boot wrapper assumes the kernel is BE?

It looks more like we're getting confused between 32-bit and 64-bit, from your
log:

    ld: powerpc:common64 architecture of input file `arch/powerpc/boot/ps3-head.o' is incompatible with powerpc:common output

Which says it has a .o which is 64-bit but it's trying to produce 32-bit output.

That's probably related to the PPC64_BOOT_WRAPPER stuff.

cheers

Comments

Boqun Feng Aug. 31, 2015, 11:56 a.m. UTC | #1
On Mon, Aug 31, 2015 at 09:19:26PM +1000, Michael Ellerman wrote:
> On Mon, 2015-08-31 at 15:53 +0800, Boqun Feng wrote:
> > On Mon, Aug 31, 2015 at 04:52:38PM +1000, Benjamin Herrenschmidt wrote:
> > > On Mon, 2015-08-31 at 14:44 +0800, Boqun Feng wrote:
> > > > Hi all,
> > > > 
> > > > I hit a strange build error on v4.2, when I try to build a LE kernel
> > > > with a slightly modification of the ppc64_defconfig. What I did is just
> > > > make ppc64_defconfig and make menuconfig to set CPU_LITTLE_ENDIAN=y, and
> > > > then build the kernel.
> > > > 
> > > > I did a little research myself, and found out the error is because of
> > > > trying to build a LE kernel with CONFIG_PPC_PS3=y. So a simple way to
> > > > reproduce is:
> > > 
> > > First, LE isn't supported on PS/3 :-) It's only supported on POWER8
> > > machines (and *some* P7 machines and only when running as KVM guest).
> > 
> > Got it, thank you ;-)
> > 
> > So should we modify Kconfigs of all the platform to reflect this?
> 
> Yes. Maybe something like this?
> 
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index c140e94..c359f72 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -415,9 +415,13 @@ config VDSO32
>           big endian. That is because the only little endian configuration we
>           support is ppc64le which is 64-bit only.
>  
> +config CHOOSE_ENDIAN
> +       bool
> +
>  choice
>         prompt "Endianness selection"
>         default CPU_BIG_ENDIAN
> +       depends on CHOOSE_ENDIAN
>         help
>           This option selects whether a big endian or little endian kernel will
>           be built.
> diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
> index 604190c..32d5661 100644
> --- a/arch/powerpc/platforms/powernv/Kconfig
> +++ b/arch/powerpc/platforms/powernv/Kconfig
> @@ -18,6 +18,7 @@ config PPC_POWERNV
>         select CPU_FREQ_GOV_ONDEMAND
>         select CPU_FREQ_GOV_CONSERVATIVE
>         select PPC_DOORBELL
> +       select CHOOSE_ENDIAN

IIUC, we can actually set PPC_POWERNV=y and PPC_PS3=y at the same time,
right?

So this can't prevent PPC_PS3 && CPU_LITTLE_ENDIAN from being true.

>         default y
>  
>  config OPAL_PRD
> diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
> index 54c87d5..182f485 100644
> --- a/arch/powerpc/platforms/pseries/Kconfig
> +++ b/arch/powerpc/platforms/pseries/Kconfig
> @@ -21,6 +21,7 @@ config PPC_PSERIES
>         select HOTPLUG_CPU if SMP
>         select ARCH_RANDOM
>         select PPC_DOORBELL
> +       select CHOOSE_ENDIAN
>         default y
>  
>  config PPC_SPLPAR
> 
> 
> 
> > > But the specific problem you are having looks like a differnet issue
> > > with the PS3 boot wrapper.
> > > 
> > 
> > But could the reason of this be that the building process of the PS3
> > boot wrapper assumes the kernel is BE?
> 
> It looks more like we're getting confused between 32-bit and 64-bit, from your
> log:
> 
>     ld: powerpc:common64 architecture of input file `arch/powerpc/boot/ps3-head.o' is incompatible with powerpc:common output
> 
> Which says it has a .o which is 64-bit but it's trying to produce 32-bit output.
> 
> That's probably related to the PPC64_BOOT_WRAPPER stuff.

Probably, and just FYI, I build a 64bit BE kernel, the dtbImage.ps3 is
ELF 32-bit MSB executable.

Regards,
Boqun
Benjamin Herrenschmidt Aug. 31, 2015, 8:40 p.m. UTC | #2
On Mon, 2015-08-31 at 21:19 +1000, Michael Ellerman wrote:

> Yes. Maybe something like this?

I would have done it the other way around with endian at the top
and only the supported platforms displayed based on the endian...

But I don't care *that* much either way

>diff --git a/arch/powerpc/platforms/Kconfig.cputype >b/arch/powerpc/pl
atforms/Kconfig.cputype
> index c140e94..c359f72 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -415,9 +415,13 @@ config VDSO32
>           big endian. That is because the only little endian
> configuration we
>           support is ppc64le which is 64-bit only.
>  
> +config CHOOSE_ENDIAN
> +       bool
> +
>  choice
>         prompt "Endianness selection"
>         default CPU_BIG_ENDIAN
> +       depends on CHOOSE_ENDIAN
>         help
>           This option selects whether a big endian or little endian
> kernel will
>           be built.
> diff --git a/arch/powerpc/platforms/powernv/Kconfig
> b/arch/powerpc/platforms/powernv/Kconfig
> index 604190c..32d5661 100644
> --- a/arch/powerpc/platforms/powernv/Kconfig
> +++ b/arch/powerpc/platforms/powernv/Kconfig
> @@ -18,6 +18,7 @@ config PPC_POWERNV
>         select CPU_FREQ_GOV_ONDEMAND
>         select CPU_FREQ_GOV_CONSERVATIVE
>         select PPC_DOORBELL
> +       select CHOOSE_ENDIAN
>         default y
>  
>  config OPAL_PRD
> diff --git a/arch/powerpc/platforms/pseries/Kconfig
> b/arch/powerpc/platforms/pseries/Kconfig
> index 54c87d5..182f485 100644
> --- a/arch/powerpc/platforms/pseries/Kconfig
> +++ b/arch/powerpc/platforms/pseries/Kconfig
> @@ -21,6 +21,7 @@ config PPC_PSERIES
>         select HOTPLUG_CPU if SMP
>         select ARCH_RANDOM
>         select PPC_DOORBELL
> +       select CHOOSE_ENDIAN
>         default y
>  
>  config PPC_SPLPAR
> 
> 
> 
> > > But the specific problem you are having looks like a differnet
> > > issue
> > > with the PS3 boot wrapper.
> > > 
> > 
> > But could the reason of this be that the building process of the
> > PS3
> > boot wrapper assumes the kernel is BE?
> 
> It looks more like we're getting confused between 32-bit and 64-bit,
> from your
> log:
> 
>     ld: powerpc:common64 architecture of input file
> `arch/powerpc/boot/ps3-head.o' is incompatible with powerpc:common
> output
> 
> Which says it has a .o which is 64-bit but it's trying to produce 32
> -bit output.
> 
> That's probably related to the PPC64_BOOT_WRAPPER stuff.
> 
> cheers
>
Michael Ellerman Sept. 1, 2015, 1:31 a.m. UTC | #3
On Tue, 2015-09-01 at 06:40 +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2015-08-31 at 21:19 +1000, Michael Ellerman wrote:
> 
> > Yes. Maybe something like this?
> 
> I would have done it the other way around with endian at the top
> and only the supported platforms displayed based on the endian...
> 
> But I don't care *that* much either way

Yeah, I figured folks are not really caring so much about endian when
configuring they're primarily thinking about the platform.

But if we do it this way we *also* need to make PS3 etc. depend on
BIG_ENDIAN, so they don't get enabled on multi-platform LE builds, so we should
probably just do it that way.

cheers
Michael Ellerman Sept. 1, 2015, 1:39 a.m. UTC | #4
On Mon, 2015-08-31 at 19:56 +0800, Boqun Feng wrote:
> On Mon, Aug 31, 2015 at 09:19:26PM +1000, Michael Ellerman wrote:
> > On Mon, 2015-08-31 at 15:53 +0800, Boqun Feng wrote:
> > > On Mon, Aug 31, 2015 at 04:52:38PM +1000, Benjamin Herrenschmidt wrote:
> > > > On Mon, 2015-08-31 at 14:44 +0800, Boqun Feng wrote:
> > > > > Hi all,
> > > > > 
> > > > > I hit a strange build error on v4.2, when I try to build a LE kernel
> > > > > with a slightly modification of the ppc64_defconfig. What I did is just
> > > > > make ppc64_defconfig and make menuconfig to set CPU_LITTLE_ENDIAN=y, and
> > > > > then build the kernel.
> > > > > 
> > > > > I did a little research myself, and found out the error is because of
> > > > > trying to build a LE kernel with CONFIG_PPC_PS3=y. So a simple way to
> > > > > reproduce is:
> > > > 
> > > > First, LE isn't supported on PS/3 :-) It's only supported on POWER8
> > > > machines (and *some* P7 machines and only when running as KVM guest).
> > > 
> > > Got it, thank you ;-)
> > > 
> > > So should we modify Kconfigs of all the platform to reflect this?
> > 
> > Yes. Maybe something like this?
> > 
> > diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> > index c140e94..c359f72 100644
> > --- a/arch/powerpc/platforms/Kconfig.cputype
> > +++ b/arch/powerpc/platforms/Kconfig.cputype
> > @@ -415,9 +415,13 @@ config VDSO32
> >           big endian. That is because the only little endian configuration we
> >           support is ppc64le which is 64-bit only.
> >  
> > +config CHOOSE_ENDIAN
> > +       bool
> > +
> >  choice
> >         prompt "Endianness selection"
> >         default CPU_BIG_ENDIAN
> > +       depends on CHOOSE_ENDIAN
> >         help
> >           This option selects whether a big endian or little endian kernel will
> >           be built.
> > diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
> > index 604190c..32d5661 100644
> > --- a/arch/powerpc/platforms/powernv/Kconfig
> > +++ b/arch/powerpc/platforms/powernv/Kconfig
> > @@ -18,6 +18,7 @@ config PPC_POWERNV
> >         select CPU_FREQ_GOV_ONDEMAND
> >         select CPU_FREQ_GOV_CONSERVATIVE
> >         select PPC_DOORBELL
> > +       select CHOOSE_ENDIAN
> 
> IIUC, we can actually set PPC_POWERNV=y and PPC_PS3=y at the same time,
> right?
> 
> So this can't prevent PPC_PS3 && CPU_LITTLE_ENDIAN from being true.

Yeah true.

So that's probably not a good solution.

cheer
diff mbox

Patch

diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index c140e94..c359f72 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -415,9 +415,13 @@  config VDSO32
          big endian. That is because the only little endian configuration we
          support is ppc64le which is 64-bit only.
 
+config CHOOSE_ENDIAN
+       bool
+
 choice
        prompt "Endianness selection"
        default CPU_BIG_ENDIAN
+       depends on CHOOSE_ENDIAN
        help
          This option selects whether a big endian or little endian kernel will
          be built.
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
index 604190c..32d5661 100644
--- a/arch/powerpc/platforms/powernv/Kconfig
+++ b/arch/powerpc/platforms/powernv/Kconfig
@@ -18,6 +18,7 @@  config PPC_POWERNV
        select CPU_FREQ_GOV_ONDEMAND
        select CPU_FREQ_GOV_CONSERVATIVE
        select PPC_DOORBELL
+       select CHOOSE_ENDIAN
        default y
 
 config OPAL_PRD
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 54c87d5..182f485 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -21,6 +21,7 @@  config PPC_PSERIES
        select HOTPLUG_CPU if SMP
        select ARCH_RANDOM
        select PPC_DOORBELL
+       select CHOOSE_ENDIAN
        default y
 
 config PPC_SPLPAR