Re: [kvm-unit-tests PATCH v1 2/4] s390x: lib: Move stsi_get_fc to library

Claudio Imbrenda
2021-08-09T10:22:30Z

On Mon, 9 Aug 2021 10:48:52 +0200
Pierre Morel <pmorel@linux.ibm.com> wrote:

> It's needed in multiple tests now.
>
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
> lib/s390x/asm/arch_def.h | 16 ++++++++++++++++
> s390x/stsi.c | 16 ----------------
> 2 files changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index 15cf7d48..57d7ddac 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -328,6 +328,22 @@ static inline int stsi(void *addr, int fc, int
> sel1, int sel2) return cc;
> }
>
> +static inline unsigned long stsi_get_fc(void *addr)
> +{
> + register unsigned long r0 asm("0") = 0;
> + register unsigned long r1 asm("1") = 0;
> + int cc;
> +
> + asm volatile("stsi 0(%[addr])\n"
> + "ipm %[cc]\n"
> + "srl %[cc],28\n"
> + : "+d" (r0), [cc] "=d" (cc)
> + : "d" (r1), [addr] "a" (addr)
> + : "cc", "memory");
> + assert(!cc);
> + return r0 >> 28;
> +}
> +
> static inline int servc(uint32_t command, unsigned long sccb)
> {
> int cc;
> diff --git a/s390x/stsi.c b/s390x/stsi.c
> index 87d48047..11986d13 100644
> --- a/s390x/stsi.c
> +++ b/s390x/stsi.c
> @@ -71,22 +71,6 @@ static void test_priv(void)
> report_prefix_pop();
> }
>
> -static inline unsigned long stsi_get_fc(void *addr)
> -{
> - register unsigned long r0 asm("0") = 0;
> - register unsigned long r1 asm("1") = 0;
> - int cc;
> -
> - asm volatile("stsi 0(%[addr])\n"
> - "ipm %[cc]\n"
> - "srl %[cc],28\n"
> - : "+d" (r0), [cc] "=d" (cc)
> - : "d" (r1), [addr] "a" (addr)
> - : "cc", "memory");
> - assert(!cc);
> - return r0 >> 28;
> -}
> -
> static void test_fc(void)
> {
> report(stsi(pagebuf, 7, 0, 0) == 3, "invalid fc");