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