[libvirt] [PATCH v2 1/1] Add attribute single_usage_restriction for mdev type-id

Kirti Wankhede
2018-10-08T20:10:17Z

Generally a single instance of mdev device, a share of physical device, is
assigned to user space application or a VM. There are cases when multiple
instances of mdev devices of same or different types are required by user
space application or VM. For example in case of vGPU, multiple mdev devices
of type which represents whole GPU can be assigned to one instance of
application or VM.

All types of mdev devices may not support assigning multiple mdev devices
to a user space application. In that case vendor driver can fail open()
call of mdev device. But there is no way to know User space application to
about the configuration supported by vendor driver.

To expose supported configuration, vendor driver should add
'single_usage_restriction' attribute to type-id directory. Returning Y for
this attribute indicates vendor driver has restriction of single mdev
device of particular <type-id> assigned to one user space application.
Returning N indicates that multiple mdev devices of particular <type-id>
can be assigned to one user space application.

User space application should read if 'single_usage_restriction' attibute
is present in <type-id> directory of all mdev devices which are going to be
used. If all read N then user space application can proceed with multiple
mdev devices.

This is optional and readonly attribute.

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: Neo Jia <cjia@nvidia.com>
---
Documentation/ABI/testing/sysfs-bus-vfio-mdev | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-vfio-mdev b/Documentation/ABI/testing/sysfs-bus-vfio-mdev
index 452dbe39270e..3aca352a70e5 100644
--- a/Documentation/ABI/testing/sysfs-bus-vfio-mdev
+++ b/Documentation/ABI/testing/sysfs-bus-vfio-mdev
@@ -85,6 +85,22 @@ Users:
a particular <type-id> that can help in understanding the
features provided by that type of mediated device.

+What: /sys/.../mdev_supported_types/<type-id>/single_usage_restriction
+Date: October 2018
+Contact: Kirti Wankhede <kwankhede@nvidia.com>
+Description:
+ Reading this attribute will return Y or N. Returning Y indicates
+ vendor driver has restriction of single mdev device of this
+ particular <type-id> assigned to one user space application.
+ Returning N indicates that multiple mdev devices of particular
+ <type-id> can be assigned to one user space application.
+ This is optional and readonly attribute.
+Users:
+ User space application should read if 'single_usage_restriction'
+ attibute is present in <type-id> directory of all mdev devices
+ which are going to be used. If all read N then user space
+ application can proceed with multiple mdev devices.
+
What: /sys/.../<device>/<UUID>/
Date: October 2016
Contact: Kirti Wankhede <kwankhede@nvidia.com>
--
2.7.0