diff mbox series

[1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5

Message ID 20220921014103.587954-1-npiggin@gmail.com (mailing list archive)
State Accepted
Headers show
Series [1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 | expand

Commit Message

Nicholas Piggin Sept. 21, 2022, 1:41 a.m. UTC
Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5.
POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added
the popcntb instruction which a compiler might use.

Use -mcpu=power4.

Fixes: 471d7ff8b51b ("powerpc/64s: Remove POWER4 support")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christophe Leroy Sept. 21, 2022, 4:45 p.m. UTC | #1
Le 21/09/2022 à 03:41, Nicholas Piggin a écrit :
> Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5.
> POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added
> the popcntb instruction which a compiler might use.
> 
> Use -mcpu=power4.
> 
> Fixes: 471d7ff8b51b ("powerpc/64s: Remove POWER4 support")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>   arch/powerpc/Makefile | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 02742facf895..140a5e6471fe 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -152,7 +152,7 @@ CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
>   CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8)
>   else
>   CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5))
> -CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4)
> +CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4
>   endif
>   else ifdef CONFIG_PPC_BOOK3E_64
>   CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64

That else ifdef CONFIG_PPC_BOOK3E_64 looks odd.

I might have forgotten to drop something. Since commit d6b551b8f90c 
("powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: 
`wrteei')") it is not possible anymore to select CONFIG_GENERIC_CPU if 
not book3s64.

Christophe
Segher Boessenkool Sept. 21, 2022, 6:50 p.m. UTC | #2
On Wed, Sep 21, 2022 at 11:41:02AM +1000, Nicholas Piggin wrote:
> Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5.
> POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added
> the popcntb instruction which a compiler might use.
> 
> Use -mcpu=power4.
> 
> Fixes: 471d7ff8b51b ("powerpc/64s: Remove POWER4 support")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>

Thank you!

Maybe superfluous, but some more context: GCC's -mcpu=power4 means
POWER4+, ISA 2.01, according to our documentation.  There is no
difference with ISA 2.00 (what plain POWER4 implements) for anything
GCC does.


Segher
Nicholas Piggin Sept. 23, 2022, 7:17 a.m. UTC | #3
On Thu Sep 22, 2022 at 4:50 AM AEST, Segher Boessenkool wrote:
> On Wed, Sep 21, 2022 at 11:41:02AM +1000, Nicholas Piggin wrote:
> > Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5.
> > POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added
> > the popcntb instruction which a compiler might use.
> > 
> > Use -mcpu=power4.
> > 
> > Fixes: 471d7ff8b51b ("powerpc/64s: Remove POWER4 support")
> > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>
> Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
>
> Thank you!
>
> Maybe superfluous, but some more context: GCC's -mcpu=power4 means
> POWER4+, ISA 2.01, according to our documentation.  There is no
> difference with ISA 2.00 (what plain POWER4 implements) for anything
> GCC does.

Huh, okay. Well I guess we are past that point now, interesting that
another ISA version was done for 4+ though, and then another for 5.
I don't see a list of changes from 2.00 in the public version, I
wonder what else changed other than mtmsrd.

Thanks,
Nick
Segher Boessenkool Sept. 23, 2022, 12:22 p.m. UTC | #4
On Fri, Sep 23, 2022 at 05:17:45PM +1000, Nicholas Piggin wrote:
> On Thu Sep 22, 2022 at 4:50 AM AEST, Segher Boessenkool wrote:
> > On Wed, Sep 21, 2022 at 11:41:02AM +1000, Nicholas Piggin wrote:
> > > Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5.
> > > POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added
> > > the popcntb instruction which a compiler might use.
> > > 
> > > Use -mcpu=power4.
> > > 
> > > Fixes: 471d7ff8b51b ("powerpc/64s: Remove POWER4 support")
> > > Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> >
> > Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
> >
> > Thank you!
> >
> > Maybe superfluous, but some more context: GCC's -mcpu=power4 means
> > POWER4+, ISA 2.01, according to our documentation.  There is no
> > difference with ISA 2.00 (what plain POWER4 implements) for anything
> > GCC does.
> 
> Huh, okay. Well I guess we are past that point now, interesting that
> another ISA version was done for 4+ though, and then another for 5.
> I don't see a list of changes from 2.00 in the public version, I
> wonder what else changed other than mtmsrd.

I think searching for "POWER4+" will give you everything.  I cannot find
a public 2.00 either, yeah.  I listed everything I think changed
elsewhere in the thread.


Segher
Michael Ellerman Oct. 4, 2022, 1:24 p.m. UTC | #5
On Wed, 21 Sep 2022 11:41:02 +1000, Nicholas Piggin wrote:
> Big-endian GENERIC_CPU supports 970, but builds with -mcpu=power5.
> POWER5 is ISA v2.02 whereas 970 is v2.01 plus Altivec. 2.02 added
> the popcntb instruction which a compiler might use.
> 
> Use -mcpu=power4.
> 
> 
> [...]

Applied to powerpc/next.

[1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5
      https://git.kernel.org/powerpc/c/58ec7f06b74e0d6e76c4110afce367c8b5f0837d
[2/2] powerpc/64s: update cpu selection options
      https://git.kernel.org/powerpc/c/7fd123e544886bf04fa853869efe55cb3f22d0c0

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 02742facf895..140a5e6471fe 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -152,7 +152,7 @@  CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
 CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8)
 else
 CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5))
-CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4)
+CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4
 endif
 else ifdef CONFIG_PPC_BOOK3E_64
 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64