Skip to content

Commit 2d87213

Browse files
Jason J. HerneVasily Gorbik
authored andcommitted
s390/vfio-ap: Driver feature advertisement
Advertise features of the driver for the benefit of automated tooling like Libvirt and mdevctl. Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com> Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Link: https://lore.kernel.org/r/20240916120123.11484-1-jjherne@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent d714abe commit 2d87213

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

Documentation/arch/s390/vfio-ap.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,36 @@ the vfio_ap mediated device to which it is assigned as long as each new APQN
999999
resulting from plugging it in references a queue device bound to the vfio_ap
10001000
device driver.
10011001

1002+
Driver Features
1003+
===============
1004+
The vfio_ap driver exposes a sysfs file containing supported features.
1005+
This exists so third party tools (like Libvirt and mdevctl) can query the
1006+
availability of specific features.
1007+
1008+
The features list can be found here: /sys/bus/matrix/devices/matrix/features
1009+
1010+
Entries are space delimited. Each entry consists of a combination of
1011+
alphanumeric and underscore characters.
1012+
1013+
Example:
1014+
cat /sys/bus/matrix/devices/matrix/features
1015+
guest_matrix dyn ap_config
1016+
1017+
the following features are advertised:
1018+
1019+
---------------+---------------------------------------------------------------+
1020+
| Flag | Description |
1021+
+==============+===============================================================+
1022+
| guest_matrix | guest_matrix attribute exists. It reports the matrix of |
1023+
| | adapters and domains that are or will be passed through to a |
1024+
| | guest when the mdev is attached to it. |
1025+
+--------------+---------------------------------------------------------------+
1026+
| dyn | Indicates hot plug/unplug of AP adapters, domains and control |
1027+
| | domains for a guest to which the mdev is attached. |
1028+
+------------+-----------------------------------------------------------------+
1029+
| ap_config | ap_config interface for one-shot modifications to mdev config |
1030+
+--------------+---------------------------------------------------------------+
1031+
10021032
Limitations
10031033
===========
10041034
Live guest migration is not supported for guests using AP devices without

drivers/s390/crypto/vfio_ap_drv.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ MODULE_LICENSE("GPL v2");
2626
struct ap_matrix_dev *matrix_dev;
2727
debug_info_t *vfio_ap_dbf_info;
2828

29+
static ssize_t features_show(struct device *dev, struct device_attribute *attr, char *buf)
30+
{
31+
return sysfs_emit(buf, "guest_matrix hotplug ap_config\n");
32+
}
33+
static DEVICE_ATTR_RO(features);
34+
35+
static struct attribute *matrix_dev_attrs[] = {
36+
&dev_attr_features.attr,
37+
NULL,
38+
};
39+
ATTRIBUTE_GROUPS(matrix_dev);
40+
2941
/* Only type 10 adapters (CEX4 and later) are supported
3042
* by the AP matrix device driver
3143
*/
@@ -68,6 +80,7 @@ static struct device_driver matrix_driver = {
6880
.name = "vfio_ap",
6981
.bus = &matrix_bus,
7082
.suppress_bind_attrs = true,
83+
.dev_groups = matrix_dev_groups,
7184
};
7285

7386
static int vfio_ap_matrix_dev_create(void)

0 commit comments

Comments
 (0)