From patchwork Wed Oct 10 17:03:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 10634859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65107933 for ; Wed, 10 Oct 2018 17:05:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52C712A04E for ; Wed, 10 Oct 2018 17:05:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45C9A2A095; Wed, 10 Oct 2018 17:05:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B71892A04E for ; Wed, 10 Oct 2018 17:05:21 +0000 (UTC) Received: from localhost ([::1]:58335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAHvF-0005fS-1J for patchwork-qemu-devel@patchwork.kernel.org; Wed, 10 Oct 2018 13:05:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAHtY-0004Mg-Hv for qemu-devel@nongnu.org; Wed, 10 Oct 2018 13:03:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAHtV-0006FZ-Nx for qemu-devel@nongnu.org; Wed, 10 Oct 2018 13:03:36 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33182) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gAHtV-0006B4-DE for qemu-devel@nongnu.org; Wed, 10 Oct 2018 13:03:33 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9AGxU0s136511 for ; Wed, 10 Oct 2018 13:03:23 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n1jqhgccj-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 10 Oct 2018 13:03:23 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 10 Oct 2018 11:03:22 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 10 Oct 2018 11:03:19 -0600 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9AH3GAH37027850 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 10 Oct 2018 10:03:16 -0700 Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CDB178063; Wed, 10 Oct 2018 11:03:16 -0600 (MDT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A739D7805E; Wed, 10 Oct 2018 11:03:13 -0600 (MDT) Received: from oc8043147753.ibm.com (unknown [9.80.212.103]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTPS; Wed, 10 Oct 2018 11:03:13 -0600 (MDT) From: Tony Krowiak To: qemu-devel@nongnu.org Date: Wed, 10 Oct 2018 13:03:02 -0400 X-Mailer: git-send-email 2.19.0.221.g150f307 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101017-0004-0000-0000-0000149BC3E6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009855; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01100702; UDB=6.00569512; IPR=6.00880751; MB=3.00023698; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-10 17:03:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101017-0005-0000-0000-0000891BFF05 Message-Id: <20181010170309.12045-1-akrowiak@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-10_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=948 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810100163 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v11 0/6] s390x: vfio-ap: guest dedicated crypto adapters X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, akrowiak@linux.vnet.ibm.com, cohuck@redhat.com, david@redhat.com, pmorel@linux.vnet.ibm.com, fiuczy@linux.ibm.com, eskultet@redhat.com, agraf@suse.de, borntraeger@de.ibm.com, jjherne@linux.vnet.ibm.com, mimu@linux.ibm.com, Tony Krowiak , heiko.carstens@de.ibm.com, eric.auger@redhat.com, alex.williamson@redhat.com, bjsdjshi@linux.vnet.ibm.com, rth@twiddle.net, mjrosato@linux.vnet.ibm.com, pasic@linux.vnet.ibm.com, alifm@linux.vnet.ibm.com, qemu-s390x@nongnu.org, schwidefsky@de.ibm.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch series is the QEMU counterpart to the KVM/kernel support for guest dedicated crypto adapters. The KVM/kernel model is built on the VFIO mediated device framework and provides the infrastructure for granting exclusive guest access to crypto devices installed on the linux host. This patch series introduces a new QEMU command line option, QEMU object model and CPU model features to exploit the KVM/kernel model. See the detailed specifications for AP virtualization provided by this patch set in docs/vfio-ap.txt for a more complete discussion of the design introduced by this patch series. v10 => v11 Change log: ===================== * Replaced DO_UPCAST macros in ap.c * Initializing GError in vfio_ap_get_group() function (BUG) * Updated s390 maintainers with new files in MAINTAINERS * Fixed memory leak in vfio_ap_get_group() function v9 => v10 Change log: ==================== * Removed KVM_S390_VM_CPU_FEAT_AP feature from kvm.h * Moved check for KVM_S390_VM_CRYPTO_ENABLE_APIE from patch 2/6 to patch 3/6 * Removed vfio from all function names in ap-bridge.c * Removed unused macros and structure from ap-bridge.h * Removed unused macros from ap-device.h v8 => v9 Change log: =================== * Removed all references to VFIO in AP bridge and bus * Expose AP feature only if the KVM_S390_VM_CRYPTO_ENABLE_APIE VM attribute is exposed by KVM - i.e., if AP instructions are available on the linux host. * Enable AP interpretation only if AP feature is switched on; no need to disable because it is disabled by default. v7 => v8 Change log: =================== * Enable SIE interpretation AP instructions if the CPU model feature for AP instructions is turned on for the guest. v6 => v7 Change log; =================== * Changed email address for Signed-off-by v5 => v6 Change log: =================== * Added reset handling fo vfio-ap device * Added a bridge/bus to AP device object model - thanks to Halil Pasic v4 => v5 Change log: =================== * Added MAINTAINERS entries for VFIO AP * Added explanation for why we are only supporting zEC12 and newer CPU models. * Changed CPU model feature qci=on|off to apqci=on|off * Misc. minor changes v3 => v4 Change log: =================== * Made vfio-ap device unpluggable for now * Renamed command line CPU model feature for QCI: qci=on -> apqci=on * Removed call to KVM_S390_VM_CRYPTO_INTERPRET_AP ioctl - ioctl was removed from kernel and AP instruction interpretation is set from the VFIO device driver * Added check to ensure only one vfio-ap device can be configured per guest * Removed AP instruction interception handlers: AP instructions will be interpreted by default if AP facilities are installed to handle the case where feature ap=on and no vfio-ap device is configured for the guest. Tony Krowiak (6): linux-headers: linux header updates for AP support s390x/cpumodel: Set up CPU model for AP device support s390x/kvm: enable AP instruction interpretation for guest s390x/ap: base Adjunct Processor (AP) object model s390x/vfio: ap: Introduce VFIO AP device s390: doc: detailed specifications for AP virtualization MAINTAINERS | 16 + default-configs/s390x-softmmu.mak | 1 + docs/vfio-ap.txt | 825 ++++++++++++++++++++++++++++++ hw/s390x/Makefile.objs | 2 + hw/s390x/ap-bridge.c | 78 +++ hw/s390x/ap-device.c | 38 ++ hw/s390x/s390-virtio-ccw.c | 4 + hw/vfio/Makefile.objs | 1 + hw/vfio/ap.c | 179 +++++++ include/hw/s390x/ap-bridge.h | 19 + include/hw/s390x/ap-device.h | 22 + include/hw/vfio/vfio-common.h | 1 + linux-headers/asm-s390/kvm.h | 2 + linux-headers/linux/vfio.h | 2 + target/s390x/cpu_features.c | 3 + target/s390x/cpu_features_def.h | 3 + target/s390x/cpu_models.c | 2 + target/s390x/gen-features.c | 3 + target/s390x/kvm.c | 19 + 19 files changed, 1220 insertions(+) create mode 100644 docs/vfio-ap.txt create mode 100644 hw/s390x/ap-bridge.c create mode 100644 hw/s390x/ap-device.c create mode 100644 hw/vfio/ap.c create mode 100644 include/hw/s390x/ap-bridge.h create mode 100644 include/hw/s390x/ap-device.h