Received: by 10.192.165.156 with SMTP id m28csp583503imm; Mon, 16 Apr 2018 05:37:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx49KE4rljaRs555eRvcb+FT9suRTG3DoBq4yblXF4DGuXJiErAYIA/m3rsgYilQGG5jG1rVU X-Received: by 2002:a17:902:8b84:: with SMTP id ay4-v6mr15180661plb.57.1523882220715; Mon, 16 Apr 2018 05:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523882220; cv=none; d=google.com; s=arc-20160816; b=WgbE3pS/P68td6U1gYn0IRFJ4PUQ4H6CvwlaY3LUzpNH8+c5M3Pdd1K/gzqfUkXL+E IaaBb5G9CzR1kfxQ/lvtVd8FIxwLAWVqjy0lrUi8zxIiKwstbHzsiBCAbtDoOCZbTvg5 GGWPlwZqX5X5Cu385YueHA4R8qApwXDxX2Xh9VNefO/lkiQMKBYmGLbO/HEbBJtUADZJ mINYRvaz2BPp8jdEWDSg65J+hwSCs+QwjnirjHYNQ8TUDeM/l4HPL4wdpya7jhNtXYnx E8Ruk7cmYs42bCBTXt/gmcczV2nA/a0YeIO36VXp/eSUTLzlNnnvjmvJnwnVDvXgm33w I0EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=RRFMfn1em692X3PbwT4qLedB+tDicd5VYmsvO0n+ykc=; b=QTkxUs1RisPOxZjL/CeQt6b7SfTl5LwMnyZTedGoTqTtlTyD9D3Ol/YdshUylPxj34 AqUUD3/efiQtcX0PfNT0fdxye/Y2Cmn68xJ5LFoPQ2489yyTH/R+yNDUyIzTnADUgDxA SdV9FDwXZGSq/CebyLKlBQzmwno96d45OxlEKZ6ulenzp3kj/wZ6zX3frfsvPXm3TYvK HOYJ30fKLwGkecYuOMobG0xS3ChyuWQsIGVWKBN3tZ+KdP1J5yHWodT4vP3ZyuoHHZ6v 8y6CVAKSEfx2VL81IOLvja/8xDXC4nNxyoRela0EB+aUnRv460VD0mVJ82llS0yd0tGB CtOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g4-v6si12205795plb.522.2018.04.16.05.36.46; Mon, 16 Apr 2018 05:37:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755324AbeDPMLo (ORCPT + 99 others); Mon, 16 Apr 2018 08:11:44 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48230 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752776AbeDPMLn (ORCPT ); Mon, 16 Apr 2018 08:11:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5248381A88A6; Mon, 16 Apr 2018 12:11:42 +0000 (UTC) Received: from gondolin (unknown [10.36.118.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EFE320BC8C7; Mon, 16 Apr 2018 12:11:39 +0000 (UTC) Date: Mon, 16 Apr 2018 14:11:36 +0200 From: Cornelia Huck To: Pierre Morel Cc: Tony Krowiak , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, freude@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, borntraeger@de.ibm.com, kwankhede@nvidia.com, bjsdjshi@linux.vnet.ibm.com, pbonzini@redhat.com, alex.williamson@redhat.com, alifm@linux.vnet.ibm.com, mjrosato@linux.vnet.ibm.com, jjherne@linux.vnet.ibm.com, thuth@redhat.com, pasic@linux.vnet.ibm.com, berrange@redhat.com, fiuczy@linux.vnet.ibm.com, buendgen@de.ibm.com Subject: Re: [PATCH v4 01/15] s390: zcrypt: externalize AP instructions available function Message-ID: <20180416141136.04be5558.cohuck@redhat.com> In-Reply-To: <77bbd4ca-8412-e59d-e1ca-9a114cf495a6@linux.vnet.ibm.com> References: <1523827345-11600-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1523827345-11600-2-git-send-email-akrowiak@linux.vnet.ibm.com> <77bbd4ca-8412-e59d-e1ca-9a114cf495a6@linux.vnet.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.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 16 Apr 2018 12:11:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 16 Apr 2018 12:11:42 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 Apr 2018 10:44:53 +0200 Pierre Morel wrote: > On 15/04/2018 23:22, Tony Krowiak wrote: > > If the AP instructions are not available on the linux host, then > > AP devices can not be interpreted by the SIE. The AP bus has a > > function it uses to determine if the AP instructions are > > available. This patch provides a new function that wraps the > > AP bus's function to externalize it for use by KVM. > > > > Signed-off-by: Tony Krowiak > > Reviewed-by: Pierre Morel > > Reviewed-by: Harald Freudenberger > > --- > > arch/s390/include/asm/ap.h | 7 +++++++ > > arch/s390/include/asm/kvm-ap.h | 23 +++++++++++++++++++++++ > > arch/s390/kvm/Makefile | 2 +- > > arch/s390/kvm/kvm-ap.c | 21 +++++++++++++++++++++ > > drivers/s390/crypto/ap_bus.c | 6 ++++++ > > 5 files changed, 58 insertions(+), 1 deletions(-) > > create mode 100644 arch/s390/include/asm/kvm-ap.h > > create mode 100644 arch/s390/kvm/kvm-ap.c > > diff --git a/arch/s390/kvm/kvm-ap.c b/arch/s390/kvm/kvm-ap.c > > new file mode 100644 > > index 0000000..1267588 > > --- /dev/null > > +++ b/arch/s390/kvm/kvm-ap.c > > @@ -0,0 +1,21 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Adjunct Processor (AP) configuration management for KVM guests > > + * > > + * Copyright IBM Corp. 2018 > > + * > > + * Author(s): Tony Krowiak > > + */ > > +#include > > +#include > > +#include > > + > > +int kvm_ap_instructions_installed(void) > > +{ > > +#ifdef CONFIG_ZCRYPT > > I did not give my R-B for this. > please change it or suppress my R-B > > I think you should review the way you wrap functions > calling the AP interface. > Having all of them together would simplify code and review. I don't like the ifdeffery either (especially as there's more later). Consolidating all functions for querying basic ap capabilities sounds like a good idea. What about collecting them in a ap-util file and either always building it or selecting it from both zcrypt and kvm? > > > + return ap_instructions_installed(); > > +#else > > + return 0; > > +#endif > > +} > > +EXPORT_SYMBOL(kvm_ap_instructions_installed); > > diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c > > index 35a0c2b..9d108b6 100644 > > --- a/drivers/s390/crypto/ap_bus.c > > +++ b/drivers/s390/crypto/ap_bus.c > > @@ -210,6 +210,12 @@ int ap_query_configuration(struct ap_config_info *info) > > } > > EXPORT_SYMBOL(ap_query_configuration); > > > > +int ap_instructions_installed(void) > > +{ > > + return (ap_instructions_available() == 0); > > +} > > +EXPORT_SYMBOL(ap_instructions_installed); > > + > > /** > > * ap_init_configuration(): Allocate and query configuration array. > > */ > >