Received: by 10.223.164.202 with SMTP id h10csp14820wrb; Tue, 14 Nov 2017 10:18:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMa7rvzccfAWm2uvg8OOjePPos1kqqzAE25iBZ+gR7BgZbB6iboJ32kEscfbpIFn/2u7lC5F X-Received: by 10.84.242.76 with SMTP id c12mr6350749pll.328.1510683518116; Tue, 14 Nov 2017 10:18:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510683518; cv=none; d=google.com; s=arc-20160816; b=ypGls2CyeFhcpdh1RjAA52Cq6x14AjAT0xcjCDUIJbI+OaTxI3bkmQ7jQoY9De3Spn D8oajEZTeK/0grfwdRqHVHBW7ZjaqqykvzCh6bM/KkS1K4DgxSG/X/MozI4+kSX0Cam0 s0n7QICUj2eAGHWJ4AykTb9p4g7VBeRTb6f4r2npQeF4RuPt5Agum7aK5nlsmjUHBjU4 lzpeDC5moUVsIzDdDSQAC+wEQfXaFU3Bx+h8WDyM7rsQlcEZfpji4osFHPzSVdjc7+lf PU4CG/XlUzRRwLhB4IMRgj0S0gg6jE0wGptNU6m4dsUlp5/J3geRuxxD92Fpc/pn3HMH s8zw== 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=XcAk/aOIDLKDYnnDbjPNmLDmJAE04bDFq087kP6mbqM=; b=UcqvuxOl6+a+t2OfTkL0St85Os7IP86p/YFPA1HUc1c3DecTeGzROUd7NrsTLlsFRP 4MnOBHZsYjBeNSdMRUIkORXk6oA3fb4W4IPuX/ERJP4rGK1dwL1VX/BoDBP15/Fm34P0 zQsI+wuQ8R4CejE8jaRgEZOzDCMwsAfAXbZ9JmS8UuniQO93G/CxE3TXQP6jTd04Sn7T JU6wobeJnTpWMcaCBn3ioZsFArJHOknqtochCWz4rBhxvGWmlYnyO3QrQSsDV0XM4/KN kYw93O1tsrULDxpNHI83JXY5Ftzy60I6nrul/O2EVKjrYXlwM/8U9yPRijxPb//g+rBf WRIA== 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 v18si16144718pge.275.2017.11.14.10.18.25; Tue, 14 Nov 2017 10:18:38 -0800 (PST) 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 S1755286AbdKNSP6 (ORCPT + 88 others); Tue, 14 Nov 2017 13:15:58 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34068 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754894AbdKNSPt (ORCPT ); Tue, 14 Nov 2017 13:15:49 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vAEIFl1G080892 for ; Tue, 14 Nov 2017 13:15:49 -0500 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0b-001b2d01.pphosted.com with ESMTP id 2e83bxyeqf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 14 Nov 2017 13:15:48 -0500 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 14 Nov 2017 11:15:35 -0700 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 14 Nov 2017 11:15:32 -0700 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vAEIFUf43473874; Tue, 14 Nov 2017 11:15:30 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 78AF56A045; Tue, 14 Nov 2017 11:15:30 -0700 (MST) Received: from oc8043147753.ibm.com (unknown [9.60.75.228]) by b03ledav003.gho.boulder.ibm.com (Postfix) with ESMTP id A8E566A03C; Tue, 14 Nov 2017 11:15:28 -0700 (MST) Subject: Re: [RFC 05/19] s390/zcrypt: base implementation of AP matrix device driver To: Cornelia Huck Cc: 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, pmorel@linux.vnet.ibm.com, alifm@linux.vnet.ibm.com, mjrosato@linux.vnet.ibm.com, qemu-s390x@nongnu.org, jjherne@linux.vnet.ibm.com, thuth@redhat.com, pasic@linux.vnet.ibm.com References: <1507916344-3896-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1507916344-3896-6-git-send-email-akrowiak@linux.vnet.ibm.com> <20171114134040.3fcd6efd.cohuck@redhat.com> <06ddee4e-e1b8-ba17-5e3e-241e4dcf7cd0@linux.vnet.ibm.com> <20171114180036.262eff80.cohuck@redhat.com> From: Tony Krowiak Date: Tue, 14 Nov 2017 13:15:27 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20171114180036.262eff80.cohuck@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 17111418-0008-0000-0000-000008DD1023 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008066; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000240; SDB=6.00945841; UDB=6.00477381; IPR=6.00726139; BA=6.00005690; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018013; XFM=3.00000015; UTC=2017-11-14 18:15:35 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17111418-0009-0000-0000-000044C19D1D Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-14_09:,, 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-1711140249 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/14/2017 12:00 PM, Cornelia Huck wrote: > On Tue, 14 Nov 2017 11:37:05 -0500 > Tony Krowiak wrote: > >> On 11/14/2017 07:40 AM, Cornelia Huck wrote: >>> On Fri, 13 Oct 2017 13:38:50 -0400 >>> Tony Krowiak wrote: >>>> diff --git a/drivers/s390/crypto/ap_matrix_bus.c b/drivers/s390/crypto/ap_matrix_bus.c >>>> index 4eb1e3c..66bfa54 100644 >>>> --- a/drivers/s390/crypto/ap_matrix_bus.c >>>> +++ b/drivers/s390/crypto/ap_matrix_bus.c >>>> @@ -75,10 +75,18 @@ static int ap_matrix_dev_create(void) >>>> return 0; >>>> } >>>> >>>> +struct ap_matrix *ap_matrix_get_device(void) >>>> +{ >>>> + return matrix; >>> See the comments I had for the previous patch. In particular, I think >>> it is better to retrieve a pointer to the matrix device via driver core >>> methods. >> I got some objections to creating a new bus and since there will only ever >> be a single AP matrix device, I decided there really wasn't a need for an >> AP matrix bus and got rid of it. I opted instead to create the matrix >> device >> in the init function of the vfio_ap_matrix driver. Rather than passing >> around a >> pointer, I put the following in vfio_ap_matrix_private.h: >> >> struct ap_matrix { >> struct device device; >> spinlock_t qlock; >> struct list_head queues; >> }; >> >> extern struct ap_matrix ap_matrix; >> >> ... and declared the ap_matrix in the driver (vfio_ap_matrix_drv.c) >> file as: >> >> struct ap_matrix ap_matrix; >> >> Does this seem like a reasonable approach? > Getting rid of the bus as overhead is not unreasonable. > > I'm feeling a bit queasy about the extern, however. I'd prefer a getter > function (that also makes sure refcounting rules are followed). I now think I can avoid having to reference the ap_matrix device from multiple places. The reason the device is referenced in vfio_ap_matrix_ops.c is because there is a need for information about the AP queues that have been bound to the vfio_ap_matrix device driver. If interfaces are provided by the vfio_ap_matrix device driver to access the needed information, it won't be necessary to reference the ap_matrix device directly in vfio_ap_matrix_ops. I think this would be a better solution, don't you? > > We can't get around referencing this device from multiple files, can we? The only way would be to roll up vfio_ap_matrix_ops.c into vfio_ap_matrix_drv.c. I followed the pattern established by the vfio_ccw > From 1584064037223691096@xxx Tue Nov 14 17:39:47 +0000 2017 X-GM-THRID: 1581165332668656184 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread