Subject: Re: [PATCH v2 2/2] selftests/powerpc: Add scv versions of the basic TM syscall tests

From: Michael Ellerman <[email-masked]>
Date: Thu, 02 Sep 2021 13:44:29 +1000

Nicholas Piggin <[email-masked]> writes:
> Excerpts from Christophe Leroy's message of September 2, 2021 3:15 am:
>> Le 01/09/2021 à 18:54, Nicholas Piggin a écrit :
>>> The basic TM vs syscall test code hard codes an sc instruction for the
>>> system call, which fails to cover scv even when the userspace libc has
>>> support for it.
>>> 
>>> Duplicate the tests with hard coded scv variants so both are tested
>>> when possible.
>>> 
>>> Signed-off-by: Nicholas Piggin <[email-masked]>
>>> ---
>>>   .../selftests/powerpc/tm/tm-syscall-asm.S     | 46 +++++++++++++++++++
>>>   .../testing/selftests/powerpc/tm/tm-syscall.c | 36 ++++++++++++---
>>>   2 files changed, 75 insertions(+), 7 deletions(-)
>>> 
>>> diff --git a/tools/testing/selftests/powerpc/tm/tm-syscall-asm.S b/tools/testing/selftests/powerpc/tm/tm-syscall-asm.S
>>> index bd1ca25febe4..849316831e6a 100644
>>> --- a/tools/testing/selftests/powerpc/tm/tm-syscall-asm.S
>>> +++ b/tools/testing/selftests/powerpc/tm/tm-syscall-asm.S
>>> @@ -2,6 +2,10 @@
>>>   #include <ppc-asm.h>
>>>   #include <asm/unistd.h>
>>>   
>>> +/* ppc-asm.h does not define r0 or r1 */
>>> +#define r0 0
>>> +#define r1 1
>>> +
>> 
>> See https://github.com/gcc-mirror/gcc/blob/master/gcc/config/rs6000/ppc-asm.h
>> 
>> It doesn't not define r1 but it defines r0.
>
> Oops, I'll fix that.
>
>> And it defines 'sp' as register 1.
>
> Does userspace code typically use that? Kernel code AFAIKS does not.

Some does, but it's not used consistently IME.

I'd prefer you just use %r1.

cheers