From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C799DC3524D for ; Tue, 4 Feb 2020 12:11:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9FA0620661 for ; Tue, 4 Feb 2020 12:11:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IA5OWq1F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727166AbgBDMLU (ORCPT ); Tue, 4 Feb 2020 07:11:20 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:51071 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727097AbgBDMLU (ORCPT ); Tue, 4 Feb 2020 07:11:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580818279; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aGaLcN1NuPtrJD4/Yv84mAID3PPqbNw6pOiPY4XCA7I=; b=IA5OWq1Fqx1Sd55BEKZ/qz2Yg0hcDMaEbYOm0kTzh34p8jThoBYi1GYSmuRoGEQkhqBIza Gkx4WtTOHP6CX9Dx1Y18UDJbD3M9BhzLhj/IXiGlGP5Lc24sWsgWD4XPge7zCFN1wjpMQY ucTLQytIdQmDv3YpSvJVosVS4D0Ljg0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-hNPdstVBPeaOqM-d7ddV2A-1; Tue, 04 Feb 2020 07:11:15 -0500 X-MC-Unique: hNPdstVBPeaOqM-d7ddV2A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 274A08010CB; Tue, 4 Feb 2020 12:11:14 +0000 (UTC) Received: from gondolin (ovpn-117-199.ams2.redhat.com [10.36.117.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FAA61BC6D; Tue, 4 Feb 2020 12:11:09 +0000 (UTC) Date: Tue, 4 Feb 2020 13:11:07 +0100 From: Cornelia Huck To: Christian Borntraeger Cc: Janosch Frank , KVM , David Hildenbrand , Thomas Huth , Ulrich Weigand , Claudio Imbrenda , Andrea Arcangeli Subject: Re: [RFCv2 07/37] KVM: s390: add new variants of UV CALL Message-ID: <20200204131107.6c7b3dae.cohuck@redhat.com> In-Reply-To: <20200203131957.383915-8-borntraeger@de.ibm.com> References: <20200203131957.383915-1-borntraeger@de.ibm.com> <20200203131957.383915-8-borntraeger@de.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 3 Feb 2020 08:19:27 -0500 Christian Borntraeger wrote: > From: Janosch Frank > > This add 2 new variants of the UV CALL. > > The first variant handles UV CALLs that might have longer busy > conditions or just need longer when doing partial completion. We should > schedule when necessary. > > The second variant handles UV CALLs that only need the handle but have > no payload (e.g. destroying a VM). We can provide a simple wrapper for > those. > > Signed-off-by: Janosch Frank > --- > arch/s390/include/asm/uv.h | 58 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 58 insertions(+) > > diff --git a/arch/s390/include/asm/uv.h b/arch/s390/include/asm/uv.h > index 4eaea95f5c64..3448f12ef57a 100644 > --- a/arch/s390/include/asm/uv.h > +++ b/arch/s390/include/asm/uv.h > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -92,6 +93,18 @@ struct uv_cb_cfs { > u64 paddr; > } __packed __aligned(8); > > +/* > + * A common UV call struct for the following calls: "for calls that take no payload"? In case there will be more of them in the future :) > + * Destroy cpu/config > + * Verify > + */ > +struct uv_cb_nodata { > + struct uv_cb_header header; > + u64 reserved08[2]; > + u64 handle; > + u64 reserved20[4]; > +} __packed __aligned(8); > + > struct uv_cb_share { > struct uv_cb_header header; > u64 reserved08[3]; > @@ -99,6 +112,31 @@ struct uv_cb_share { > u64 reserved28; > } __packed __aligned(8); > > +/* > + * Low level uv_call that takes r1 and r2 as parameter and avoids > + * stalls for long running busy conditions by doing schedule This can only ever return 0 or 1, right? > + */ > +static inline int uv_call_sched(unsigned long r1, unsigned long r2) > +{ > + int cc = 3; > + > + while (cc > 1) { > + asm volatile( > + "0: .insn rrf,0xB9A40000,%[r1],%[r2],0,0\n" > + " ipm %[cc]\n" > + " srl %[cc],28\n" > + : [cc] "=d" (cc) > + : [r1] "a" (r1), [r2] "a" (r2) > + : "memory", "cc"); > + if (need_resched()) > + schedule(); > + } > + return cc; > +} > + > +/* > + * Low level uv_call that takes r1 and r2 as parameter > + */ > static inline int uv_call(unsigned long r1, unsigned long r2) > { > int cc; > @@ -114,6 +152,26 @@ static inline int uv_call(unsigned long r1, unsigned long r2) > return cc; > } > > +/* > + * special variant of uv_call that only transport the cpu or guest s/transport/transports/ > + * handle and the command, like destroy or verify. > + */ > +static inline int uv_cmd_nodata(u64 handle, u16 cmd, u32 *ret) > +{ > + int rc; > + struct uv_cb_nodata uvcb = { > + .header.cmd = cmd, > + .header.len = sizeof(uvcb), > + .handle = handle, > + }; > + > + WARN(!handle, "No handle provided to Ultravisor call cmd %x\n", cmd); Just return -EINVAL for !handle? > + rc = uv_call_sched(0, (u64)&uvcb); > + if (ret) > + *ret = *(u32 *)&uvcb.header.rc; Does that rc value in the block contain anything sensible if you didn't get cc==0? > + return rc ? -EINVAL : 0; > +} > + > struct uv_info { > unsigned long inst_calls_list[4]; > unsigned long uv_base_stor_len;