[PATCH] drm/i915/gvt: add the missing mdev attribute "name"

Zhenyu Wang zhenyuw at linux.intel.com
Wed Feb 23 08:43:18 UTC 2022


On 2022.02.22 10:05:32 -0500, Zhi Wang wrote:
> The mdev attribute "name" is required by some middle software, e.g.
> KubeVirt, an open source SW that manages VM on Kubernetes cluster uses
> the mdev sysfs directory/file structure to discover mediated device in
> nodes in the cluster.
> 
> v2:
> 
> - Fix the missing defination in gvt_type_attrs. (Zhenyu)
> 
> Cc: Zhenyu Wang <zhenyuw at linux.intel.com>
> Cc: Hui Chun Ong <hui.chun.ong at intel.com>
> Cc: Terrence Xu <terrence.xu at intel.com>
> Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/kvmgt.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index 20b82fb036f8..da9d9f05985f 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -186,14 +186,30 @@ static ssize_t description_show(struct mdev_type *mtype,
>  		       type->weight);
>  }
>  
> +static ssize_t name_show(struct mdev_type *mtype,
> +			       struct mdev_type_attribute *attr, char *buf)
> +{
> +	struct intel_vgpu_type *type;
> +	struct intel_gvt *gvt = kdev_to_i915(mtype_get_parent_dev(mtype))->gvt;
> +
> +	type = &gvt->types[mtype_get_type_group_id(mtype)];
> +	if (!type)
> +		return 0;
> +
> +	return sprintf(buf, "%s\n", type->name);
> +}
> +
> +
>  static MDEV_TYPE_ATTR_RO(available_instances);
>  static MDEV_TYPE_ATTR_RO(device_api);
>  static MDEV_TYPE_ATTR_RO(description);
> +static MDEV_TYPE_ATTR_RO(name);
>  
>  static struct attribute *gvt_type_attrs[] = {
>  	&mdev_type_attr_available_instances.attr,
>  	&mdev_type_attr_device_api.attr,
>  	&mdev_type_attr_description.attr,
> +	&mdev_type_attr_name.attr,
>  	NULL,
>  };
>  

Reviewed-by: Zhenyu Wang <zhenyuw at linux.intel.com>

Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20220223/39c8d9c6/attachment.sig>


More information about the intel-gvt-dev mailing list