|
|
2ba5aa |
From 7604b24349c47ff008b1366eb19fc2959614fb71 Mon Sep 17 00:00:00 2001
|
|
|
2ba5aa |
Message-Id: <7604b24349c47ff008b1366eb19fc2959614fb71@dist-git>
|
|
|
2ba5aa |
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
|
2ba5aa |
Date: Thu, 8 Oct 2020 11:06:57 -0400
|
|
|
2ba5aa |
Subject: [PATCH] node_device: detect CSS devices
|
|
|
2ba5aa |
|
|
|
2ba5aa |
Make channel subsystem (CSS) devices available in the node_device driver.
|
|
|
2ba5aa |
The CCS devices reside in the computer system and provide CCW devices, e.g.:
|
|
|
2ba5aa |
|
|
|
2ba5aa |
+- css_0_0_003a
|
|
|
2ba5aa |
|
|
|
|
2ba5aa |
+- ccw_0_0_1a2b
|
|
|
2ba5aa |
|
|
|
|
2ba5aa |
+- scsi_host0
|
|
|
2ba5aa |
|
|
|
|
2ba5aa |
+- scsi_target0_0_0
|
|
|
2ba5aa |
|
|
|
|
2ba5aa |
+- scsi_0_0_0_0
|
|
|
2ba5aa |
|
|
|
2ba5aa |
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
|
|
2ba5aa |
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
|
|
|
2ba5aa |
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
|
2ba5aa |
(cherry picked from commit 05e6cdafa6e083a1d83e1f2e34b6472c60cc67ac)
|
|
|
2ba5aa |
https://bugzilla.redhat.com/show_bug.cgi?id=1853289
|
|
|
2ba5aa |
https://bugzilla.redhat.com/show_bug.cgi?id=1865932
|
|
|
2ba5aa |
Message-Id: <20201008150700.52157-3-bfiuczyn@redhat.com>
|
|
|
2ba5aa |
Reviewed-by: Erik Skultety <eskultet@redhat.com>
|
|
|
2ba5aa |
---
|
|
|
2ba5aa |
docs/schemas/nodedev.rng | 16 ++++++++++++++
|
|
|
2ba5aa |
src/conf/node_device_conf.c | 5 +++++
|
|
|
2ba5aa |
src/conf/node_device_conf.h | 1 +
|
|
|
2ba5aa |
src/conf/virnodedeviceobj.c | 1 +
|
|
|
2ba5aa |
src/node_device/node_device_udev.c | 22 +++++++++++++++++++
|
|
|
2ba5aa |
.../ccw_0_0_10000-invalid.xml | 4 ++--
|
|
|
2ba5aa |
tests/nodedevschemadata/ccw_0_0_ffff.xml | 4 ++--
|
|
|
2ba5aa |
tests/nodedevschemadata/css_0_0_ffff.xml | 10 +++++++++
|
|
|
2ba5aa |
tests/nodedevxml2xmltest.c | 1 +
|
|
|
2ba5aa |
tools/virsh-nodedev.c | 1 +
|
|
|
2ba5aa |
10 files changed, 61 insertions(+), 4 deletions(-)
|
|
|
2ba5aa |
create mode 100644 tests/nodedevschemadata/css_0_0_ffff.xml
|
|
|
2ba5aa |
|
|
|
2ba5aa |
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
|
|
|
2ba5aa |
index fe6ffa0b53..6ac5804bfb 100644
|
|
|
2ba5aa |
--- a/docs/schemas/nodedev.rng
|
|
|
2ba5aa |
+++ b/docs/schemas/nodedev.rng
|
|
|
2ba5aa |
@@ -85,6 +85,7 @@
|
|
|
2ba5aa |
<ref name="capdrm"/>
|
|
|
2ba5aa |
<ref name="capmdev"/>
|
|
|
2ba5aa |
<ref name="capccwdev"/>
|
|
|
2ba5aa |
+ <ref name="capcssdev"/>
|
|
|
2ba5aa |
</choice>
|
|
|
2ba5aa |
</element>
|
|
|
2ba5aa |
</define>
|
|
|
2ba5aa |
@@ -651,6 +652,21 @@
|
|
|
2ba5aa |
</element>
|
|
|
2ba5aa |
</define>
|
|
|
2ba5aa |
|
|
|
2ba5aa |
+ <define name='capcssdev'>
|
|
|
2ba5aa |
+ <attribute name='type'>
|
|
|
2ba5aa |
+ <value>css</value>
|
|
|
2ba5aa |
+ </attribute>
|
|
|
2ba5aa |
+ <element name='cssid'>
|
|
|
2ba5aa |
+ <ref name='ccwCssidRange'/>
|
|
|
2ba5aa |
+ </element>
|
|
|
2ba5aa |
+ <element name='ssid'>
|
|
|
2ba5aa |
+ <ref name='ccwSsidRange'/>
|
|
|
2ba5aa |
+ </element>
|
|
|
2ba5aa |
+ <element name='devno'>
|
|
|
2ba5aa |
+ <ref name='ccwDevnoRange'/>
|
|
|
2ba5aa |
+ </element>
|
|
|
2ba5aa |
+ </define>
|
|
|
2ba5aa |
+
|
|
|
2ba5aa |
<define name='address'>
|
|
|
2ba5aa |
<element name='address'>
|
|
|
2ba5aa |
<attribute name='domain'><ref name='hexuint'/></attribute>
|
|
|
2ba5aa |
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
|
|
|
2ba5aa |
index 4cf5b6e3d7..0a34faa29a 100644
|
|
|
2ba5aa |
--- a/src/conf/node_device_conf.c
|
|
|
2ba5aa |
+++ b/src/conf/node_device_conf.c
|
|
|
2ba5aa |
@@ -65,6 +65,7 @@ VIR_ENUM_IMPL(virNodeDevCap,
|
|
|
2ba5aa |
"mdev_types",
|
|
|
2ba5aa |
"mdev",
|
|
|
2ba5aa |
"ccw",
|
|
|
2ba5aa |
+ "css",
|
|
|
2ba5aa |
);
|
|
|
2ba5aa |
|
|
|
2ba5aa |
VIR_ENUM_IMPL(virNodeDevNetCap,
|
|
|
2ba5aa |
@@ -588,6 +589,7 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
|
|
|
2ba5aa |
data->mdev.iommuGroupNumber);
|
|
|
2ba5aa |
break;
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_CCW_DEV:
|
|
|
2ba5aa |
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
|
|
2ba5aa |
virBufferAsprintf(&buf, "<cssid>0x%x</cssid>\n",
|
|
|
2ba5aa |
data->ccw_dev.cssid);
|
|
|
2ba5aa |
virBufferAsprintf(&buf, "<ssid>0x%x</ssid>\n",
|
|
|
2ba5aa |
@@ -1893,6 +1895,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
|
|
2ba5aa |
ret = virNodeDevCapMdevParseXML(ctxt, def, node, &caps->data.mdev);
|
|
|
2ba5aa |
break;
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_CCW_DEV:
|
|
|
2ba5aa |
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
|
|
2ba5aa |
ret = virNodeDevCapCCWParseXML(ctxt, def, node, &caps->data.ccw_dev);
|
|
|
2ba5aa |
break;
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
|
|
2ba5aa |
@@ -2211,6 +2214,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_FC_HOST:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_VPORTS:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_CCW_DEV:
|
|
|
2ba5aa |
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_LAST:
|
|
|
2ba5aa |
/* This case is here to shutup the compiler */
|
|
|
2ba5aa |
break;
|
|
|
2ba5aa |
@@ -2264,6 +2268,7 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def)
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_MDEV:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_CCW_DEV:
|
|
|
2ba5aa |
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_LAST:
|
|
|
2ba5aa |
break;
|
|
|
2ba5aa |
}
|
|
|
2ba5aa |
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
|
|
|
2ba5aa |
index bf7939fbb3..19ea3fc7c2 100644
|
|
|
2ba5aa |
--- a/src/conf/node_device_conf.h
|
|
|
2ba5aa |
+++ b/src/conf/node_device_conf.h
|
|
|
2ba5aa |
@@ -65,6 +65,7 @@ typedef enum {
|
|
|
2ba5aa |
VIR_NODE_DEV_CAP_MDEV_TYPES, /* Device capable of mediated devices */
|
|
|
2ba5aa |
VIR_NODE_DEV_CAP_MDEV, /* Mediated device */
|
|
|
2ba5aa |
VIR_NODE_DEV_CAP_CCW_DEV, /* s390 CCW device */
|
|
|
2ba5aa |
+ VIR_NODE_DEV_CAP_CSS_DEV, /* s390 channel subsystem device */
|
|
|
2ba5aa |
|
|
|
2ba5aa |
VIR_NODE_DEV_CAP_LAST
|
|
|
2ba5aa |
} virNodeDevCapType;
|
|
|
2ba5aa |
diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c
|
|
|
2ba5aa |
index 3a34a324ca..8c8ffd6d24 100644
|
|
|
2ba5aa |
--- a/src/conf/virnodedeviceobj.c
|
|
|
2ba5aa |
+++ b/src/conf/virnodedeviceobj.c
|
|
|
2ba5aa |
@@ -676,6 +676,7 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj,
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_MDEV:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_CCW_DEV:
|
|
|
2ba5aa |
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_LAST:
|
|
|
2ba5aa |
break;
|
|
|
2ba5aa |
}
|
|
|
2ba5aa |
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
|
|
2ba5aa |
index 9667a042bd..efe3cebd6a 100644
|
|
|
2ba5aa |
--- a/src/node_device/node_device_udev.c
|
|
|
2ba5aa |
+++ b/src/node_device/node_device_udev.c
|
|
|
2ba5aa |
@@ -1097,6 +1097,24 @@ udevProcessCCW(struct udev_device *device,
|
|
|
2ba5aa |
}
|
|
|
2ba5aa |
|
|
|
2ba5aa |
|
|
|
2ba5aa |
+static int
|
|
|
2ba5aa |
+udevProcessCSS(struct udev_device *device,
|
|
|
2ba5aa |
+ virNodeDeviceDefPtr def)
|
|
|
2ba5aa |
+{
|
|
|
2ba5aa |
+ /* only process IO subchannel and vfio-ccw devices to keep the list sane */
|
|
|
2ba5aa |
+ if (STRNEQ(def->driver, "io_subchannel") &&
|
|
|
2ba5aa |
+ STRNEQ(def->driver, "vfio_ccw"))
|
|
|
2ba5aa |
+ return -1;
|
|
|
2ba5aa |
+
|
|
|
2ba5aa |
+ if (udevGetCCWAddress(def->sysfs_path, &def->caps->data) < 0)
|
|
|
2ba5aa |
+ return -1;
|
|
|
2ba5aa |
+
|
|
|
2ba5aa |
+ if (udevGenerateDeviceName(device, def, NULL) != 0)
|
|
|
2ba5aa |
+ return -1;
|
|
|
2ba5aa |
+
|
|
|
2ba5aa |
+ return 0;
|
|
|
2ba5aa |
+}
|
|
|
2ba5aa |
+
|
|
|
2ba5aa |
static int
|
|
|
2ba5aa |
udevGetDeviceNodes(struct udev_device *device,
|
|
|
2ba5aa |
virNodeDeviceDefPtr def)
|
|
|
2ba5aa |
@@ -1175,6 +1193,8 @@ udevGetDeviceType(struct udev_device *device,
|
|
|
2ba5aa |
*type = VIR_NODE_DEV_CAP_MDEV;
|
|
|
2ba5aa |
else if (STREQ_NULLABLE(subsystem, "ccw"))
|
|
|
2ba5aa |
*type = VIR_NODE_DEV_CAP_CCW_DEV;
|
|
|
2ba5aa |
+ else if (STREQ_NULLABLE(subsystem, "css"))
|
|
|
2ba5aa |
+ *type = VIR_NODE_DEV_CAP_CSS_DEV;
|
|
|
2ba5aa |
|
|
|
2ba5aa |
VIR_FREE(subsystem);
|
|
|
2ba5aa |
}
|
|
|
2ba5aa |
@@ -1219,6 +1239,8 @@ udevGetDeviceDetails(struct udev_device *device,
|
|
|
2ba5aa |
return udevProcessMediatedDevice(device, def);
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_CCW_DEV:
|
|
|
2ba5aa |
return udevProcessCCW(device, def);
|
|
|
2ba5aa |
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
|
|
2ba5aa |
+ return udevProcessCSS(device, def);
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_SYSTEM:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_FC_HOST:
|
|
|
2ba5aa |
diff --git a/tests/nodedevschemadata/ccw_0_0_10000-invalid.xml b/tests/nodedevschemadata/ccw_0_0_10000-invalid.xml
|
|
|
2ba5aa |
index d840555c09..f3cf0c1c66 100644
|
|
|
2ba5aa |
--- a/tests/nodedevschemadata/ccw_0_0_10000-invalid.xml
|
|
|
2ba5aa |
+++ b/tests/nodedevschemadata/ccw_0_0_10000-invalid.xml
|
|
|
2ba5aa |
@@ -1,7 +1,7 @@
|
|
|
2ba5aa |
<device>
|
|
|
2ba5aa |
<name>ccw_0_0_10000</name>
|
|
|
2ba5aa |
- <path>/sys/devices/css0/0.0.0000/0.0.10000</path>
|
|
|
2ba5aa |
- <parent>computer</parent>
|
|
|
2ba5aa |
+ <path>/sys/devices/css0/0.0.0070/0.0.10000</path>
|
|
|
2ba5aa |
+ <parent>css_0_0_0070</parent>
|
|
|
2ba5aa |
<capability type='ccw'>
|
|
|
2ba5aa |
<cssid>0x0</cssid>
|
|
|
2ba5aa |
<ssid>0x0</ssid>
|
|
|
2ba5aa |
diff --git a/tests/nodedevschemadata/ccw_0_0_ffff.xml b/tests/nodedevschemadata/ccw_0_0_ffff.xml
|
|
|
2ba5aa |
index 5ecd0b0aae..3b8ea46e37 100644
|
|
|
2ba5aa |
--- a/tests/nodedevschemadata/ccw_0_0_ffff.xml
|
|
|
2ba5aa |
+++ b/tests/nodedevschemadata/ccw_0_0_ffff.xml
|
|
|
2ba5aa |
@@ -1,7 +1,7 @@
|
|
|
2ba5aa |
<device>
|
|
|
2ba5aa |
<name>ccw_0_0_ffff</name>
|
|
|
2ba5aa |
- <path>/sys/devices/css0/0.0.0000/0.0.ffff</path>
|
|
|
2ba5aa |
- <parent>computer</parent>
|
|
|
2ba5aa |
+ <path>/sys/devices/css0/0.0.0070/0.0.ffff</path>
|
|
|
2ba5aa |
+ <parent>css_0_0_0070</parent>
|
|
|
2ba5aa |
<capability type='ccw'>
|
|
|
2ba5aa |
<cssid>0x0</cssid>
|
|
|
2ba5aa |
<ssid>0x0</ssid>
|
|
|
2ba5aa |
diff --git a/tests/nodedevschemadata/css_0_0_ffff.xml b/tests/nodedevschemadata/css_0_0_ffff.xml
|
|
|
2ba5aa |
new file mode 100644
|
|
|
2ba5aa |
index 0000000000..312e07fe65
|
|
|
2ba5aa |
--- /dev/null
|
|
|
2ba5aa |
+++ b/tests/nodedevschemadata/css_0_0_ffff.xml
|
|
|
2ba5aa |
@@ -0,0 +1,10 @@
|
|
|
2ba5aa |
+<device>
|
|
|
2ba5aa |
+ <name>css_0_0_ffff</name>
|
|
|
2ba5aa |
+ <path>/sys/devices/css0/0.0.ffff</path>
|
|
|
2ba5aa |
+ <parent>computer</parent>
|
|
|
2ba5aa |
+ <capability type='css'>
|
|
|
2ba5aa |
+ <cssid>0x0</cssid>
|
|
|
2ba5aa |
+ <ssid>0x0</ssid>
|
|
|
2ba5aa |
+ <devno>0xffff</devno>
|
|
|
2ba5aa |
+ </capability>
|
|
|
2ba5aa |
+</device>
|
|
|
2ba5aa |
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
|
|
|
2ba5aa |
index 6168c29c70..3cb23b1df4 100644
|
|
|
2ba5aa |
--- a/tests/nodedevxml2xmltest.c
|
|
|
2ba5aa |
+++ b/tests/nodedevxml2xmltest.c
|
|
|
2ba5aa |
@@ -123,6 +123,7 @@ mymain(void)
|
|
|
2ba5aa |
DO_TEST("pci_0000_02_10_7_mdev_types");
|
|
|
2ba5aa |
DO_TEST("mdev_3627463d_b7f0_4fea_b468_f1da537d301b");
|
|
|
2ba5aa |
DO_TEST("ccw_0_0_ffff");
|
|
|
2ba5aa |
+ DO_TEST("css_0_0_ffff");
|
|
|
2ba5aa |
|
|
|
2ba5aa |
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
|
2ba5aa |
}
|
|
|
2ba5aa |
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
|
|
|
2ba5aa |
index cb2fc26d1a..26b3acc608 100644
|
|
|
2ba5aa |
--- a/tools/virsh-nodedev.c
|
|
|
2ba5aa |
+++ b/tools/virsh-nodedev.c
|
|
|
2ba5aa |
@@ -461,6 +461,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_CCW_DEV:
|
|
|
2ba5aa |
flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV;
|
|
|
2ba5aa |
break;
|
|
|
2ba5aa |
+ case VIR_NODE_DEV_CAP_CSS_DEV:
|
|
|
2ba5aa |
case VIR_NODE_DEV_CAP_LAST:
|
|
|
2ba5aa |
break;
|
|
|
2ba5aa |
}
|
|
|
2ba5aa |
--
|
|
|
2ba5aa |
2.28.0
|
|
|
2ba5aa |
|