[Intel-gfx] [PATCH 17/18] vfio/mdev: Remove kobj from mdev_parent_ops->create()

Tian, Kevin kevin.tian at intel.com
Fri Mar 26 06:11:40 UTC 2021


> From: Jason Gunthorpe
> Sent: Wednesday, March 24, 2021 1:56 AM
> 
> 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 <jgg at nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian at intel.com>

> ---
>  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;
> --
> 2.31.0
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev


More information about the Intel-gfx mailing list