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

Zhenyu Wang zhenyuw at linux.intel.com
Tue Feb 22 14:41:52 UTC 2022


On 2022.02.22 06:46:02 -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.
> 
> 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 | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index 20b82fb036f8..306b394848b0 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -186,9 +186,24 @@ 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,

Shouldn't that be included in gvt_type_attrs[] as well?
-------------- 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/20220222/5d77883b/attachment.sig>


More information about the intel-gvt-dev mailing list