Received: by 10.192.165.156 with SMTP id m28csp10411imm; Tue, 17 Apr 2018 05:47:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+2a7MfYfD/XesNP8K7GP0rfqAignUc9U7Ravw8gs7eUOh40U+NdLY/xSd3deFc8lL2m5ng X-Received: by 2002:a17:902:6505:: with SMTP id b5-v6mr1928884plk.147.1523969262722; Tue, 17 Apr 2018 05:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523969262; cv=none; d=google.com; s=arc-20160816; b=lMZN6i3EVr2wM0RQ2taMtgG50JfF9LkuRp3hANM5g/rt3ofgvbZRkWy+4quIEf1Y0u R+UJhlYW5D7CR2rX16y1+rLNtmjuHoUeGPpBoON1RJD2ebDNef+H868MheuwAcWefu23 B5VVBV09ZJpl0vqcUPd+t6TGU4CUjU3/BNPf055k9bpSC+hP4ya7JpydRhzNWYKTyjU5 tZ1viwkM4Ikn4YPQQzZ6+FfAPkdPGQnj1ZaXfZp7l9Z2JgXEhpNa4X199TKXgSGS+mvV ICDstceM5JNwfTf97921N4/JxSlkncKE9CrpEVx62dzZWrLZz3nodORn8f7QkJ4TQo/Z 07BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :from:references:cc:to:subject:arc-authentication-results; bh=Q72TL1wTHOss/fVy1IrtdmfKfIJ+QMOIoK3YbsgOYgE=; b=NYwlb5UjcwKEXti7+c2ySaGWlkATnCPkfoXr8HPQOY5TiWpGv3uY2b6iMe80xzz0zK 5DMLtWvWvhdX057VKEIf8kez5Axx6SBMA/dKzzswryl1ZAdbgigDVke7408NSau7feq9 1jSnAeWZP+Dp9Jtu1KQDRyHFUfbXUT6G1BikGlh1BB5tR3MGKyVZgsd9nJdJdNaivKR6 1C5eTJ2HhzLHV/S25gyTBracw69D+ufFGapBlaOmhRgCRnFCW1dYHdVqYQ9mn9323GHS Z03mQ5gJFGmlqs17N7iUlVm3IEupR9VbcMAnK3O9Ee0TC9VEOoS3oc1v5bnqVZgCSg+5 cpWg== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64-v6si14543866pla.117.2018.04.17.05.47.28; Tue, 17 Apr 2018 05:47:42 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752972AbeDQMpF (ORCPT + 99 others); Tue, 17 Apr 2018 08:45:05 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34894 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752511AbeDQMpE (ORCPT ); Tue, 17 Apr 2018 08:45:04 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3HCfclh020916 for ; Tue, 17 Apr 2018 08:45:04 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hde9q8qsh-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 08:45:02 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Apr 2018 13:44:45 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Apr 2018 13:44:41 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3HCieRE52101300; Tue, 17 Apr 2018 12:44:40 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DF77911C050; Tue, 17 Apr 2018 13:36:36 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4300411C054; Tue, 17 Apr 2018 13:36:36 +0100 (BST) Received: from [9.152.224.146] (unknown [9.152.224.146]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Apr 2018 13:36:36 +0100 (BST) Subject: Re: [PATCH v4 01/15] s390: zcrypt: externalize AP instructions available function To: Harald Freudenberger Cc: Tony Krowiak , alex.williamson@redhat.com, alifm@linux.vnet.ibm.com, berrange@redhat.com, bjsdjshi@linux.vnet.ibm.com, borntrae@linux.ibm.com, cohuck@redhat.com, fiuczy@linux.vnet.ibm.com, heicars2@linux.vnet.ibm.com, jjherne@linux.vnet.ibm.com, kvm@vger.kernel.org, kwankhede@nvidia.com, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, mjrosato@linux.vnet.ibm.com, mschwid2@linux.vnet.ibm.com, pasic@linux.vnet.ibm.com, pbonzini@redhat.com, Reinhard Buendgen , thuth@redhat.com References: <1523827345-11600-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1523827345-11600-2-git-send-email-akrowiak@linux.vnet.ibm.com> <83bd1b8f-f3c0-328f-4b3d-6972d82b3662@linux.vnet.ibm.com> From: Pierre Morel Date: Tue, 17 Apr 2018 14:44:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 18041712-0008-0000-0000-000004EC45AE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041712-0009-0000-0000-00001E8049D3 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-17_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804170115 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/04/2018 09:01, Harald Freudenberger wrote: > Hi Pierre > > The AP bus can no longer get compiled as a module. There is a (unbeautiful) > trick done in the Makefile: > > ... > ap-objs := ap_bus.o ap_card.o ap_queue.o > obj-$(subst m,y,$(CONFIG_ZCRYPT)) += ap.o > # zcrypt_api.o and zcrypt_msgtype*.o depend on ap.o > ... > > which makes sure there is either no AP support in the kernel or it is > always static. Hi, AP can not be compiled as a kernel module but... we can set ZCRYPT=m in the configuration which means that the ZCRYPT definition will be CONFIG_ZCRYPT_MODULE and not CONFIG_ZCRYPT. Regards, Pierre > > Mit freundlichen Gr??en / Kind regards > > Harald Freudenberger > > > IBM Systems &Technology Group, zLinux Development > ---------------------------------------------------------------------------------- > > IBM Deutschland > Schoenaicher Str. 220 > 71032 Boeblingen > Phone: +49-7031-16-5152 > E-Mail: freude@de.ibm.com > ---------------------------------------------------------------------------------- > > IBM Deutschland Research & Development GmbH > Vorsitzender des Aufsichtsrats: Martina Koederitz > Gesch?ftsf?hrung: Dirk Wittkopp > Sitz der Gesellschaft: B?blingen > Registergericht: Amtsgericht Stuttgart, HRB 243294 > ------------------------------------------------------------------------------------ > > > > From: Pierre Morel > To: Tony Krowiak , > linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, > kvm@vger.kernel.org > Cc: Harald Freudenberger/Germany/IBM@IBMDE, > mschwid2@linux.vnet.ibm.com, heicars2@linux.vnet.ibm.com, > borntrae@linux.ibm.com, cohuck@redhat.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, Reinhard Buendgen/Germany/IBM@IBMDE > Date: 16.04.2018 17:59 > Subject: Re: [PATCH v4 01/15] s390: zcrypt: externalize AP instructions > available function > > > > 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/include/asm/ap.h b/arch/s390/include/asm/ap.h >> index c1bedb4..7773bfd 100644 >> --- a/arch/s390/include/asm/ap.h >> +++ b/arch/s390/include/asm/ap.h >> @@ -120,4 +120,11 @@ struct ap_queue_status ap_queue_irq_ctrl(ap_qid_t > qid, >> struct > ap_qirq_ctrl qirqctrl, >> void *ind); >> >> +/** >> + * ap_instructions_installed() - Tests whether AP instructions are > installed >> + * >> + * Returns 1 if the AP instructions are installed, otherwise; returns 0 >> + */ >> +int ap_instructions_installed(void); >> + >> #endif /* _ASM_S390_AP_H_ */ >> diff --git a/arch/s390/include/asm/kvm-ap.h > b/arch/s390/include/asm/kvm-ap.h >> new file mode 100644 >> index 0000000..84412a9 >> --- /dev/null >> +++ b/arch/s390/include/asm/kvm-ap.h >> @@ -0,0 +1,23 @@ >> +// SPDX-License-Identifier: GPL-2.0+ >> +/* >> + * Adjunct Processor (AP) configuration management for KVM guests >> + * >> + * Copyright IBM Corp. 2018 >> + * >> + * Author(s): Tony Krowiak >> + */ >> + >> +#ifndef _ASM_KVM_AP >> +#define _ASM_KVM_AP >> + >> +/** >> + * kvm_ap_instructions_installed() >> + * >> + * Tests whether AP instructions are installed on the linux host >> + * >> + * Returns 1 if the AP instructions are installed on the host, > otherwise; >> + * returns 0 >> + */ >> +int kvm_ap_instructions_installed(void); >> + >> +#endif /* _ASM_KVM_AP */ >> diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile >> index 05ee90a..1876bfe 100644 >> --- a/arch/s390/kvm/Makefile >> +++ b/arch/s390/kvm/Makefile >> @@ -9,6 +9,6 @@ common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o $ > (KVM)/async_pf.o $(KVM)/irqch >> ccflags-y := -Ivirt/kvm -Iarch/s390/kvm >> >> kvm-objs := $(common-objs) kvm-s390.o intercept.o interrupt.o priv.o > sigp.o >> -kvm-objs += diag.o gaccess.o guestdbg.o vsie.o >> +kvm-objs += diag.o gaccess.o guestdbg.o vsie.o kvm-ap.o >> >> obj-$(CONFIG_KVM) += kvm.o >> 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 > if you do this take care that ZCRYPT may be a module ;) > >> + 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. >> */ > > -- > Pierre Morel > Linux/KVM/QEMU in B?blingen - Germany > > > > -- Pierre Morel Linux/KVM/QEMU in B?blingen - Germany