Re: [PATCH v4 3/6] vfio/mdev: Add "aggregated_instances" attribute for supported mdev device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 26 Nov 2018 16:48:53 +0800
Zhenyu Wang <zhenyuw@xxxxxxxxxxxxxxx> wrote:

> For mdev device created by "aggregate" parameter, this creates new mdev
> device attribute "aggregated_instances" to show number of aggregated
> instances allocated.
> 
> v2:
> - change attribute name as "aggregated_instances"
> 
> v3:
> - create only for aggregated allocation
> 
> Cc: Kirti Wankhede <kwankhede@xxxxxxxxxx>
> Cc: Alex Williamson <alex.williamson@xxxxxxxxxx>
> Cc: Kevin Tian <kevin.tian@xxxxxxxxx>
> Cc: Cornelia Huck <cohuck@xxxxxxxxxx>
> Signed-off-by: Zhenyu Wang <zhenyuw@xxxxxxxxxxxxxxx>
> ---
>  drivers/vfio/mdev/mdev_sysfs.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/vfio/mdev/mdev_sysfs.c b/drivers/vfio/mdev/mdev_sysfs.c
> index a329d6ab6cb9..f03bdfbf5a42 100644
> --- a/drivers/vfio/mdev/mdev_sysfs.c
> +++ b/drivers/vfio/mdev/mdev_sysfs.c
> @@ -292,7 +292,17 @@ static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
>  	return count;
>  }
>  
> +static ssize_t
> +aggregated_instances_show(struct device *dev,
> +			  struct device_attribute *attr,
> +			  char *buf)
> +{
> +	struct mdev_device *mdev = to_mdev_device(dev);
> +	return sprintf(buf, "%u\n", mdev->type_instances);
> +}
> +
>  static DEVICE_ATTR_WO(remove);

Cosmetic: please move this up again to right below the implementation
of the remove attribute :)

> +static DEVICE_ATTR_RO(aggregated_instances);
>  
>  static const struct attribute *mdev_device_attrs[] = {
>  	&dev_attr_remove.attr,



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux