From patchwork Tue Mar 23 17:55:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 12158913 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.6 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 autolearn=ham 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 8AFF7C433C1 for ; Tue, 23 Mar 2021 17:55:46 +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 3ADBA619B8 for ; Tue, 23 Mar 2021 17:55:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3ADBA619B8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37ABE6EC62; Tue, 23 Mar 2021 17:55:44 +0000 (UTC) Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690064.outbound.protection.outlook.com [40.107.69.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id C0EB86EC62; Tue, 23 Mar 2021 17:55:40 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ltzQOiW522Y4dkHdAL3BqxM6IIQPyb09MgiEHo7tyal0IA46LbeAr7XMu6QPlixNIphmzSyEYOq+7J2xw7xbTER6Gppw+h4ODQl9uaHPmmpgN+JmxzU8xLY51uW90yoMm9c19dYrdBeeDYmQW7gIlMlaxxKh6AxxhAXTCj62A17/RyQQKY+eRY0taNaCp5utg0+REaxjuBjcXiA+W2s3m4x/xUsdBmAHMeNrux7GkI7dmPZ3TfYUzSkfoQhkaVr/LJrk9Mex20bsmpSaET7bsnAUIPmHigqF80PZuWoNYBMtJ8UtFmnLFarfDF/8bkZjEhQtMnaCD6LC6FuK9q2mlA== 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=yhnSqc0n+mNNMJCgBL2mzcTzmW+ce6iSPtXfQNgWPcA=; b=kkjWhAPK0qyw7g0ghPa6LwDdqqLW9cIDZiI9x6lsqpNF1xD3dJlQkYWO5XQ6Ro/s/x1n+cOUVQ6NZqE3BDa/r1EO7bo7uNIyn0iqFeq4ApCSLlSAxDy1cNMrheQkKL6bFCcoA4lWWZ5YHRa3mlB/colmFwwVNtNYGq3sjRzRzx6nenL8Lq7Nlm24ozhCjS7Bu0fPY35S3f5U5MNSdBVZN73eYmGYizcFZGXR+I44menAB4FZBjby0rcqfwG6qN3DdXWK+DO+9rW9O06mNFjZ3ao8KMyqSaGJc5JPqLoMIuvWv3PtsJkxoG/ir7ssx6HO7K33zXltaQDYlz0sHzvrDQ== 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=yhnSqc0n+mNNMJCgBL2mzcTzmW+ce6iSPtXfQNgWPcA=; b=NVeI1Jdmlz6Bp3sLOcPO5DnlwWVTjuKp4ow02VJAWvFNifTU2x9gm/wIWf0Tq1OTtAjk9jGxtBQdkbVRaaY4tHeeFiyT7Zj5oh4besZrQo5+s3EO8R9Q1tNGzAc1t7LXcMoGKLXkLqCgYuoCe2VeIxITGUkaIgHoS3ne48ILKTKQHIESv/jCXdskcTKxKazbXVibG+U65U4fsxPbW3wa/hawShKS73JitFw34SI1J6EulLYG+nnxhycbvKIjgjath5aKvNCgUN08hL9ncMdemQNfoHOljOJHzxkI7pFOZhwf1dTqDwVmMlwduJtYZwQSeOXml06jz5CCJVx8FYpNQA== 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 DM6PR12MB3932.namprd12.prod.outlook.com (2603:10b6:5:1c1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.23; Tue, 23 Mar 2021 17:55:39 +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.3955.027; Tue, 23 Mar 2021 17:55:39 +0000 From: Jason Gunthorpe To: David Airlie , Tony Krowiak , Alex Williamson , Christian Borntraeger , Cornelia Huck , 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 Subject: [PATCH 17/18] vfio/mdev: Remove kobj from mdev_parent_ops->create() Date: Tue, 23 Mar 2021 14:55:34 -0300 Message-Id: <17-v1-7dedf20b2b75+4f785-vfio2_jgg@nvidia.com> In-Reply-To: <0-v1-7dedf20b2b75+4f785-vfio2_jgg@nvidia.com> References: X-Originating-IP: [206.223.160.26] X-ClientProxiedBy: BL0PR0102CA0029.prod.exchangelabs.com (2603:10b6:207:18::42) 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 (206.223.160.26) by BL0PR0102CA0029.prod.exchangelabs.com (2603:10b6:207:18::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Tue, 23 Mar 2021 17:55:37 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1lOlFf-001chT-Sg; Tue, 23 Mar 2021 14:55:35 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6fe83c2a-9440-40b3-3c68-08d8ee24dd7a X-MS-TrafficTypeDiagnostic: DM6PR12MB3932: 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: cvWuYBLSeBhpQK5P6xQZWZ4Jj15CkkIG6HzQxVExVZMFR/F+vF4uJRtuNxkS66qE5t1XQNA/c5cyP4Q6VGrFbXilKVwe5e8BrHfnqca0n76h0cyj3RDC4O03khjox+sM2DFC7NKgGzQJyuQobmJpZcBFon1Hx7gf8Pu/8bUjvkZcsdFDmo+SkURY1ogIz0TYN5LpySgkEhcp6I7RUBtifuZ7VERjut7LDRQN6Qd8DQXcJPJZr8MIe7w1og9ubT4GoAHzi2NGaI9+3Tyi1vT6pBTVVnAiA9Vl7DRnpwL3RE3EQgi3tvSQV4aAAEXMG3P6IJH9nh3tx06c0JHxaD9+yFekGhsOcNg+xv/r11myJ7/2yvyeIWHiA3NJX1lOsYUbGRlmGEB/I+QlGGwjy+2odiR4mgXT0RTpaGZdib8moLpnrbNqqQ4qxhkqwSJNQhNrYurx9BGYouXIZeVS2SlAJxj/Pd6hoGbDtLLNXBruTQ5GlsvwE5H5ILFkq3ydO7rGoA6ibbwjeia6YuvBi3VWMo/dS/Xt5rdiqYppbNuk8q1A0Wibfl99r6efol4/d3PgZiUrjLPnOxUECJzErEqcVMxkLhz2TAPwn3BhcmI84aBL3pgsHgnrx+7ir8tT1JzZ6AO5J8FFbAOF8obRBzhkXMtSeEJeWNnStFkTGz/pQPqDqcTbQ6uYYHgdFqcmrGnn 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)(366004)(39840400004)(396003)(346002)(2616005)(9786002)(478600001)(66556008)(86362001)(8936002)(107886003)(66946007)(83380400001)(9746002)(66476007)(26005)(921005)(5660300002)(54906003)(8676002)(316002)(2906002)(4326008)(186003)(38100700001)(426003)(7416002)(36756003)(110136005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ytix0lNIz13iTRqUP3z9vwM9VyqRrkvZYjLUnAODMzzFJRMyb2FFDFm0acciUucxU2EPVKsbbP97glCbnrx9/IkC1/5ZwyfEmZJ1hTGcDWL7Mm3D/kyzRVimyJ7HQeADExQqXqrs+fA4fccy8WqtRASdNo2HUNz+C7nPMHMCh4/jCB7zlgL0qOBzZOPcRZxbtWDCoWTlwKvgqjQpJOWFitmy4K+d3cdbkm47FKP0Rpe/9mp2mwW5YDOSgnHLFUGw5TsDmYRqOTyQ7vVkVrBp3+a6bU2Gpim2Qh3G5WtW6fjXxxTAqvvwdFSeUb/0cjsI2h/H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ee24dd7a X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3834.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2021 17:55:37.7102 (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: vbJDDUsMiQ/E56qJl3xN/slkyqbUaugEScUmOz9kV9BXHNPtWzaaOMel2FJTFkH2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3932 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Gurtovoy , "Raj, Ashok" , Tarun Gupta , Dan Williams , Leon Romanovsky , Christoph Hellwig Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. Signed-off-by: Jason Gunthorpe Reviewed-by: Kevin Tian Reviewed-by: Cornelia Huck --- 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 68106be4ba7a19..06a82ec136080c 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 41fc2e4135fe18..6d75ed07bcd49d 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 3ba5e9464b4d20..71455812cb84cf 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 mdev_fail; } - ret = parent->ops->create(&type->kobj, mdev); + ret = parent->ops->create(mdev); if (ret) goto ops_create_fail; 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;