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

Ong, Hui Chun hui.chun.ong at intel.com
Thu Mar 3 06:47:22 UTC 2022


Hi,

Has this patch been accepted upstream? And which version of kernel?

Rgds
Hui Chun

-----Original Message-----
From: Zhenyu Wang <zhenyuw at linux.intel.com> 
Sent: Wednesday, February 23, 2022 4:43 PM
To: Zhi Wang <zhi.wang.linux at gmail.com>
Cc: Wang, Zhi A <zhi.a.wang at intel.com>; intel-gvt-dev at lists.freedesktop.org; Ong, Hui Chun <hui.chun.ong at intel.com>; Xu, Terrence <terrence.xu at intel.com>
Subject: Re: [PATCH] drm/i915/gvt: add the missing mdev attribute "name"

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!


More information about the intel-gvt-dev mailing list