powerpc64: Select POWER9 machine for the scv instruction

Message ID 87y2gmrxsn.fsf@oldenburg.str.redhat.com
State Committed
Commit 527c89cd32f8522859f58343be3d3dc8f754b783
Headers
Series powerpc64: Select POWER9 machine for the scv instruction |

Commit Message

Florian Weimer Jan. 21, 2021, 5:43 p.m. UTC
  It is not available with the baseline ISA on powerpc64-linux-gnu.
(powerpc64le-linux-gnu enables it unconditionally.)

Fixes commit 68ab82f56690ada86ac1e0c46bad06ba189a10ef
("powerpc: Runtime selection between sc and scv for syscalls").

---
 sysdeps/powerpc/powerpc64/sysdep.h                | 3 +++
 sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S | 3 +++
 sysdeps/unix/sysv/linux/powerpc/sysdep.h          | 5 ++++-
 3 files changed, 10 insertions(+), 1 deletion(-)
  

Comments

Tulio Magno Quites Machado Filho Jan. 21, 2021, 10 p.m. UTC | #1
Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> writes:

> It is not available with the baseline ISA on powerpc64-linux-gnu.
> (powerpc64le-linux-gnu enables it unconditionally.)
>
> Fixes commit 68ab82f56690ada86ac1e0c46bad06ba189a10ef
> ("powerpc: Runtime selection between sc and scv for syscalls").

Confirmed this patch does build with Binutils 2.29.
LGTM.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

I'm updating the installation instructions.

Thanks!
  
Florian Weimer Jan. 22, 2021, 9:44 a.m. UTC | #2
* Tulio Magno Quites Machado Filho via Libc-alpha:

> Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> writes:
>
>> It is not available with the baseline ISA on powerpc64-linux-gnu.
>> (powerpc64le-linux-gnu enables it unconditionally.)
>>
>> Fixes commit 68ab82f56690ada86ac1e0c46bad06ba189a10ef
>> ("powerpc: Runtime selection between sc and scv for syscalls").
>
> Confirmed this patch does build with Binutils 2.29.
> LGTM.
>
> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
>
> I'm updating the installation instructions.

Thanks.  I'll drop the refernence to little endian vs big endian because
this looks like something else after all (maybe a downstream patch
causes things to build for us).

Adhemerval, is this okay to push for the release?

Thanks,
Florian
  
Adhemerval Zanella Jan. 22, 2021, 10:59 a.m. UTC | #3
On 22/01/2021 06:44, Florian Weimer wrote:
> * Tulio Magno Quites Machado Filho via Libc-alpha:
> 
>> Florian Weimer via Libc-alpha <libc-alpha@sourceware.org> writes:
>>
>>> It is not available with the baseline ISA on powerpc64-linux-gnu.
>>> (powerpc64le-linux-gnu enables it unconditionally.)
>>>
>>> Fixes commit 68ab82f56690ada86ac1e0c46bad06ba189a10ef
>>> ("powerpc: Runtime selection between sc and scv for syscalls").
>>
>> Confirmed this patch does build with Binutils 2.29.
>> LGTM.
>>
>> Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
>>
>> I'm updating the installation instructions.
> 
> Thanks.  I'll drop the refernence to little endian vs big endian because
> this looks like something else after all (maybe a downstream patch
> causes things to build for us).
> 
> Adhemerval, is this okay to push for the release?

It is ok for 2.33, thanks.
  

Patch

diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h
index cea05c8e17..c57bb1c05d 100644
--- a/sysdeps/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/powerpc/powerpc64/sysdep.h
@@ -333,7 +333,10 @@  LT_LABELSUFFIX(name,_name_end): ; \
     mflr r9; \
     std r9,FRAME_LR_SAVE(r1); \
     cfi_offset(lr,FRAME_LR_SAVE); \
+    .machine "push"; \
+    .machine "power9"; \
     scv 0; \
+    .machine "pop"; \
     ld r9,FRAME_LR_SAVE(r1); \
     mtlr r9; \
     cfi_restore(lr);
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
index b59837b071..e9bd8cb960 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S
@@ -76,7 +76,10 @@  ENTRY (__clone)
 	because it uses CFI directives and we just called cfi_endproc.  */
 	mflr 	r9
 	std 	r9,FRAME_LR_SAVE(r1)
+	.machine "push"
+	.machine "power9"
 	scv 	0
+	.machine "pop"
 	ld 	r9,FRAME_LR_SAVE(r1)
 	mtlr 	r9
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h
index d3605d562d..6b99464e61 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h
@@ -76,7 +76,10 @@ 
 #define SYSCALL_SCV(nr)				\
   ({						\
     __asm__ __volatile__			\
-      ("scv 0\n\t"				\
+      (".machine \"push\"\n\t"			\
+       ".machine \"power9\"\n\t"		\
+       "scv 0\n\t"				\
+       ".machine \"pop\"\n\t"			\
        "0:"					\
        : "=&r" (r0),				\
 	 "=&r" (r3), "=&r" (r4), "=&r" (r5),	\