From patchwork Tue Apr 6 19:40:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 12187935 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D3D7C433B4 for ; Wed, 7 Apr 2021 12:15:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0671161139 for ; Wed, 7 Apr 2021 12:15:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0671161139 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E75D6E152; Wed, 7 Apr 2021 12:15:32 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2063.outbound.protection.outlook.com [40.107.236.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id 16A9B6E8AF; Tue, 6 Apr 2021 20:07:25 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hKaYyFNLaNQOZEemqx+qlQ2n20kZ67guoxSFxYDvegm5fE0bFGBLZ0aPdJdhUpLMyFoogLJN3ZlL7UuRyQx2UTdHMAvYM2lUoDZHPN7QSHrGzDXa/O1QwmrFH8dtPmhNtJ0MO/J0K7QuZ+Z0C4kziNl78juXYLgiSaRjCiAfjWr+XmuMYMk+w31ax8EE57R55+4pvhkGRZRdUs0aPzrlOyqT9mtMtzuXkkO2NSl59bj4nP1yANpgYOXJ5KLbcjzhk1xrxhjFjJ6aQCDG5WYIM74JmoVz4QRqZTX54LQZqcErhS+eQ9GaNYl1a+xqcHOwaM5nALTuSbrSFegOfrslkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pQz5KvjjX7thR+DVlFOXa9VeJSk7pPDIRbsC+KXJL14=; b=ClC5PWnLYp1OBqo0VtByrW2B4eTLQGly9ybavPgbQtTn61nrG6XrpQYyDg4POULQIR/seiCblMTeRSMTnWuWRWKQt3hulpv0D3CqvuoqIp/bNdLhnmXpnwsMR2e8XfLI0GB0DVClyf4w32bBSaiCqdixT9WNiVXRDtOCbDU84JjDRcgiNawDcwnQTIlb2KTZW8ig3pAkXug4bLHNV5OZ5HHSCVap5l8cq4hlDFVYUnDD0XsnOPHufe4cjh3Nw33E0FxgEBxlQijXZO+WB69u2g/6bPg0LqgNz3g+/4OWzlc7g+bYCIjVF2WTEfM64CFh9EggBZrZG4V+JBK2eIA8Zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pQz5KvjjX7thR+DVlFOXa9VeJSk7pPDIRbsC+KXJL14=; b=QfFr32B9vMcAbiYck7Hr/4oP8Mc2U/jn6+qRnC0xkB739fliwPRUqs/xlHedbgTEZQ8/r1Z7qhUCOBvJoam04j7dSGNxZjJFp+y7FldSsX23a3AuB99OAAlKHQA6hWEGlHP1CxDR5HXxeQ1WIhvPIN8IacEZd9MWUo4O1ZAqbsTIMCiXSUdPTaelIL0L0N/MtbZ9o0ZVcIXSi9hlWjTmkN4zrInIub89XjhKDP9XS2FRij+v6nlNVrxMFo+8CyvKCSzHYadtJOAz60meRfr+WEHao+Vzb2ePk2RRtwN+AwNhm7LW+EzaOrzaawCTvujfojVv7cto+jEudje2L0dxTw== Authentication-Results: linux.ie; dkim=none (message not signed) header.d=none;linux.ie; dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) by DM5PR12MB1883.namprd12.prod.outlook.com (2603:10b6:3:113::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 20:07:23 +0000 Received: from DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87]) by DM6PR12MB3834.namprd12.prod.outlook.com ([fe80::1c62:7fa3:617b:ab87%6]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 20:07:23 +0000 From: Jason Gunthorpe To: David Airlie , Tony Krowiak , Alex Williamson , Christian Borntraeger , Daniel Vetter , dri-devel@lists.freedesktop.org, Eric Farman , Harald Freudenberger , Vasily Gorbik , Heiko Carstens , intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , kvm@vger.kernel.org, Kirti Wankhede , linux-s390@vger.kernel.org, Peter Oberparleiter , Halil Pasic , Pierre Morel , Rodrigo Vivi , Vineeth Vijayan , Zhenyu Wang , Zhi Wang Date: Tue, 6 Apr 2021 16:40:40 -0300 Message-Id: <17-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com> In-Reply-To: <0-v2-d36939638fc6+d54-vfio2_jgg@nvidia.com> References: X-Originating-IP: [142.162.115.133] X-ClientProxiedBy: BL0PR03CA0027.namprd03.prod.outlook.com (2603:10b6:208:2d::40) To DM6PR12MB3834.namprd12.prod.outlook.com (2603:10b6:5:14a::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (142.162.115.133) by BL0PR03CA0027.namprd03.prod.outlook.com (2603:10b6:208:2d::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 20:07:22 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lTrZ4-001mXu-G3; Tue, 06 Apr 2021 16:40:42 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c16b43ec-dcd5-4cc6-a792-08d8f9379728 X-MS-TrafficTypeDiagnostic: DM5PR12MB1883: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 12ZzVD5Lr87fpvFfZOj3vtlSDl8Zw/a4G1+IEhgYYx2uhlo0YZfJh1FVE+rR0GAcg/tFihwHSCNSUs3m7YDiMrV8vqtwNALKWjroboaAyhpYICb+MctRc9lmDkXUIhQLUN1dhJUtTcYmlJPAs4ukBUHivJ/ttOL9bxQomEyY3ZZFdKPzZFWwioqsBwkcyXzcsA4sNTiZ+NBdWIVFmwThlvc1NnR6pTYFEobcv4zJ6XY40tLFGf+48Hn/w9FXZ0wrdWc03EaG/jhP7T2HSf1/m2ulYxFy9CWUHfK1wOwN5dvyCXzT6nIVfjZqyM25O0GQNy6+pBGWob2abtRNjPdXcmetBA9/BrIM/FTd7XDpaNusIR8GxfakZFzQuGMhlXHP5TxVW/7WRmyWPGEXnzm5uUmgpaJLLuowJr2Ob57xyacSwoPIqyhhdj77xLEuxU263RP/Fc8OSXSppd03P7+Ut0GLznHD9LBnx9EzwlKUYaVpHYFVOkYRv/cR7B65/wYNMtnezy6ewoGs11seYrzTGY7cXzH4uBBiSsZts8Upj4WP8XxqEaW5Bejt01Iw8vfUaC/gyBFjC28Od+c4t7MvA2F5fE2k/ZoVI6gGp5t97GSnB78EIeDeALfADmUhCS7OYCdiBOScG3VnAdJY5Z6BVNK5Q2Zns7zoWdyLdT5C0xAnaIyV8VClZjtZLILYtoL4 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3834.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(136003)(39860400002)(366004)(346002)(396003)(38100700001)(186003)(86362001)(8676002)(8936002)(2906002)(2616005)(316002)(7416002)(54906003)(478600001)(110136005)(9746002)(83380400001)(26005)(66556008)(5660300002)(66946007)(107886003)(9786002)(4326008)(36756003)(921005)(426003)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: GGibTQ8RLskmI4XO6PdQDP97SIeXXTeK0Sw6sDdYWElf2x/uRfvrwXXYvqifgMsBqRb2mvrYv/eautLS5iVXPPvs1HB/4/D/c7mdVt7CMYceM+TnvNY9rFDMa4N2JzRIz+scV+xwfkG1FeVCvP8OWIx4aa9wWJQtN1eTl46TBejt4gCicnsGBll7dvpne4Wsm1ZJwLYKboKQiHM4pKUZ/MSzztdJKsjb4mlfpndYpGu0W6RNy1g6u2iGgXnTf83Tw1kgUv28AN2oTnYooIpj7WPe5tDVcuBseVp82A7eXnaLkyLsZ2aBfHYUH6dVJlCfjapYnZ6UGsllrD5DnBcdZ1TL5TggWpwPuaIJmmdgfYgCGcU/1c0D8499ijVAi7B+12XBbA+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AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 20:07:23.1174 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EAt7p3spiPjS8SsQNFCHDz03CNjrL6DLOxk65OD541zQJcWthTd27IOHWxHpQ0Sw X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1883 X-Mailman-Approved-At: Wed, 07 Apr 2021 12:15:31 +0000 Subject: [Intel-gfx] [PATCH v2 17/18] vfio/mdev: Remove kobj from mdev_parent_ops->create() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Gurtovoy , "Raj, Ashok" , Cornelia Huck , Tarun Gupta , Dan Williams , Leon Romanovsky , Christoph Hellwig Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The kobj here is a type-erased version of mdev_type, which is already stored in the struct mdev_device being passed in. It was only ever used to compute the type_group_id, which is now extracted directly from the mdev. Reviewed-by: Kevin Tian Reviewed-by: Cornelia Huck Reviewed-by: Christoph Hellwig Signed-off-by: Jason Gunthorpe --- drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +- drivers/s390/cio/vfio_ccw_ops.c | 2 +- drivers/s390/crypto/vfio_ap_ops.c | 2 +- drivers/vfio/mdev/mdev_core.c | 2 +- include/linux/mdev.h | 3 +-- samples/vfio-mdev/mbochs.c | 2 +- samples/vfio-mdev/mdpy.c | 2 +- samples/vfio-mdev/mtty.c | 2 +- 8 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index 16e1e4a38aa1f6..6bf176e8426e63 100644 --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c @@ -689,7 +689,7 @@ static void kvmgt_put_vfio_device(void *vgpu) vfio_device_put(vdev->vfio_device); } -static int intel_vgpu_create(struct kobject *kobj, struct mdev_device *mdev) +static int intel_vgpu_create(struct mdev_device *mdev) { struct intel_vgpu *vgpu = NULL; struct intel_vgpu_type *type; diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c index 767ac41686fe2f..10407cf67583c6 100644 --- a/drivers/s390/cio/vfio_ccw_ops.c +++ b/drivers/s390/cio/vfio_ccw_ops.c @@ -110,7 +110,7 @@ static struct attribute_group *mdev_type_groups[] = { NULL, }; -static int vfio_ccw_mdev_create(struct kobject *kobj, struct mdev_device *mdev) +static int vfio_ccw_mdev_create(struct mdev_device *mdev) { struct vfio_ccw_private *private = dev_get_drvdata(mdev_parent_dev(mdev)); diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 1ffdd411201cd6..d319152dd484a2 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -322,7 +322,7 @@ static void vfio_ap_matrix_init(struct ap_config_info *info, matrix->adm_max = info->apxa ? info->Nd : 15; } -static int vfio_ap_mdev_create(struct kobject *kobj, struct mdev_device *mdev) +static int vfio_ap_mdev_create(struct mdev_device *mdev) { struct ap_matrix_mdev *matrix_mdev; diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c index 5ae06f951a0998..10eff33ce1f263 100644 --- a/drivers/vfio/mdev/mdev_core.c +++ b/drivers/vfio/mdev/mdev_core.c @@ -286,7 +286,7 @@ int mdev_device_create(struct mdev_type *type, const guid_t *uuid) goto out_put_device; } - ret = parent->ops->create(&type->kobj, mdev); + ret = parent->ops->create(mdev); if (ret) goto out_unlock; diff --git a/include/linux/mdev.h b/include/linux/mdev.h index 41e91936522394..c3a800051d6146 100644 --- a/include/linux/mdev.h +++ b/include/linux/mdev.h @@ -61,7 +61,6 @@ unsigned int mtype_get_type_group_id(struct kobject *mtype_kobj); * @create: Called to allocate basic resources in parent device's * driver for a particular mediated device. It is * mandatory to provide create ops. - * @kobj: kobject of type for which 'create' is called. * @mdev: mdev_device structure on of mediated device * that is being created * Returns integer: success (0) or error (< 0) @@ -107,7 +106,7 @@ struct mdev_parent_ops { const struct attribute_group **mdev_attr_groups; struct attribute_group **supported_type_groups; - int (*create)(struct kobject *kobj, struct mdev_device *mdev); + int (*create)(struct mdev_device *mdev); int (*remove)(struct mdev_device *mdev); int (*open)(struct mdev_device *mdev); void (*release)(struct mdev_device *mdev); diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index a1af30df10a2ee..ac4d0dc2490705 100644 --- a/samples/vfio-mdev/mbochs.c +++ b/samples/vfio-mdev/mbochs.c @@ -506,7 +506,7 @@ static int mbochs_reset(struct mdev_device *mdev) return 0; } -static int mbochs_create(struct kobject *kobj, struct mdev_device *mdev) +static int mbochs_create(struct mdev_device *mdev) { const struct mbochs_type *type = &mbochs_types[mdev_get_type_group_id(mdev)]; diff --git a/samples/vfio-mdev/mdpy.c b/samples/vfio-mdev/mdpy.c index 08c15f9f06a880..da88fd7dd42329 100644 --- a/samples/vfio-mdev/mdpy.c +++ b/samples/vfio-mdev/mdpy.c @@ -216,7 +216,7 @@ static int mdpy_reset(struct mdev_device *mdev) return 0; } -static int mdpy_create(struct kobject *kobj, struct mdev_device *mdev) +static int mdpy_create(struct mdev_device *mdev) { const struct mdpy_type *type = &mdpy_types[mdev_get_type_group_id(mdev)]; diff --git a/samples/vfio-mdev/mtty.c b/samples/vfio-mdev/mtty.c index 191a587a8d5ab1..f2e36c06ac6aa2 100644 --- a/samples/vfio-mdev/mtty.c +++ b/samples/vfio-mdev/mtty.c @@ -708,7 +708,7 @@ static ssize_t mdev_access(struct mdev_device *mdev, u8 *buf, size_t count, return ret; } -static int mtty_create(struct kobject *kobj, struct mdev_device *mdev) +static int mtty_create(struct mdev_device *mdev) { struct mdev_state *mdev_state; int nr_ports = mdev_get_type_group_id(mdev) + 1;