linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5
@ 2022-09-21  1:41 Nicholas Piggin
  2022-09-21  1:41 ` [PATCH 2/2] powerpc/64s: update cpu selection options Nicholas Piggin
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Nicholas Piggin @ 2022-09-21  1:41 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

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


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

* [PATCH 2/2] powerpc/64s: update cpu selection options
  2022-09-21  1:41 [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Nicholas Piggin
@ 2022-09-21  1:41 ` Nicholas Piggin
  2022-09-21 19:03   ` Segher Boessenkool
  2022-09-21 16:45 ` [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Christophe Leroy
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Nicholas Piggin @ 2022-09-21  1:41 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

Update the 64s GENERIC_CPU option. POWER4 support has been dropped, so
make that clear in the option name. The POWER5_CPU option is dropped
because it's uncommon, and GENERIC_CPU covers it.

-mtune= before power8 is dropped because the minimum gcc version
supports power8, and tuning is made consistent between big and little
endian.

A 970 option is added for PowerPC 970 / G5 because they still have a
user base, and -mtune=power8 does not generate good code for the 970.

This also updates the ISA versions document to add Power4/Power4+
because I didn't realise Power4+ used 2.01.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
The 970 option builds and boots a QEMU TCG 970 machine.

 Documentation/powerpc/isa-versions.rst | 14 ++++++++++++++
 arch/powerpc/Makefile                  |  5 +++--
 arch/powerpc/platforms/Kconfig.cputype |  8 ++++----
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/Documentation/powerpc/isa-versions.rst b/Documentation/powerpc/isa-versions.rst
index dfcb1097dce4..a242b3821681 100644
--- a/Documentation/powerpc/isa-versions.rst
+++ b/Documentation/powerpc/isa-versions.rst
@@ -4,6 +4,8 @@ CPU to ISA Version Mapping
 
 Mapping of some CPU versions to relevant ISA versions.
 
+Note Power4 and Power4+ are not supported.
+
 ========= ====================================================================
 CPU       Architecture version
 ========= ====================================================================
@@ -24,6 +26,12 @@ PPC970    - PowerPC User Instruction Set Architecture Book I v2.01
           - PowerPC Virtual Environment Architecture Book II v2.01
           - PowerPC Operating Environment Architecture Book III v2.01
           - Plus Altivec/VMX ~= 2.03
+Power4+   - PowerPC User Instruction Set Architecture Book I v2.01
+          - PowerPC Virtual Environment Architecture Book II v2.01
+          - PowerPC Operating Environment Architecture Book III v2.01
+Power4    - PowerPC User Instruction Set Architecture Book I v2.00
+          - PowerPC Virtual Environment Architecture Book II v2.00
+          - PowerPC Operating Environment Architecture Book III v2.00
 ========= ====================================================================
 
 
@@ -44,6 +52,8 @@ Power5++   No
 Power5+    No
 Power5     No
 PPC970     Yes
+Power4+    No
+Power4     No
 ========== ==================
 
 ========== ====
@@ -60,6 +70,8 @@ Power5++   No
 Power5+    No
 Power5     No
 PPC970     No
+Power4+    No
+Power4     No
 ========== ====
 
 ========== ====================================
@@ -76,4 +88,6 @@ Power5++   No
 Power5+    No
 Power5     No
 PPC970     No
+Power4+    No
+Power4     No
 ========== ====================================
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 140a5e6471fe..8a3d69b02672 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -149,11 +149,12 @@ CFLAGS-$(CONFIG_PPC32)	+= $(call cc-option,-mno-readonly-in-sdata)
 ifdef CONFIG_PPC_BOOK3S_64
 ifdef CONFIG_CPU_LITTLE_ENDIAN
 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) += -mcpu=power4
 endif
+CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power10,	\
+				  $(call cc-option,-mtune=power9,	\
+				  $(call cc-option,-mtune=power8)))
 else ifdef CONFIG_PPC_BOOK3E_64
 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
 endif
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 5185d942b455..4017be72e46f 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -125,7 +125,7 @@ choice
 	  If unsure, select Generic.
 
 config GENERIC_CPU
-	bool "Generic (POWER4 and above)"
+	bool "Generic (POWER5 and PowerPC 970 and above)"
 	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
 	select PPC_64S_HASH_MMU
 
@@ -144,8 +144,8 @@ config CELL_CPU
 	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
 	select PPC_64S_HASH_MMU
 
