[PATCH libvirt v4 09/12] node_device: refactor address retrieval of node device
Use switch statements instead of if-else condition in the method nodeDeviceFindAddressByName to retrieve address of a node device. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- src/node_device/node_device_driver.c | 30 ++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index f5ea973c..65c647f5 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -638,7 +638,8 @@ nodeDeviceFindAddressByName(const char *name) def = virNodeDeviceObjGetDef(dev); for (caps = def->caps; caps != NULL; caps = caps->next) { -if (caps->data.type == VIR_NODE_DEV_CAP_PCI_DEV) { +switch (caps->data.type) { +case VIR_NODE_DEV_CAP_PCI_DEV: { virPCIDeviceAddress pci_addr = { .domain = caps->data.pci_dev.domain, .bus = caps->data.pci_dev.bus, @@ -648,7 +649,9 @@ nodeDeviceFindAddressByName(const char *name) addr = virPCIDeviceAddressAsString(&pci_addr); break; -} else if (caps->data.type == VIR_NODE_DEV_CAP_CSS_DEV) { +} + +case VIR_NODE_DEV_CAP_CSS_DEV: { virDomainDeviceCCWAddress ccw_addr = { .cssid = caps->data.ccw_dev.cssid, .ssid = caps->data.ccw_dev.ssid, @@ -657,6 +660,29 @@ nodeDeviceFindAddressByName(const char *name) addr = virDomainCCWAddressAsString(&ccw_addr); break; +} + +case VIR_NODE_DEV_CAP_SYSTEM: +case VIR_NODE_DEV_CAP_USB_DEV: +case VIR_NODE_DEV_CAP_USB_INTERFACE: +case VIR_NODE_DEV_CAP_NET: +case VIR_NODE_DEV_CAP_SCSI_HOST: +case VIR_NODE_DEV_CAP_SCSI_TARGET: +case VIR_NODE_DEV_CAP_SCSI: +case VIR_NODE_DEV_CAP_STORAGE: +case VIR_NODE_DEV_CAP_FC_HOST: +case VIR_NODE_DEV_CAP_VPORTS: +case VIR_NODE_DEV_CAP_SCSI_GENERIC: +case VIR_NODE_DEV_CAP_DRM: +case VIR_NODE_DEV_CAP_MDEV_TYPES: +case VIR_NODE_DEV_CAP_MDEV: +case VIR_NODE_DEV_CAP_CCW_DEV: +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; } } -- 2.26.2
[PATCH libvirt v4 06/12] nodedev: detect AP matrix device
Add support for AP matrix device in libvirt node device driver. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- docs/schemas/nodedev.rng | 7 +++ src/conf/node_device_conf.c| 9 + src/conf/node_device_conf.h| 8 src/conf/virnodedeviceobj.c| 1 + src/node_device/node_device_udev.c | 13 + tools/virsh-nodedev.c | 1 + 6 files changed, 39 insertions(+) diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 60367653..1024ba59 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -89,6 +89,7 @@ + @@ -691,6 +692,12 @@ + + + ap_matrix + + + diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 01254a8f..d32a6afc 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -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; } diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index b580d6cf..b863653b 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -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; }; }; diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 691632c6..8fbef5f5 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -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; } diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 7883f23e..179793d8 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1234,6 +1234,15 @@ udevProcessAPQueue(struct udev_device *device, } +static int +udevProcessAPMatrix(virNodeDeviceDefPtr def) +{ +def->name = g_strdup("ap_matrix"); + +return 0; +} + + static int udevGetDeviceNodes(struct udev_device *device, virNodeDeviceDefPtr def) @@ -1319,6 +1328,8 @@ udevGetDeviceType(struct udev_device *device, *type = VIR_NODE_DEV_CAP_CSS_DEV; else if (STREQ_NULLABLE(subsystem, "vdpa")) *type = VIR_NODE_DEV_CAP_
[PATCH libvirt v4 07/12] tests: AP matrix node device
Add tests to verify libvirt node device driver support for AP matrix device. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- tests/nodedevschemadata/ap_matrix.xml| 7 +++ .../mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml| 9 + tests/nodedevxml2xmltest.c | 2 ++ 3 files changed, 18 insertions(+) create mode 100644 tests/nodedevschemadata/ap_matrix.xml create mode 100644 tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml diff --git a/tests/nodedevschemadata/ap_matrix.xml b/tests/nodedevschemadata/ap_matrix.xml new file mode 100644 index ..30dab9cf --- /dev/null +++ b/tests/nodedevschemadata/ap_matrix.xml @@ -0,0 +1,7 @@ + + ap_matrix + /sys/devices/vfio_ap/matrix + computer + + + diff --git a/tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml b/tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml new file mode 100644 index ..106f7593 --- /dev/null +++ b/tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml @@ -0,0 +1,9 @@ + + mdev_ee0b88c4-f554-4dc1-809d-b2a01e8e48ad + /sys/devices/vfio_ap/matrix/mdev_ee0b88c4-f554-4dc1-809d-b2a01e8e48ad + ap_matrix + + + + + diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index a8cbe6a9..dc8cb04f 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -127,6 +127,8 @@ mymain(void) DO_TEST("css_0_0_fffe_mdev_types"); DO_TEST("ap_card07"); DO_TEST("ap_07_0038"); +DO_TEST("ap_matrix"); +DO_TEST("mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad"); return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } -- 2.26.2
[PATCH libvirt v4 05/12] virsh: nodedev: Filter by AP card and AP queue capabilities
From: Farhan Ali Add support to filter by 'ap_card' and 'ap_queue' capabilities. Signed-off-by: Farhan Ali Reviewed-by: Boris Fiuczynski Reviewed-by: Bjoern Walk Signed-off-by: Shalini Chellathurai Saroja --- docs/manpages/virsh.rst | 2 +- include/libvirt/libvirt-nodedev.h | 2 ++ src/conf/node_device_conf.h | 4 +++- src/conf/virnodedeviceobj.c | 4 +++- src/libvirt-nodedev.c | 2 ++ tools/virsh-nodedev.c | 4 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index aa54bc21..7658b53b 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -5043,7 +5043,7 @@ List all of the devices available on the node that are known by libvirt. separated by comma, e.g. --cap pci,scsi. Valid capability types include 'system', 'pci', 'usb_device', 'usb', 'net', 'scsi_host', 'scsi_target', 'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm', 'mdev', -'mdev_types', 'ccw', 'css'. +'mdev_types', 'ccw', 'css', 'ap_card', 'ap_queue'. If *--tree* is used, the output is formatted in a tree representing parents of each node. *cap* and *--tree* are mutually exclusive. diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h index b73b076f..d5091aa2 100644 --- a/include/libvirt/libvirt-nodedev.h +++ b/include/libvirt/libvirt-nodedev.h @@ -83,6 +83,8 @@ typedef enum { VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV = 1 << 15, /* CCW device */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV = 1 << 16, /* CSS device */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA = 1 << 17, /* vDPA device */ +VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD = 1 << 18, /* s390 AP Card device */ +VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE = 1 << 19, /* s390 AP Queue */ } virConnectListAllNodeDeviceFlags; int virConnectListAllNodeDevices (virConnectPtr conn, diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 27cb0004..b580d6cf 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -402,7 +402,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA) + VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA | \ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD | \ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE) int virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host); diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 8b4302d7..691632c6 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -871,7 +871,9 @@ virNodeDeviceObjMatch(virNodeDeviceObjPtr obj, MATCH(MDEV) || MATCH(CCW_DEV) || MATCH(CSS_DEV) || - MATCH(VDPA))) + MATCH(VDPA) || + MATCH(AP_CARD) || + MATCH(AP_QUEUE))) return false; } diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c index 28765b9c..762413eb 100644 --- a/src/libvirt-nodedev.c +++ b/src/libvirt-nodedev.c @@ -102,6 +102,8 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags) * VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV * VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV * VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV + * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD + * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE * * Returns the number of node devices found or -1 and sets @devices to NULL in * case of error. On success, the array stored into @devices is guaranteed to diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 81752e85..f5ffe525 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -468,7 +468,11 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA; break; case VIR_NODE_DEV_CAP_AP_CARD: +flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD; +break; case VIR_NODE_DEV_CAP_AP_QUEUE: +flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE; +break; case VIR_NODE_DEV_CAP_LAST: break; } -- 2.26.2
[PATCH libvirt v4 10/12] node_device: mdev matrix support
Allow mdev devices to be created on the matrix device. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- src/node_device/node_device_driver.c | 5 - src/node_device/node_device_udev.c | 8 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index 65c647f5..e254b492 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -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; } diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 179793d8..3f425a6f 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1235,8 +1235,12 @@ udevProcessAPQueue(struct udev_device *device, static int -udevProcessAPMatrix(virNodeDeviceDefPtr def) +udevProcessAPMatrix(struct udev_device *device, +virNodeDeviceDefPtr def) { +virNodeDevCapDataPtr data = &def->caps->data; + +data->ap_matrix.addr = g_strdup(udev_device_get_sysname(device)); def->name = g_strdup("ap_matrix"); return 0; @@ -1383,7 +1387,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: -- 2.26.2
[PATCH libvirt v4 04/12] tests: AP queue node device
Add tests to verify libvirt node device driver support for AP queues Signed-off-by: Farhan Ali Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- tests/nodedevschemadata/ap_07_0038.xml | 9 + tests/nodedevxml2xmltest.c | 1 + 2 files changed, 10 insertions(+) create mode 100644 tests/nodedevschemadata/ap_07_0038.xml diff --git a/tests/nodedevschemadata/ap_07_0038.xml b/tests/nodedevschemadata/ap_07_0038.xml new file mode 100644 index ..553c68f2 --- /dev/null +++ b/tests/nodedevschemadata/ap_07_0038.xml @@ -0,0 +1,9 @@ + + ap_07_0038 + /sys/devices/ap/card07/07.0038 + ap_card07 + +0x07 +0x0038 + + diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index 7b8a5a82..a8cbe6a9 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -126,6 +126,7 @@ mymain(void) DO_TEST("css_0_0_"); DO_TEST("css_0_0_fffe_mdev_types"); DO_TEST("ap_card07"); +DO_TEST("ap_07_0038"); return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } -- 2.26.2
[PATCH libvirt v4 12/12] NEWS: mention node device driver support for AP devices
Signed-off-by: Shalini Chellathurai Saroja --- NEWS.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/NEWS.rst b/NEWS.rst index 135c4e2f..5fa9d68f 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -13,6 +13,12 @@ v7.0.0 (unreleased) * **New features** + * nodedev: Add node device driver support for AP devices + +Add support to detect and list Adjunct Processor(AP) cards, AP +queues and AP matrix devices of a KVM host system in libvirt node +device driver with correct object relationships. + * **Improvements** * **Bug fixes** -- 2.26.2
[PATCH libvirt v4 11/12] node_device: detecting mdev_types capability on ap_matrix device
From: Boris Fiuczynski Add detection of mdev_types capability to Adjunct Processor Matrix device. Signed-off-by: Boris Fiuczynski Reviewed-by: Shalini Chellathurai Saroja Reviewed-by: Jonathon Jongsma Signed-off-by: Shalini Chellathurai Saroja --- docs/formatnode.html.in | 24 +++- docs/schemas/nodedev.rng | 4 + src/conf/node_device_conf.c | 108 +- src/conf/node_device_conf.h | 11 ++ src/conf/virnodedeviceobj.c | 7 +- src/libvirt_private.syms | 1 + src/node_device/node_device_udev.c| 4 + .../ap_matrix_mdev_types.xml | 14 +++ tests/nodedevxml2xmltest.c| 1 + 9 files changed, 168 insertions(+), 6 deletions(-) create mode 100644 tests/nodedevschemadata/ap_matrix_mdev_types.xml diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index f76b3981..1010a37a 100644 --- a/docs/formatnode.html.in +++ b/docs/formatnode.html.in @@ -456,7 +456,26 @@ ap_matrix Describes an AP Matrix device on a S390 architecture providing - cryptographic host resources usable for virtualization. + cryptographic host resources usable for virtualization. + Sub-elements include: + + capability + +This optional element can occur multiple times. If it +exists, it has a mandatory type attribute +which will be set to: + + mdev_types + +Since 6.10.0 +This device is capable of creating mediated devices. +The sub-elements are summarized in +mdev_types capability. + + + + + @@ -464,7 +483,8 @@ mdev_types capability - PCI and CSS + PCI, CSS + and AP Matrix devices can be capable of creating mediated devices. If they indeed are capable, then the parent capability element for mdev_types type will contain a list of diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 1024ba59..5840dc9f 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -696,6 +696,9 @@ ap_matrix + + + @@ -736,6 +739,7 @@ vfio-pci vfio-ccw + vfio-ap diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index d32a6afc..35f34b10 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -663,10 +663,15 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) virBufferAsprintf(&buf, "0x%04x\n", data->ap_queue.ap_domain); break; +case VIR_NODE_DEV_CAP_AP_MATRIX: +if (data->ap_matrix.flags & VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV) +virNodeDeviceCapMdevTypesFormat(&buf, +data->ap_matrix.mdev_types, +data->ap_matrix.nmdev_types); + 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; } @@ -861,6 +866,33 @@ virNodeDevCapMdevTypesParseXML(xmlXPathContextPtr ctxt, } +static int +virNodeDevAPMatrixCapabilityParseXML(xmlXPathContextPtr ctxt, + xmlNodePtr node, + virNodeDevCapAPMatrixPtr apm_dev) +{ +g_autofree char *type = virXMLPropString(node, "type"); +VIR_XPATH_NODE_AUTORESTORE(ctxt) + +ctxt->node = node; + +if (!type) { +virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing capability type")); +return -1; +} + +if (STREQ(type, "mdev_types")) { +if (virNodeDevCapMdevTypesParseXML(ctxt, + &apm_dev->mdev_types, + &apm_dev->nmdev_types) < 0) +return -1; +apm_dev->flags |= VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV; +} + +return 0; +} + + static int virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt, xmlNodePtr node, @@ -1033,6 +1065,31 @@ virNodeDevCapAPQueueParseXML(xmlXPathContextPtr ctxt, } +static int +virNodeDevCapAPMatrixParseXML(xmlXPathContextPtr ctxt, + virNodeDeviceDefPtr def G_GNUC_UNUSED, + xmlNodePtr node, + virNodeDevCap
[PATCH libvirt v4 08/12] virsh: nodedev: filter by AP Matrix capability
Add support to filter by 'ap_matrix' capability. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- docs/formatnode.html.in | 3 +++ docs/manpages/virsh.rst | 2 +- include/libvirt/libvirt-nodedev.h | 1 + src/conf/node_device_conf.h | 3 ++- src/conf/virnodedeviceobj.c | 3 ++- src/libvirt-nodedev.c | 1 + tools/virsh-nodedev.c | 2 ++ 7 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index e8c5be79..f76b3981 100644 --- a/docs/formatnode.html.in +++ b/docs/formatnode.html.in @@ -454,6 +454,9 @@ AP Queue identifier. + ap_matrix + Describes an AP Matrix device on a S390 architecture providing + cryptographic host resources usable for virtualization. diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 7658b53b..aa3a0095 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -5043,7 +5043,7 @@ List all of the devices available on the node that are known by libvirt. separated by comma, e.g. --cap pci,scsi. Valid capability types include 'system', 'pci', 'usb_device', 'usb', 'net', 'scsi_host', 'scsi_target', 'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm', 'mdev', -'mdev_types', 'ccw', 'css', 'ap_card', 'ap_queue'. +'mdev_types', 'ccw', 'css', 'ap_card', 'ap_queue', 'ap_matrix'. If *--tree* is used, the output is formatted in a tree representing parents of each node. *cap* and *--tree* are mutually exclusive. diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-nodedev.h index d5091aa2..eab8abf6 100644 --- a/include/libvirt/libvirt-nodedev.h +++ b/include/libvirt/libvirt-nodedev.h @@ -85,6 +85,7 @@ typedef enum { VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA = 1 << 17, /* vDPA device */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD = 1 << 18, /* s390 AP Card device */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE = 1 << 19, /* s390 AP Queue */ +VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX = 1 << 20, /* s390 AP Matrix */ } virConnectListAllNodeDeviceFlags; int virConnectListAllNodeDevices (virConnectPtr conn, diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index b863653b..b8397128 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -412,7 +412,8 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE) + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE | \ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX) int virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host); diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 8fbef5f5..25d12776 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -874,7 +874,8 @@ virNodeDeviceObjMatch(virNodeDeviceObjPtr obj, MATCH(CSS_DEV) || MATCH(VDPA) || MATCH(AP_CARD) || - MATCH(AP_QUEUE))) + MATCH(AP_QUEUE) || + MATCH(AP_MATRIX))) return false; } diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c index 762413eb..eb8c735a 100644 --- a/src/libvirt-nodedev.c +++ b/src/libvirt-nodedev.c @@ -104,6 +104,7 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags) * VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE + * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX * * Returns the number of node devices found or -1 and sets @devices to NULL in * case of error. On success, the array stored into @devices is guaranteed to diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index f69030d2..69422e20 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -474,6 +474,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE; break; case VIR_NODE_DEV_CAP_AP_MATRIX: +flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX; +break; case VIR_NODE_DEV_CAP_LAST: break; } -- 2.26.2
Re: [PATCH libvirt v4 00/12] Support AP card, AP queues and AP matrix
On 12/4/20 11:24 AM, Erik Skultety wrote: On Thu, Dec 03, 2020 at 06:59:32PM +0100, Shalini Chellathurai Saroja wrote: Add support for AP card devices, AP queues and AP matrix devices in libvirt node device driver. --- v4: - Added virNodeDevAPAdapterParseXML function to extract the adapter parsing logic. - Modified according to review comments. - New patch to mention support for AP devices in NEWS.rst. Reviewed-by: Erik Skultety I had 2 nitpicks which I can fix before merging, but I'd like to give other people a couple more days to express their "final" opinions and if there are no more comments, then sometime next week I'll merge this. There's one more little thing...Boris linked the s390 AP facility kernel documentation which really helped me during the review, so I think we should link it somewhere too - usually we're not so keen on doing that because 3rd party documentation URLs tend to die or migrate, but in this case it linked directly to the github repo (I think even the generated HTML on kernel.org would be just fine), but I don't know what the right place for this actually is as it describes the whole facility which we modelled in 3 capabilities. We could put it into the NEWS file, but then again, not sure how often anyone developing libvirt reads the NEWS file. Regards, Erik Hello Erik, Thank you very much for the review. -- Kind regards Shalini Chellathurai Saroja Linux on Z and Virtualization Development Vorsitzende des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH libvirt v4 00/12] Support AP card, AP queues and AP matrix
On 12/9/20 2:03 PM, Erik Skultety wrote: On Fri, Dec 04, 2020 at 11:24:12AM +0100, Erik Skultety wrote: On Thu, Dec 03, 2020 at 06:59:32PM +0100, Shalini Chellathurai Saroja wrote: Add support for AP card devices, AP queues and AP matrix devices in libvirt node device driver. --- v4: - Added virNodeDevAPAdapterParseXML function to extract the adapter parsing logic. - Modified according to review comments. - New patch to mention support for AP devices in NEWS.rst. Reviewed-by: Erik Skultety I had 2 nitpicks which I can fix before merging, but I'd like to give other people a couple more days to express their "final" opinions and if there are no more comments, then sometime next week I'll merge this. There's one more little thing...Boris linked the s390 AP facility kernel documentation which really helped me during the review, so I think we should link it somewhere too - usually we're not so keen on doing that because 3rd party documentation URLs tend to die or migrate, but in this case it linked directly to the github repo (I think even the generated HTML on kernel.org would be just fine), but I don't know what the right place for this actually is as it describes the whole facility which we modelled in 3 capabilities. We could put it into the NEWS file, but then again, not sure how often anyone developing libvirt reads the NEWS file. Regards, Erik Pushed now. Hello Erik, Thank you. Regards, Erik -- Kind regards Shalini Chellathurai Saroja Linux on Z and Virtualization Development Vorsitzende des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH libvirt v1] tests: add capabilities for QEMU 5.1.0 on s390x
On 12/14/20 10:10 AM, Andrea Bolognani wrote: On Wed, 2020-11-18 at 17:18 +0100, Shalini Chellathurai Saroja wrote: Signed-off-by: Shalini Chellathurai Saroja --- The replies file is removed from this patch and is available in https://gitlab.com/shalinichellathurai/libvirt/-/commit/1c34c07c434560d7f44212ce0bbbc8bf92490622 tests/domaincapsdata/qemu_5.1.0.s390x.xml | 230 + .../caps_5.1.0.s390x.replies | 24617 .../qemucapabilitiesdata/caps_5.1.0.s390x.xml | 3278 ++ ...default-video-type-s390x.s390x-latest.args | 2 +- .../disk-error-policy-s390x.s390x-latest.args |12 +- .../fs9p-ccw.s390x-latest.args| 4 +- ...othreads-virtio-scsi-ccw.s390x-latest.args | 2 +- ...t-cpu-kvm-ccw-virtio-4.2.s390x-latest.args | 2 +- .../s390x-ccw-graphics.s390x-latest.args | 4 +- .../s390x-ccw-headless.s390x-latest.args | 4 +- .../vhost-vsock-ccw-auto.s390x-latest.args| 4 +- .../vhost-vsock-ccw.s390x-latest.args | 4 +- 12 files changed, 28144 insertions(+), 19 deletions(-) create mode 100644 tests/domaincapsdata/qemu_5.1.0.s390x.xml create mode 100644 tests/qemucapabilitiesdata/caps_5.1.0.s390x.replies create mode 100644 tests/qemucapabilitiesdata/caps_5.1.0.s390x.xml The patch looks good from a quick look; however, QEMU 5.2.0 was released a week ago and we have already merged capabilities for all architectures but s390x for that version so, unless there's something that is 5.1.0-specific that you need to test, can you please generate the capabilities for 5.2.0 instead? Hello Andrea, ok, I will generate capabilities for 5.2.0. Thank you. Thanks in advance! -- Kind regards Shalini Chellathurai Saroja Linux on Z and Virtualization Development Vorsitzende des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH libvirt v1] tests: add capabilities for QEMU 5.1.0 on s390x
On 12/14/20 10:10 AM, Andrea Bolognani wrote: On Wed, 2020-11-18 at 17:18 +0100, Shalini Chellathurai Saroja wrote: Signed-off-by: Shalini Chellathurai Saroja --- The replies file is removed from this patch and is available in https://gitlab.com/shalinichellathurai/libvirt/-/commit/1c34c07c434560d7f44212ce0bbbc8bf92490622 tests/domaincapsdata/qemu_5.1.0.s390x.xml | 230 + .../caps_5.1.0.s390x.replies | 24617 .../qemucapabilitiesdata/caps_5.1.0.s390x.xml | 3278 ++ ...default-video-type-s390x.s390x-latest.args | 2 +- .../disk-error-policy-s390x.s390x-latest.args |12 +- .../fs9p-ccw.s390x-latest.args| 4 +- ...othreads-virtio-scsi-ccw.s390x-latest.args | 2 +- ...t-cpu-kvm-ccw-virtio-4.2.s390x-latest.args | 2 +- .../s390x-ccw-graphics.s390x-latest.args | 4 +- .../s390x-ccw-headless.s390x-latest.args | 4 +- .../vhost-vsock-ccw-auto.s390x-latest.args| 4 +- .../vhost-vsock-ccw.s390x-latest.args | 4 +- 12 files changed, 28144 insertions(+), 19 deletions(-) create mode 100644 tests/domaincapsdata/qemu_5.1.0.s390x.xml create mode 100644 tests/qemucapabilitiesdata/caps_5.1.0.s390x.replies create mode 100644 tests/qemucapabilitiesdata/caps_5.1.0.s390x.xml The patch looks good from a quick look; however, QEMU 5.2.0 was released a week ago and we have already merged capabilities for all architectures but s390x for that version so, unless there's something that is 5.1.0-specific that you need to test, can you please generate the capabilities for 5.2.0 instead? Thanks in advance! Hello Andrea, I have sent a patch with capabilities for QEMU 5.2.0 on s390x. (https://www.redhat.com/archives/libvir-list/2020-December/msg00754.html) Thank you. -- Kind regards Shalini Chellathurai Saroja Linux on Z and Virtualization Development Vorsitzende des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH libvirt v1] tests: add capabilities for QEMU 5.2.0 on s390x
On 12/17/20 12:19 PM, Andrea Bolognani wrote: On Wed, 2020-12-16 at 10:10 +0100, Shalini Chellathurai Saroja wrote: tests/domaincapsdata/qemu_5.2.0.s390x.xml | 231 + .../caps_5.2.0.s390x.replies | 25458 .../qemucapabilitiesdata/caps_5.2.0.s390x.xml | 3300 ++ ...default-video-type-s390x.s390x-latest.args | 9 +- .../disk-error-policy-s390x.s390x-latest.args |16 +- .../fs9p-ccw.s390x-latest.args| 8 +- ...tdev-subsys-mdev-vfio-ap.s390x-latest.args | 4 +- ...ubsys-mdev-vfio-ccw-boot.s390x-latest.args | 4 +- ...othreads-virtio-scsi-ccw.s390x-latest.args | 6 +- ...t-cpu-kvm-ccw-virtio-2.7.s390x-latest.args | 4 +- ...t-cpu-kvm-ccw-virtio-4.2.s390x-latest.args | 9 +- ...t-cpu-tcg-ccw-virtio-2.7.s390x-latest.args | 4 +- ...t-cpu-tcg-ccw-virtio-4.2.s390x-latest.args | 4 +- .../s390x-ccw-graphics.s390x-latest.args | 8 +- .../s390x-ccw-headless.s390x-latest.args | 8 +- .../vhost-vsock-ccw-auto.s390x-latest.args| 8 +- .../vhost-vsock-ccw.s390x-latest.args | 8 +- 17 files changed, 29054 insertions(+), 35 deletions(-) create mode 100644 tests/domaincapsdata/qemu_5.2.0.s390x.xml create mode 100644 tests/qemucapabilitiesdata/caps_5.2.0.s390x.replies create mode 100644 tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml The diff looks sane enough, so Reviewed-by: Andrea Bolognani and pushed. Thanks for helping! Hello Andrea, Thank you for the review:-) Sure, you are welcome:-) However... +++ b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml @@ -0,0 +1,3300 @@ + + /usr/bin/qemu-system-s390x + 5002000 + 0 + 39100243 + qemu-5.2.0-20201215.0.ba93e22c.fc32 ... the version string seems to indicate you're grabbing the replies from a packaged version rather than a build made from pristine upstream sources: this is consistent with what was done for earlier QEMU capabilities on s390x, but not with how we usually do things for other architectures - see the other caps_5.2.0.*.replies files. I don't think this is a blocker, because a Fedora-based package will be quite close to upstream anyway, but it would be great if you could generate the replies file again against a QEMU binary that's been built exclusively from upstream sources. You can then submit the update as a follow-up patch - I expect such patch to be fairly small. The replies are actually generated from the QEMU 5.2.0 binary built exclusively from upstream. This is also true for the other s390 replies generated for the earlier versions of QEMU. I can modify the package name from qemu-5.2.0-20201215.0.ba93e22c.fc32 to qemu-5.2.0, to make it more obvious that it is an upstream version and not a distro package. Would it be ok? Thanks again for your help getting updated capabilities in libvirt :) You are welcome:-) -- Kind regards Shalini Chellathurai Saroja Linux on Z and Virtualization Development Vorsitzende des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH libvirt v1] tests: add capabilities for QEMU 5.2.0 on s390x
On 1/4/21 9:44 AM, Andrea Bolognani wrote: On Mon, 2020-12-28 at 12:41 +0100, Shalini Chellathurai Saroja wrote: On 12/17/20 12:19 PM, Andrea Bolognani wrote: On Wed, 2020-12-16 at 10:10 +0100, Shalini Chellathurai Saroja wrote: +++ b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml @@ -0,0 +1,3300 @@ + + /usr/bin/qemu-system-s390x + 5002000 + 0 + 39100243 + qemu-5.2.0-20201215.0.ba93e22c.fc32 ... the version string seems to indicate you're grabbing the replies from a packaged version rather than a build made from pristine upstream sources: this is consistent with what was done for earlier QEMU capabilities on s390x, but not with how we usually do things for other architectures - see the other caps_5.2.0.*.replies files. I don't think this is a blocker, because a Fedora-based package will be quite close to upstream anyway, but it would be great if you could generate the replies file again against a QEMU binary that's been built exclusively from upstream sources. You can then submit the update as a follow-up patch - I expect such patch to be fairly small. The replies are actually generated from the QEMU 5.2.0 binary built exclusively from upstream. This is also true for the other s390 replies generated for the earlier versions of QEMU. So how are you actually building the binary? Because if you just clone the upstream repository and run the usual ./configure && make inside it, the version number will not look like that... The presence of .fc32 specifically seems to indicate a .spec file is involved in some capacity. Hello Andrea, Happy New Year:-) We are using an automated build system which creates rpm packages from upstream QEMU 5.2.0. Yes, a .spec file is involved. Thank you Shalini C S -- Kind regards Shalini Chellathurai Saroja Linux on Z and Virtualization Development Vorsitzende des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [PATCH libvirt v1] tests: add capabilities for QEMU 5.2.0 on s390x
On 1/12/21 11:09 AM, Andrea Bolognani wrote: On Tue, 2021-01-12 at 09:17 +0100, Shalini Chellathurai Saroja wrote: On 1/4/21 9:44 AM, Andrea Bolognani wrote: On Mon, 2020-12-28 at 12:41 +0100, Shalini Chellathurai Saroja wrote: On 12/17/20 12:19 PM, Andrea Bolognani wrote: On Wed, 2020-12-16 at 10:10 +0100, Shalini Chellathurai Saroja wrote: +++ b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml @@ -0,0 +1,3300 @@ + + /usr/bin/qemu-system-s390x + 5002000 + 0 + 39100243 + qemu-5.2.0-20201215.0.ba93e22c.fc32 ... the version string seems to indicate you're grabbing the replies from a packaged version rather than a build made from pristine upstream sources: this is consistent with what was done for earlier QEMU capabilities on s390x, but not with how we usually do things for other architectures - see the other caps_5.2.0.*.replies files. I don't think this is a blocker, because a Fedora-based package will be quite close to upstream anyway, but it would be great if you could generate the replies file again against a QEMU binary that's been built exclusively from upstream sources. You can then submit the update as a follow-up patch - I expect such patch to be fairly small. The replies are actually generated from the QEMU 5.2.0 binary built exclusively from upstream. This is also true for the other s390 replies generated for the earlier versions of QEMU. So how are you actually building the binary? Because if you just clone the upstream repository and run the usual ./configure && make inside it, the version number will not look like that... The presence of .fc32 specifically seems to indicate a .spec file is involved in some capacity. Hello Andrea, Happy New Year:-) We are using an automated build system which creates rpm packages from upstream QEMU 5.2.0. Yes, a .spec file is involved. I see. As long as you're using unadulterated upstream sources I don't think we have a problem here, and you shouldn't spend time changing your process. I agree, thank you:-) Thanks again! -- Kind regards Shalini Chellathurai Saroja Linux on Z and Virtualization Development Vorsitzende des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294