From patchwork Thu Jun 2 17:19:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12868015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 529F6CCA47B for ; Thu, 2 Jun 2022 17:20:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234749AbiFBRUP (ORCPT ); Thu, 2 Jun 2022 13:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237439AbiFBRUB (ORCPT ); Thu, 2 Jun 2022 13:20:01 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EC9420E6E0; Thu, 2 Jun 2022 10:20:00 -0700 (PDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 252ELF8o021887; Thu, 2 Jun 2022 17:19:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=EUAgnji2hRkQEv8sBkLZ0OS6Zx3sFbWqT+QuO5YSeBg=; b=DfXuJCJp6TcmYgufoUrNjORfYTGXAewIc7A9xcHFZ14uUehKYNc5tkVQWLTrkYeG24yV OtF2GLcy8ZxGjwOZpN9IGUBGLIeWwIU8txDsCLzpmRdsbc1nmgyzBMvNskYraeBO9VT8 c+ZdZzs+BAVhO1XsUZ0aFKpfB0MVNPA1yx9Bz+OeIDrJ5Ound2uMi5fJzvRPazME2d9R ZpeinfAIkvZ2uZq5MQxW1UoWy1YogEVQ+0o84tgPRV3xluaRrfoMEre6YKXX5RiDCoOy NtkWybNuDE9wu1SaWVFDrphYuYbxl+bD9JWv8MAXNee9HddyxdnrQlRlxLFzUYS+UoYk aw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gew9cnd08-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Jun 2022 17:19:57 +0000 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 252HJvOB013772; Thu, 2 Jun 2022 17:19:57 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gew9cncyu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Jun 2022 17:19:57 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 252H5HJg016482; Thu, 2 Jun 2022 17:19:54 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04fra.de.ibm.com with ESMTP id 3gbc8ynkv5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Jun 2022 17:19:54 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 252HJkR022741496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 Jun 2022 17:19:46 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F7C84204B; Thu, 2 Jun 2022 17:19:51 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3DAC342045; Thu, 2 Jun 2022 17:19:51 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 2 Jun 2022 17:19:51 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id B64B7E09AA; Thu, 2 Jun 2022 19:19:50 +0200 (CEST) From: Eric Farman To: Matthew Rosato Cc: Jason Gunthorpe , Alex Williamson , Liu Yi L , Halil Pasic , kvm@vger.kernel.org, linux-s390@vger.kernel.org, Eric Farman Subject: [PATCH v1 05/18] vfio/ccw: Remove private->mdev Date: Thu, 2 Jun 2022 19:19:35 +0200 Message-Id: <20220602171948.2790690-6-farman@linux.ibm.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220602171948.2790690-1-farman@linux.ibm.com> References: <20220602171948.2790690-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: LVRGDEcTqbfc3G1TJPnoGz4RCwiCSvJg X-Proofpoint-ORIG-GUID: QBawT43dqWujb1xzIqc7iYud6lpak0eT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-06-02_05,2022-06-02_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 phishscore=0 spamscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206020071 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The only remaining user of private->mdev gets the struct device in order to copy channel program data. The same pointer is available from private->vdev, which is managed by vfio_(un)init_group_dev(). It doesn't make sense to carry multiple pointers to the same thing, and risk them getting out of sync. So convert that user, and then private->mdev can be removed entirely. Suggested-by: Jason Gunthorpe Signed-off-by: Eric Farman --- drivers/s390/cio/vfio_ccw_async.c | 1 - drivers/s390/cio/vfio_ccw_fsm.c | 4 +--- drivers/s390/cio/vfio_ccw_ops.c | 3 --- drivers/s390/cio/vfio_ccw_private.h | 2 -- 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_async.c b/drivers/s390/cio/vfio_ccw_async.c index 7a838e3d7c0f..420d89ba7f83 100644 --- a/drivers/s390/cio/vfio_ccw_async.c +++ b/drivers/s390/cio/vfio_ccw_async.c @@ -8,7 +8,6 @@ */ #include -#include #include "vfio_ccw_private.h" diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c index 86b23732d899..3e1d7744c292 100644 --- a/drivers/s390/cio/vfio_ccw_fsm.c +++ b/drivers/s390/cio/vfio_ccw_fsm.c @@ -10,7 +10,6 @@ */ #include -#include #include "ioasm.h" #include "vfio_ccw_private.h" @@ -242,7 +241,6 @@ static void fsm_io_request(struct vfio_ccw_private *private, union orb *orb; union scsw *scsw = &private->scsw; struct ccw_io_region *io_region = private->io_region; - struct mdev_device *mdev = private->mdev; char *errstr = "request"; struct subchannel_id schid = get_schid(private); @@ -262,7 +260,7 @@ static void fsm_io_request(struct vfio_ccw_private *private, errstr = "transport mode"; goto err_out; } - io_region->ret_code = cp_init(&private->cp, mdev_dev(mdev), + io_region->ret_code = cp_init(&private->cp, private->vdev.dev, orb); if (io_region->ret_code) { VFIO_CCW_MSG_EVENT(2, diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c index a0a3200b0b04..4a64c176facb 100644 --- a/drivers/s390/cio/vfio_ccw_ops.c +++ b/drivers/s390/cio/vfio_ccw_ops.c @@ -128,7 +128,6 @@ static int vfio_ccw_mdev_probe(struct mdev_device *mdev) vfio_init_group_dev(&private->vdev, &mdev->dev, &vfio_ccw_dev_ops); - private->mdev = mdev; private->state = VFIO_CCW_STATE_IDLE; VFIO_CCW_MSG_EVENT(2, "sch %x.%x.%04x: create\n", @@ -145,7 +144,6 @@ static int vfio_ccw_mdev_probe(struct mdev_device *mdev) err_atomic: vfio_uninit_group_dev(&private->vdev); atomic_inc(&private->avail); - private->mdev = NULL; private->state = VFIO_CCW_STATE_STANDBY; return ret; } @@ -171,7 +169,6 @@ static void vfio_ccw_mdev_remove(struct mdev_device *mdev) vfio_uninit_group_dev(&private->vdev); cp_free(&private->cp); - private->mdev = NULL; atomic_inc(&private->avail); } diff --git a/drivers/s390/cio/vfio_ccw_private.h b/drivers/s390/cio/vfio_ccw_private.h index 7272eb788612..12b5537d478f 100644 --- a/drivers/s390/cio/vfio_ccw_private.h +++ b/drivers/s390/cio/vfio_ccw_private.h @@ -73,7 +73,6 @@ struct vfio_ccw_crw { * @state: internal state of the device * @completion: synchronization helper of the I/O completion * @avail: available for creating a mediated device - * @mdev: pointer to the mediated device * @nb: notifier for vfio events * @io_region: MMIO region to input/output I/O arguments/results * @io_mutex: protect against concurrent update of I/O regions @@ -97,7 +96,6 @@ struct vfio_ccw_private { int state; struct completion *completion; atomic_t avail; - struct mdev_device *mdev; struct notifier_block nb; struct ccw_io_region *io_region; struct mutex io_mutex;