+
</grammar>
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 88c00b5b..d27b0c71 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -67,6 +67,7 @@ VIR_ENUM_IMPL(virNodeDevCap,
"ccw",
"css",
"ap_card",
+ "ap_queue",
);
VIR_ENUM_IMPL(virNodeDevNetCap,
@@ -616,6 +617,12 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
virBufferAsprintf(&buf, "<ap-adapter>0x%02x</ap-adapter>\n",
data->ap_card.ap_adapter);
break;
+ case VIR_NODE_DEV_CAP_AP_QUEUE:
+ virBufferAsprintf(&buf, "<ap-adapter>0x%02x</ap-adapter>\n",
+ data->ap_queue.ap_adapter);
+ virBufferAsprintf(&buf, "<ap-domain>0x%04x</ap-domain>\n",
+ data->ap_queue.ap_domain);
+ break;
case VIR_NODE_DEV_CAP_MDEV_TYPES:
case VIR_NODE_DEV_CAP_FC_HOST:
case VIR_NODE_DEV_CAP_VPORTS:
@@ -839,6 +846,52 @@ virNodeDevCapAPCardParseXML(xmlXPathContextPtr ctxt,
}
+static int
+virNodeDevCapAPQueueParseXML(xmlXPathContextPtr ctxt,
+ virNodeDeviceDefPtr def,
+ xmlNodePtr node,
+ virNodeDevCapAPQueuePtr ap_queue)
+{
+ xmlNodePtr orig;
+ int ret = -1;
+ g_autofree char *adapter = NULL, *dom = NULL;
+
+ orig = ctxt->node;
+ ctxt->node = node;
+
+ if (!(adapter = virXPathString("string(./ap-adapter[1])", ctxt))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("missing ap-adapter value for '%s'"), def->name);
+ return -1;
+ }
+
+ if (virStrToLong_uip(adapter, NULL, 0, &ap_queue->ap_adapter) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid ap-adapter value '%s' for '%s'"),
+ adapter, def->name);
+ goto out;
+ }
+
+ if (!(dom = virXPathString("string(./ap-domain[1])", ctxt))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("missing ap-domain value for '%s'"), def->name);
+ goto out;
+ }
+
+ if (virStrToLong_uip(dom, NULL, 0, &ap_queue->ap_domain) < 0) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("invalid ap-domain value '%s' for '%s'"),
+ dom, def->name);
+ goto out;
+ }
+
+ ret = 0;
+ out:
+ ctxt->node = orig;
+ return ret;
+}
+
+
static int
virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def,
@@ -1938,6 +1991,10 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
ret = virNodeDevCapAPCardParseXML(ctxt, def, node,
&caps->data.ap_card);
break;
+ case VIR_NODE_DEV_CAP_AP_QUEUE:
+ ret = virNodeDevCapAPQueueParseXML(ctxt, def, node,
+ &caps->data.ap_queue);
+ break;
case VIR_NODE_DEV_CAP_MDEV_TYPES:
case VIR_NODE_DEV_CAP_FC_HOST:
case VIR_NODE_DEV_CAP_VPORTS:
@@ -2260,6 +2317,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
case VIR_NODE_DEV_CAP_CCW_DEV:
case VIR_NODE_DEV_CAP_CSS_DEV:
case VIR_NODE_DEV_CAP_AP_CARD:
+ case VIR_NODE_DEV_CAP_AP_QUEUE:
case VIR_NODE_DEV_CAP_LAST:
/* This case is here to shutup the compiler */
break;
@@ -2315,6 +2373,7 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def)
case VIR_NODE_DEV_CAP_CCW_DEV:
case VIR_NODE_DEV_CAP_CSS_DEV:
case VIR_NODE_DEV_CAP_AP_CARD:
+ case VIR_NODE_DEV_CAP_AP_QUEUE:
case VIR_NODE_DEV_CAP_LAST:
break;
}
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index aa2dac43..c8100c8b 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -66,6 +66,7 @@ typedef enum {
VIR_NODE_DEV_CAP_CCW_DEV, /* s390 CCW device */
VIR_NODE_DEV_CAP_CSS_DEV, /* s390 channel subsystem device */
VIR_NODE_DEV_CAP_AP_CARD, /* s390 AP Card device */
+ VIR_NODE_DEV_CAP_AP_QUEUE, /* s390 AP Queue */
VIR_NODE_DEV_CAP_LAST
} virNodeDevCapType;
@@ -282,6 +283,13 @@ struct _virNodeDevCapAPCard {
unsigned int ap_adapter;
};
+typedef struct _virNodeDevCapAPQueue virNodeDevCapAPQueue;
+typedef virNodeDevCapAPQueue *virNodeDevCapAPQueuePtr;
+struct _virNodeDevCapAPQueue {
+ unsigned int ap_adapter;
+ unsigned int ap_domain;
+};
+
typedef struct _virNodeDevCapData virNodeDevCapData;
typedef virNodeDevCapData *virNodeDevCapDataPtr;
struct _virNodeDevCapData {
@@ -301,6 +309,7 @@ struct _virNodeDevCapData {
virNodeDevCapMdev mdev;
virNodeDevCapCCW ccw_dev;
virNodeDevCapAPCard ap_card;
+ virNodeDevCapAPQueue ap_queue;
};
};
diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
index 8d3e5a43..0fd44f6f 100644
--- a/src/conf/virnodedeviceobj.c
+++ b/src/conf/virnodedeviceobj.c
@@ -712,6 +712,7 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj,
case VIR_NODE_DEV_CAP_CCW_DEV:
case VIR_NODE_DEV_CAP_CSS_DEV:
case VIR_NODE_DEV_CAP_AP_CARD:
+ case VIR_NODE_DEV_CAP_AP_QUEUE:
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 c513b4cc..16a73db2 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1168,6 +1168,29 @@ udevProcessAPCard(struct udev_device *device,
}
+static int
+udevProcessAPQueue(struct udev_device *device,
+ virNodeDeviceDefPtr def)
+{
+ char *c;
+ virNodeDevCapDataPtr data = &def->caps->data;
+
+ if ((c = strrchr(def->sysfs_path, '/')) == NULL ||
+ virStrToLong_ui(c + 1, &c, 16, &data->ap_queue.ap_adapter) < 0 ||
+ virStrToLong_ui(c + 1, &c, 16, &data->ap_queue.ap_domain) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to parse the AP Queue from sysfs path: '%s'"),
+ def->sysfs_path);
+ return -1;
+ }
+
+ if (udevGenerateDeviceName(device, def, NULL) != 0)
+ return -1;
+
+ return 0;
+}
+
+
static int
udevGetDeviceNodes(struct udev_device *device,
virNodeDeviceDefPtr def)
@@ -1224,6 +1247,8 @@ udevGetDeviceType(struct udev_device *device,
*type = VIR_NODE_DEV_CAP_DRM;
else if (STREQ(devtype, "ap_card"))
*type = VIR_NODE_DEV_CAP_AP_CARD;
+ else if (STREQ(devtype, "ap_queue"))
+ *type = VIR_NODE_DEV_CAP_AP_QUEUE;
} else {
/* PCI devices don't set the DEVTYPE property. */
if (udevHasDeviceProperty(device, "PCI_CLASS"))
@@ -1297,6 +1322,8 @@ udevGetDeviceDetails(struct udev_device *device,
return udevProcessCSS(device, def);
case VIR_NODE_DEV_CAP_AP_CARD:
return udevProcessAPCard(device, def);
+ case VIR_NODE_DEV_CAP_AP_QUEUE:
+ return udevProcessAPQueue(device, def);
case VIR_NODE_DEV_CAP_MDEV_TYPES:
case VIR_NODE_DEV_CAP_SYSTEM:
case VIR_NODE_DEV_CAP_FC_HOST:
diff --git a/tests/nodedevschemadata/ap_07_0038.xml b/tests/nodedevschemadata/ap_07_0038.xml
new file mode 100644
index 00000000..553c68f2
--- /dev/null
+++ b/tests/nodedevschemadata/ap_07_0038.xml
@@ -0,0 +1,9 @@
+<device>
+ <name>ap_07_0038</name>
+ <path>/sys/devices/ap/card07/07.0038</path>
+ <parent>ap_card07</parent>
+ <capability type='ap_queue'>
+ <ap-adapter>0x07</ap-adapter>
+ <ap-domain>0x0038</ap-domain>
+ </capability>
+</device>
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
index 7990f6cd..d6ab25bf 100644
--- a/tests/nodedevxml2xmltest.c
+++ b/tests/nodedevxml2xmltest.c
@@ -125,6 +125,7 @@ mymain(void)
DO_TEST("ccw_0_0_ffff");
DO_TEST("css_0_0_ffff");
DO_TEST("ap_card07");
+ DO_TEST("ap_07_0038");
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 98268916..f79e0b78 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -465,6 +465,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV;
break;
case VIR_NODE_DEV_CAP_AP_CARD:
+ case VIR_NODE_DEV_CAP_AP_QUEUE:
case VIR_NODE_DEV_CAP_LAST:
break;
}