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