Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp777611pxk; Thu, 24 Sep 2020 19:30:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiZCdPhj3mbdAbZBy/4Y/BhrnHTF3PnCYEuylsCtaF6S2TluQPoy0mSDqwj177xDbDRuAN X-Received: by 2002:a17:906:56c2:: with SMTP id an2mr627085ejc.118.1601001053512; Thu, 24 Sep 2020 19:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601001053; cv=none; d=google.com; s=arc-20160816; b=0YbGNxMG2uVmf1PfkobTs80leGwJs9rGNIJaT+l8MetHzZopUr8eSigltgauTkkTQY 75Ij+OiWRuDB7/V+3CZO/jf7Alv5seWsP64CtFflUO1OKFjwIvE5MFSyHheYxDTO4Xhs hJIP9IEwPKRoblkJVii3+uBvP5aGIT5d70JptB61QuYJ9U/uTc3ESzqFZ6gKMvufsyew tW7peMkkmHOv6cvMSWHwgyjnPwoCTJkKfRgBz+P0wbnabmUHOtzZ/YxnVrMYFOw27Oze Rr1711EpxdNw3FvrmfonLpG9842Jv5TARWVAMj+jDXOD5gPd4zlm+kvCfrlaAqTQM8gw 8Xng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=Npya7ZG50TR7LYBYqdAtUNgseBY9REIoX/lPcjA3eOk=; b=wX9x4nhbE7p3b5m53Doow9J3OLownMaCX3KBitQs1gWL6wjOipbX3eru3hDvSAL35o 8O0b6ck4zixodema0HETUdsZPVcyM6WaDM3glYUmUkShfGTcwVZxc6bJpWJJI7U0KMRH MruhuFfvbUljB9XSFAAzPKDOD1eG5tmAftYN25G+WASX+Vr70lDtqhp2/ectp/0fDl0t daoslzEHBePlf0qNx31A/ZHihw0s6vr2KRusQWhnfeTGVVhex6/gnJAEOjQgNah647Iy d34GtRI1aAw9/CelKgEWL2a8AOelL0+uWxprPUHt1u0B8k7UMiHCDKw6DlP0S5mUMDjM Vn1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=USh0iQzO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si964980edr.49.2020.09.24.19.30.29; Thu, 24 Sep 2020 19:30:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=USh0iQzO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726841AbgIYC1k (ORCPT + 99 others); Thu, 24 Sep 2020 22:27:40 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:61734 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbgIYC1k (ORCPT ); Thu, 24 Sep 2020 22:27:40 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08P1XmRU107643; Thu, 24 Sep 2020 22:27:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pp1; bh=Npya7ZG50TR7LYBYqdAtUNgseBY9REIoX/lPcjA3eOk=; b=USh0iQzOi7aOsqFiWlw3KnNHgEDpmITq2mC9tIb/yEYiZTlKF5Rn8g2qcTBUEeJWucEo lvDN4XshJX7NrrnYUUk9aUV8BHxCfiUCoYSLeppPUrx/sDG4zUCJe1Dz5G7KLQv6dMQn 8Y5vP2/WM5bFItrUdAOj84cOc8sXJIigh7SRJ4VGSod3yksBI4kEQXHmOggCbyBUbS6u 9Dt0IpBE8+HCCDvyVGn/ewv5ml3YTT7TGxbY07Q7h57+DV1kfP3qAq2mZM5kd9ya/cOK ip5wtsjbnpjA9hGpVV/b/B6K+t3okwkWLd+ATalvf452BeZZkuN7OHnAPKsaIKSoUzVL +Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33s5j3jujf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Sep 2020 22:27:37 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 08P2Quon080904; Thu, 24 Sep 2020 22:27:37 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 33s5j3juhy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Sep 2020 22:27:37 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08P2OSAn010755; Fri, 25 Sep 2020 02:27:34 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03fra.de.ibm.com with ESMTP id 33s5a981md-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Sep 2020 02:27:34 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08P2RTof27394424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Sep 2020 02:27:29 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D657652052; Fri, 25 Sep 2020 02:27:31 +0000 (GMT) Received: from oc2783563651 (unknown [9.145.190.191]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 130335204E; Fri, 25 Sep 2020 02:27:31 +0000 (GMT) Date: Fri, 25 Sep 2020 04:27:29 +0200 From: Halil Pasic To: Tony Krowiak Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com, frankja@linux.ibm.com, david@redhat.com, imbrenda@linux.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com, kernel test robot Subject: Re: [PATCH v10 02/16] s390/vfio-ap: use new AP bus interface to search for queue devices Message-ID: <20200925042729.3b9d5704.pasic@linux.ibm.com> In-Reply-To: <20200821195616.13554-3-akrowiak@linux.ibm.com> References: <20200821195616.13554-1-akrowiak@linux.ibm.com> <20200821195616.13554-3-akrowiak@linux.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-24_18:2020-09-24,2020-09-24 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 spamscore=0 mlxscore=0 malwarescore=0 adultscore=0 priorityscore=1501 phishscore=0 bulkscore=0 clxscore=1011 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009250007 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Aug 2020 15:56:02 -0400 Tony Krowiak wrote: > --- a/drivers/s390/crypto/vfio_ap_ops.c > +++ b/drivers/s390/crypto/vfio_ap_ops.c > @@ -26,43 +26,26 @@ > > static int vfio_ap_mdev_reset_queues(struct mdev_device *mdev); > > -static int match_apqn(struct device *dev, const void *data) > -{ > - struct vfio_ap_queue *q = dev_get_drvdata(dev); > - > - return (q->apqn == *(int *)(data)) ? 1 : 0; > -} > - > /** > - * vfio_ap_get_queue: Retrieve a queue with a specific APQN from a list > - * @matrix_mdev: the associated mediated matrix > + * vfio_ap_get_queue: Retrieve a queue with a specific APQN. > * @apqn: The queue APQN > * > - * Retrieve a queue with a specific APQN from the list of the > - * devices of the vfio_ap_drv. > - * Verify that the APID and the APQI are set in the matrix. > + * Retrieve a queue with a specific APQN from the AP queue devices attached to > + * the AP bus. > * > - * Returns the pointer to the associated vfio_ap_queue > + * Returns the pointer to the vfio_ap_queue with the specified APQN, or NULL. > */ > -static struct vfio_ap_queue *vfio_ap_get_queue( > - struct ap_matrix_mdev *matrix_mdev, > - int apqn) > +static struct vfio_ap_queue *vfio_ap_get_queue(unsigned long apqn) > { > + struct ap_queue *queue; > struct vfio_ap_queue *q; > - struct device *dev; > > - if (!test_bit_inv(AP_QID_CARD(apqn), matrix_mdev->matrix.apm)) > - return NULL; > - if (!test_bit_inv(AP_QID_QUEUE(apqn), matrix_mdev->matrix.aqm)) > + queue = ap_get_qdev(apqn); > + if (!queue) > return NULL; > > - dev = driver_find_device(&matrix_dev->vfio_ap_drv->driver, NULL, > - &apqn, match_apqn); > - if (!dev) > - return NULL; > - q = dev_get_drvdata(dev); > - q->matrix_mdev = matrix_mdev; > - put_device(dev); > + q = dev_get_drvdata(&queue->ap_dev.device); Is this cast here safe? (I don't think it is.) > + put_device(&queue->ap_dev.device); > > return q; > }