1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

tests: adding vfio-ccw to nodedev tests

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Boris Fiuczynski 2022-02-04 16:32:17 +01:00 committed by Michal Privoznik
parent 37ce3da14e
commit 609836e2b2
8 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,5 @@
mdevctl \
start \
--parent=0.0.0052 \
--jsonfile=/dev/stdin \
--uuid=cc000052-9b13-9b13-9b13-cc23009b1326

View File

@ -0,0 +1 @@
{"mdev_type":"vfio_ccw-io","start":"manual"}

View File

@ -0,0 +1,5 @@
mdevctl \
define \
--parent=0.0.0052 \
--jsonfile=/dev/stdin \
--uuid=cc000052-9b13-9b13-9b13-cc23009b1326

View File

@ -0,0 +1 @@
{"mdev_type":"vfio_ccw-io","start":"manual"}

View File

@ -52,6 +52,15 @@
]
}
}
],
"0.0.0052": [
{
"cc000052-9b13-9b13-9b13-cc23009b1326": {
"mdev_type": "vfio_ccw-io",
"start": "manual",
"attrs": []
}
}
]
}
]

View File

@ -41,3 +41,12 @@
<attr name='assign_control_domain' value='4'/>
</capability>
</device>
<device>
<name>mdev_cc000052_9b13_9b13_9b13_cc23009b1326_0_0_0052</name>
<parent>css_0_0_0052</parent>
<capability type='mdev'>
<type id='vfio_ccw-io'/>
<uuid>cc000052-9b13-9b13-9b13-cc23009b1326</uuid>
<iommuGroup number='0'/>
</capability>
</device>

View File

@ -331,6 +331,32 @@ fakeMatrixDevice(void)
return def;
}
/* Add a fake css device that can be used as a parent device for mediated
* devices. For our purposes, it only needs to have a name that matches the
* parent of the mdev, and it needs the proper name
*/
static virNodeDeviceDef *
fakeCSSDevice(void)
{
virNodeDeviceDef *def = NULL;
virNodeDevCapCCW *css_dev;
def = g_new0(virNodeDeviceDef, 1);
def->caps = g_new0(virNodeDevCapsDef, 1);
def->name = g_strdup("css_0_0_0052");
def->parent = g_strdup("computer");
def->caps->data.type = VIR_NODE_DEV_CAP_CSS_DEV;
css_dev = &def->caps->data.ccw_dev;
css_dev->cssid = 0;
css_dev->ssid = 0;
css_dev->devno = 82;
return def;
}
static int
addDevice(virNodeDeviceDef *def)
{
@ -354,7 +380,8 @@ nodedevTestDriverAddTestDevices(void)
{
if (addDevice(fakeRootDevice()) < 0 ||
addDevice(fakePCIDevice()) < 0 ||
addDevice(fakeMatrixDevice()) < 0)
addDevice(fakeMatrixDevice()) < 0 ||
addDevice(fakeCSSDevice()) < 0)
return -1;
return 0;
@ -437,6 +464,7 @@ mymain(void)
DO_TEST_CREATE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366");
DO_TEST_CREATE("mdev_fedc4916_1ca8_49ac_b176_871d16c13076");
DO_TEST_CREATE("mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9");
DO_TEST_CREATE("mdev_cc000052_9b13_9b13_9b13_cc23009b1326");
/* Test mdevctl stop command, pass an arbitrary uuid */
DO_TEST_STOP("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366");
@ -449,6 +477,7 @@ mymain(void)
DO_TEST_DEFINE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366");
DO_TEST_DEFINE("mdev_fedc4916_1ca8_49ac_b176_871d16c13076");
DO_TEST_DEFINE("mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9");
DO_TEST_DEFINE("mdev_cc000052_9b13_9b13_9b13_cc23009b1326");
DO_TEST_UNDEFINE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366");

View File

@ -0,0 +1,8 @@
<device>
<name>mdev_cc000052_9b13_9b13_9b13_cc23009b1326</name>
<parent>css_0_0_0052</parent>
<capability type='mdev'>
<type id='vfio_ccw-io'/>
<uuid>cc000052-9b13-9b13-9b13-cc23009b1326</uuid>
</capability>
</device>