From patchwork Wed Nov 2 15:01:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 1035 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3672049wru; Wed, 2 Nov 2022 08:05:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WL4m8pfNv2r/STD3ejCfULkj9INWSUMqKjq8SyTsmH14aJqMmB0CR2Ejyf6Gm9DenvuoV X-Received: by 2002:a63:38e:0:b0:46f:f400:d1fd with SMTP id 136-20020a63038e000000b0046ff400d1fdmr6830186pgd.153.1667401510916; Wed, 02 Nov 2022 08:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667401510; cv=none; d=google.com; s=arc-20160816; b=bDfxdIIjErddcN5lFG8B8M9F1ILh+7W1PaImUZpr+ZKmWpm3AJ2lrJHgBCJnVE6L8/ jQMR3BM5Z/9wIJBAdV4liYhcnq/ux2Uh/SAec9ofWslVRODcp9rJD8YIPH8pZXLIrqv9 d1nnfOydkoSwgyBra1Kz14Z2HdM4fb9V48vz+K0Ucfhd5yQIuRadVdhvbjCfJ1T+CO0e uUVaJTSOWOQ4BG1lW0BBdrwItiJR09yOpNzdjNDooCzFtq0Bx44groMRMdC/DipVE7EB FCDXTXfVhgAwCtMliM5vFVm2qoG+XtCtm76Ij07tCdwuGaTwWX6tM5y8iEEBdmWyTN6i lTFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=UB/R2lgefHPHQSvdUiaAq3ILQiFWcLwsNx4+zmWhhIk=; b=y1t7mJNTnnVsBZqPyJZ6HSDiCSDfkeOmfZ2u8df/SmIyN4Pr27C7FcZtbhCiyKW/y3 CE6czhrn57T1TD7mdhpXb8CK1rHH2r3nOfu0QP41eQj+Q7csk/1TZeqRGRBhZzuQwqnr t4DeDuBYcC05EMS0DHrDG5NipgM4zn6xaLTKX9vxjl7H/QHbnOmwd9wPEQCRN5JIFJo8 A/fL6OD6Zrfdsh0oIe4ru3+RcLrh7jZCY40HzPbq5KBYvp9recVFIHws5fSnvftdBnkt kILadhK4Z2GsZ1/e2qXGwoiPK6QjVYq1hDuk0+7GH6p4VpcTg2QjFtC23LYV+OVF3g0f NG4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="HEX9/r0S"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz18-20020a170902ef9200b00178b95aa01fsi15170908plb.614.2022.11.02.08.04.56; Wed, 02 Nov 2022 08:05:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="HEX9/r0S"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230376AbiKBPCh (ORCPT + 99 others); Wed, 2 Nov 2022 11:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbiKBPCV (ORCPT ); Wed, 2 Nov 2022 11:02:21 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BDC72982B; Wed, 2 Nov 2022 08:02:18 -0700 (PDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A2DnJ1C025757; Wed, 2 Nov 2022 15:02:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : mime-version; s=pp1; bh=UB/R2lgefHPHQSvdUiaAq3ILQiFWcLwsNx4+zmWhhIk=; b=HEX9/r0SygZ8TgGETmJhlnB/H7l18W8JWWZbeZI5fR3gbjkBX0L4oDxMCVVVJ68n0ZTb c7pNw5485XMaFKGhsSyo9QqM3P8HsubfzVJiWT97MsXQD3ORmkh7kZ4/5CLyMGZWTXMW nJWBRFXSYDsqC/po6x+TfRNOImBIXRFIyG0vEoUIG3ycWtDFo5UWMbdvp+JLOrAPynCB 55JSmYBekMDX5IgZX5XjCWGu1L7m7xp37Sj3fzIAQ3QcWwbZZfPAAA7/s6Ll/XfW5rVw FKHs5YyEmUZPuJsbtkApbY+Nm7/gNRad0SHl4jiREAQyMiuewr2Q0C6m+mssrdb5qi6I aA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kkss6b9en-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Nov 2022 15:02:02 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2A2DnKsm025848; Wed, 2 Nov 2022 15:02:02 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kkss6b9cr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Nov 2022 15:02:01 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2A2EosbR017404; Wed, 2 Nov 2022 15:01:57 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04ams.nl.ibm.com with ESMTP id 3kgut9706a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Nov 2022 15:01:57 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2A2F1sXs25559570 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Nov 2022 15:01:54 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21EE152052; Wed, 2 Nov 2022 15:01:54 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 0BD955204F; Wed, 2 Nov 2022 15:01:54 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id C9E6BE01BC; Wed, 2 Nov 2022 16:01:53 +0100 (CET) From: Eric Farman To: Matthew Rosato , Alex Williamson , Cornelia Huck , Jason Gunthorpe , Kevin Tian , Yi Liu Cc: Zhenyu Wang , Zhi Wang , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Halil Pasic , Vineeth Vijayan , Peter Oberparleiter , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Tony Krowiak , Jason Herne , Harald Freudenberger , Diana Craciun , Eric Auger , Kirti Wankhede , Abhishek Sahu , Yishai Hadas , intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kvm@vger.kernel.org, Eric Farman Subject: [PATCH v2 0/7] vfio-ccw parent rework Date: Wed, 2 Nov 2022 16:01:45 +0100 Message-Id: <20221102150152.2521475-1-farman@linux.ibm.com> X-Mailer: git-send-email 2.34.1 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: giE1FvulF18FIx78kR1PLtIr11DWW1b8 X-Proofpoint-ORIG-GUID: ld2AgWS6yzQppxgLjXXl59g3Tl71O3Gi X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-02_11,2022-11-02_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 impostorscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211020093 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748397206463884594?= X-GMAIL-MSGID: =?utf-8?q?1748397206463884594?= Hi all, Here is an update to the vfio-ccw lifecycle changes that have been discussed in various forms over the past year [1][2] or so, and which I dusted off recently. Patches 1-5 rework the behavior of the vfio-ccw driver's private struct. In summary, the mdev pieces are split out of vfio_ccw_private and into a new vfio_ccw_parent struct that will continue to follow today's lifecycle. The remainder (bulk) of the private struct moves to follow the mdev probe/remove pair. There's opportunity for further separation of the things in the private struct, which would simplify some of the vfio-ccw code, but it got too hairy as I started that. Once vfio-ccw is no longer considered unique, those cleanups can happen at our leisure. Patch 6 removes the trickery where vfio-ccw uses vfio_init_device instead of vfio_alloc_device, and thus removes vfio_init_device from the outside world. Patch 7 removes vfio_free_device from vfio-ccw and the other drivers (hello, CC list!), letting it be handled by vfio_device_release directly. Looking forward to the feedback. Thanks, Eric [1] https://lore.kernel.org/kvm/0-v3-57c1502c62fd+2190-ccw_mdev_jgg@nvidia.com/ [2] https://lore.kernel.org/kvm/20220602171948.2790690-1-farman@linux.ibm.com/ v1->v2: - Rebase to 6.1-rc3 - Patch 1: [EF] s/device_initialize/device_register/ and associated adjustments [MR] Add WARN_ON(!private) in vfio_ccw_sch_quiesce() [MR] Move struct vfio_ccw_parent to _private.h, instead of standalone file - Patch 2: [MR] Added r-b (Thank you!) - Patch 3: [MR] Update commit message to point to introduction of private->release_comp [MR] Replace the remnants of vfio_ccw_alloc_private with a straight kzalloc [MR] Added r-b (Thank you!) - Patch 5: [KT] Added r-b (Thank you!) - Patch 6: [JG] Make vfio_init_device static [KT] Added r-b (Thank you!) - Patch 7: [JG, KT] Added r-b (Thank you!) v1: https://lore.kernel.org/kvm/20221019162135.798901-1-farman@linux.ibm.com/ Eric Farman (7): vfio/ccw: create a parent struct vfio/ccw: remove private->sch vfio/ccw: move private initialization to callback vfio/ccw: move private to mdev lifecycle vfio/ccw: remove release completion vfio/ccw: replace vfio_init_device with _alloc_ vfio: Remove vfio_free_device drivers/gpu/drm/i915/gvt/kvmgt.c | 1 - drivers/s390/cio/vfio_ccw_chp.c | 5 +- drivers/s390/cio/vfio_ccw_drv.c | 174 +++++++++++--------------- drivers/s390/cio/vfio_ccw_fsm.c | 27 ++-- drivers/s390/cio/vfio_ccw_ops.c | 107 +++++++++++----- drivers/s390/cio/vfio_ccw_private.h | 37 ++++-- drivers/s390/crypto/vfio_ap_ops.c | 6 - drivers/vfio/fsl-mc/vfio_fsl_mc.c | 1 - drivers/vfio/pci/vfio_pci_core.c | 1 - drivers/vfio/platform/vfio_amba.c | 1 - drivers/vfio/platform/vfio_platform.c | 1 - drivers/vfio/vfio_main.c | 32 ++--- include/linux/vfio.h | 3 - samples/vfio-mdev/mbochs.c | 1 - samples/vfio-mdev/mdpy.c | 1 - samples/vfio-mdev/mtty.c | 1 - 16 files changed, 197 insertions(+), 202 deletions(-) Acked-by: Alex Williamson