-config POWER5_CPU
-	bool "POWER5"
+config PPC_970_CPU
+	bool "PowerPC 970 (including PowerPC G5)"
 	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
 	select PPC_64S_HASH_MMU
 
@@ -234,7 +234,7 @@ config TARGET_CPU
 	string
 	depends on TARGET_CPU_BOOL
 	default "cell" if CELL_CPU
-	default "power5" if POWER5_CPU
+	default "970" if PPC_970_CPU
 	default "power6" if POWER6_CPU
 	default "power7" if POWER7_CPU
 	default "power8" if POWER8_CPU
-- 
2.37.2


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

* Re: [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5
  2022-09-21  1:41 [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Nicholas Piggin
  2022-09-21  1:41 ` [PATCH 2/2] powerpc/64s: update cpu selection options Nicholas Piggin
@ 2022-09-21 16:45 ` Christophe Leroy
  2022-09-21 18:50 ` Segher Boessenkool
  2022-10-04 13:24 ` Michael Ellerman
  3 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2022-09-21 16:45 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev



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

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

* Re: [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5
  2022-09-21  1:41 [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Nicholas Piggin
  2022-09-21  1:41 ` [PATCH 2/2] powerpc/64s: update cpu selection options Nicholas Piggin
  2022-09-21 16:45 ` [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Christophe Leroy
@ 2022-09-21 18:50 ` Segher Boessenkool
  2022-09-23  7:17   ` Nicholas Piggin
  2022-10-04 13:24 ` Michael Ellerman
  3 siblings, 1 reply; 8+ messages in thread
From: Segher Boessenkool @ 2022-09-21 18:50 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev

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

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

* Re: [PATCH 2/2] powerpc/64s: update cpu selection options
  2022-09-21  1:41 ` [PATCH 2/2] powerpc/64s: update cpu selection options Nicholas Piggin
@ 2022-09-21 19:03   ` Segher Boessenkool
  0 siblings, 0 replies; 8+ messages in thread
From: Segher Boessenkool @ 2022-09-21 19:03 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev

On Wed, Sep 21, 2022 at 11:41:03AM +1000, Nicholas Piggin wrote:
> Update the 64s GENERIC_CPU option. POWER4 support has been dropped, so
> make that clear in the option name. The POWER5_CPU option is dropped
> because it's uncommon, and GENERIC_CPU covers it.
> 
> -mtune= before power8 is dropped because the minimum gcc version
> supports power8, and tuning is made consistent between big and little
> endian.
> 
> A 970 option is added for PowerPC 970 / G5 because they still have a
> user base, and -mtune=power8 does not generate good code for the 970.
> 
> This also updates the ISA versions document to add Power4/Power4+
> because I didn't realise Power4+ used 2.01.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

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

Cheers,


Segher

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

* Re: [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5
  2022-09-21 18:50 ` Segher Boessenkool
@ 2022-09-23  7:17   ` Nicholas Piggin
  2022-09-23 12:22     ` Segher Boessenkool
  0 siblings, 1 reply; 8+ messages in thread
From: Nicholas Piggin @ 2022-09-23  7:17 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

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

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

* Re: [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5
  2022-09-23  7:17   ` Nicholas Piggin
@ 2022-09-23 12:22     ` Segher Boessenkool
  0 siblings, 0 replies; 8+ messages in thread
From: Segher Boessenkool @ 2022-09-23 12:22 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev

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

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

* Re: [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5
  2022-09-21  1:41 [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Nicholas Piggin
                   ` (2 preceding siblings ...)
  2022-09-21 18:50 ` Segher Boessenkool
@ 2022-10-04 13:24 ` Michael Ellerman
  3 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2022-10-04 13:24 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev

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

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

end of thread, other threads:[~2022-10-04 13:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-21  1:41 [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Nicholas Piggin
2022-09-21  1:41 ` [PATCH 2/2] powerpc/64s: update cpu selection options Nicholas Piggin
2022-09-21 19:03   ` Segher Boessenkool
2022-09-21 16:45 ` [PATCH 1/2] powerpc/64s: Fix GENERIC_CPU build flags for PPC970 / G5 Christophe Leroy
2022-09-21 18:50 ` Segher Boessenkool
2022-09-23  7:17   ` Nicholas Piggin
2022-09-23 12:22     ` Segher Boessenkool
2022-10-04 13:24 ` Michael Ellerman

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