mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
nodedev: detect AP matrix device
Add support for AP matrix device in libvirt node device driver. https://www.kernel.org/doc/html/latest/s390/vfio-ap.html#the-design 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:
parent
d2c731c9e2
commit
2f984adf2d
@ -89,6 +89,7 @@
|
||||
<ref name="capvdpa"/>
|
||||
<ref name="capapcard"/>
|
||||
<ref name="capapqueue"/>
|
||||
<ref name="capapmatrix"/>
|
||||
</choice>
|
||||
</element>
|
||||
</define>
|
||||
@ -691,6 +692,12 @@
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='capapmatrix'>
|
||||
<attribute name='type'>
|
||||
<value>ap_matrix</value>
|
||||
</attribute>
|
||||
</define>
|
||||
|
||||
<define name="address">
|
||||
<element name="address">
|
||||
<attribute name="domain"><ref name="hexuint"/></attribute>
|
||||
|
@ -69,6 +69,7 @@ VIR_ENUM_IMPL(virNodeDevCap,
|
||||
"vdpa",
|
||||
"ap_card",
|
||||
"ap_queue",
|
||||
"ap_matrix",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virNodeDevNetCap,
|
||||
@ -665,6 +666,7 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
|
||||
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
||||
case VIR_NODE_DEV_CAP_FC_HOST:
|
||||
case VIR_NODE_DEV_CAP_VPORTS:
|
||||
case VIR_NODE_DEV_CAP_AP_MATRIX:
|
||||
case VIR_NODE_DEV_CAP_LAST:
|
||||
break;
|
||||
}
|
||||
@ -2077,6 +2079,9 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
||||
ret = virNodeDevCapAPQueueParseXML(ctxt, def, node,
|
||||
&caps->data.ap_queue);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_AP_MATRIX:
|
||||
ret = 0;
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
||||
case VIR_NODE_DEV_CAP_FC_HOST:
|
||||
case VIR_NODE_DEV_CAP_VPORTS:
|
||||
@ -2398,6 +2403,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
|
||||
virMediatedDeviceTypeFree(data->ccw_dev.mdev_types[i]);
|
||||
VIR_FREE(data->ccw_dev.mdev_types);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_AP_MATRIX:
|
||||
VIR_FREE(data->ap_matrix.addr);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
||||
case VIR_NODE_DEV_CAP_DRM:
|
||||
case VIR_NODE_DEV_CAP_FC_HOST:
|
||||
@ -2467,6 +2475,7 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def)
|
||||
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;
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ typedef enum {
|
||||
VIR_NODE_DEV_CAP_VDPA, /* vDPA device */
|
||||
VIR_NODE_DEV_CAP_AP_CARD, /* s390 AP Card device */
|
||||
VIR_NODE_DEV_CAP_AP_QUEUE, /* s390 AP Queue */
|
||||
VIR_NODE_DEV_CAP_AP_MATRIX, /* s390 AP Matrix device */
|
||||
|
||||
VIR_NODE_DEV_CAP_LAST
|
||||
} virNodeDevCapType;
|
||||
@ -304,6 +305,12 @@ struct _virNodeDevCapAPQueue {
|
||||
unsigned int ap_domain;
|
||||
};
|
||||
|
||||
typedef struct _virNodeDevCapAPMatrix virNodeDevCapAPMatrix;
|
||||
typedef virNodeDevCapAPMatrix *virNodeDevCapAPMatrixPtr;
|
||||
struct _virNodeDevCapAPMatrix {
|
||||
char *addr;
|
||||
};
|
||||
|
||||
typedef struct _virNodeDevCapData virNodeDevCapData;
|
||||
typedef virNodeDevCapData *virNodeDevCapDataPtr;
|
||||
struct _virNodeDevCapData {
|
||||
@ -325,6 +332,7 @@ struct _virNodeDevCapData {
|
||||
virNodeDevCapVDPA vdpa;
|
||||
virNodeDevCapAPCard ap_card;
|
||||
virNodeDevCapAPQueue ap_queue;
|
||||
virNodeDevCapAPMatrix ap_matrix;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -719,6 +719,7 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj,
|
||||
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;
|
||||
}
|
||||
|
@ -1234,6 +1234,19 @@ udevProcessAPQueue(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
udevProcessAPMatrix(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.
|
||||
*/
|
||||
def->name = g_strdup("ap_matrix");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
udevGetDeviceNodes(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
@ -1319,6 +1332,8 @@ udevGetDeviceType(struct udev_device *device,
|
||||
*type = VIR_NODE_DEV_CAP_CSS_DEV;
|
||||
else if (STREQ_NULLABLE(subsystem, "vdpa"))
|
||||
*type = VIR_NODE_DEV_CAP_VDPA;
|
||||
else if (STREQ_NULLABLE(subsystem, "matrix"))
|
||||
*type = VIR_NODE_DEV_CAP_AP_MATRIX;
|
||||
|
||||
VIR_FREE(subsystem);
|
||||
}
|
||||
@ -1371,6 +1386,8 @@ udevGetDeviceDetails(struct udev_device *device,
|
||||
return udevProcessAPCard(device, def);
|
||||
case VIR_NODE_DEV_CAP_AP_QUEUE:
|
||||
return udevProcessAPQueue(device, def);
|
||||
case VIR_NODE_DEV_CAP_AP_MATRIX:
|
||||
return udevProcessAPMatrix(def);
|
||||
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
||||
case VIR_NODE_DEV_CAP_SYSTEM:
|
||||
case VIR_NODE_DEV_CAP_FC_HOST:
|
||||
|
@ -473,6 +473,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
|
||||
case VIR_NODE_DEV_CAP_AP_QUEUE:
|
||||
flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE;
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_AP_MATRIX:
|
||||
case VIR_NODE_DEV_CAP_LAST:
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user