Re: [kvm-unit-tests PATCH v1 4/5] s390x: sclp: add service call instruction wrapper

David Hildenbrand
2019-10-22T15:46:25Z

On 22.10.19 12:53, Claudio Imbrenda wrote:
> Add a wrapper for the service call instruction, and use it for SCLP
> interactions instead of using inline assembly everywhere.

The description is weird.

"Let's factor out the assembly for the service call instruction, we want
to reuse that for actual SCLP service call tests soon."

Reviewed-by: David Hildenbrand <david@redhat.com>

>
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
> lib/s390x/asm/arch_def.h | 13 +++++++++++++
> lib/s390x/sclp.c | 7 +------
> 2 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index 96cca2e..b3caff6 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -269,4 +269,17 @@ static inline int stsi(void *addr, int fc, int sel1, int sel2)
> return cc;
> }
>
> +static inline int servc(uint32_t command, unsigned long sccb)
> +{
> + int cc;
> +
> + asm volatile(
> + " .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */
> + " ipm %0\n"
> + " srl %0,28"
> + : "=&d" (cc) : "d" (command), "a" (sccb)
> + : "cc", "memory");
> + return cc;
> +}
> +
> #endif
> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> index a57096c..376040e 100644
> --- a/lib/s390x/sclp.c
> +++ b/lib/s390x/sclp.c
> @@ -116,12 +116,7 @@ int sclp_service_call(unsigned int command, void *sccb)
> int cc;
>
> sclp_setup_int();
> - asm volatile(
> - " .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */
> - " ipm %0\n"
> - " srl %0,28"
> - : "=&d" (cc) : "d" (command), "a" (__pa(sccb))
> - : "cc", "memory");
> + cc = servc(command, __pa(sccb));
> sclp_wait_busy();
> if (cc == 3)
> return -1;
>

--

Thanks,

David / dhildenb