node_device: mdev matrix support

Allow mdev devices to be created on the matrix device.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Shalini Chellathurai Saroja 2020-12-03 18:59:42 +01:00 committed by Erik Skultety
parent 09364608b4
commit a0ab006d5a
2 changed files with 10 additions and 3 deletions

View File

@ -662,6 +662,10 @@ nodeDeviceFindAddressByName(const char *name)
break;
}
case VIR_NODE_DEV_CAP_AP_MATRIX:
addr = g_strdup(caps->data.ap_matrix.addr);
break;
case VIR_NODE_DEV_CAP_SYSTEM:
case VIR_NODE_DEV_CAP_USB_DEV:
case VIR_NODE_DEV_CAP_USB_INTERFACE:
@ -680,7 +684,6 @@ nodeDeviceFindAddressByName(const char *name)
case VIR_NODE_DEV_CAP_VDPA:
case VIR_NODE_DEV_CAP_AP_CARD:
case VIR_NODE_DEV_CAP_AP_QUEUE:
case VIR_NODE_DEV_CAP_AP_MATRIX:
case VIR_NODE_DEV_CAP_LAST:
break;
}

View File

@ -1235,12 +1235,16 @@ udevProcessAPQueue(struct udev_device *device,
static int
udevProcessAPMatrix(virNodeDeviceDefPtr def)
udevProcessAPMatrix(struct udev_device *device,
virNodeDeviceDefPtr def)
{
/* Both udev_device_get_sysname and udev_device_get_subsystem return
* "matrix" for an AP matrix device, so in order to prevent confusion in
* naming, let's fallback to hardcoding the name.
*/
virNodeDevCapDataPtr data = &def->caps->data;
data->ap_matrix.addr = g_strdup(udev_device_get_sysname(device));
def->name = g_strdup("ap_matrix");
return 0;
@ -1387,7 +1391,7 @@ udevGetDeviceDetails(struct udev_device *device,
case VIR_NODE_DEV_CAP_AP_QUEUE:
return udevProcessAPQueue(device, def);
case VIR_NODE_DEV_CAP_AP_MATRIX:
return udevProcessAPMatrix(def);
return udevProcessAPMatrix(device, def);
case VIR_NODE_DEV_CAP_MDEV_TYPES:
case VIR_NODE_DEV_CAP_SYSTEM:
case VIR_NODE_DEV_CAP_FC_HOST: