mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
node_device: detect CSS devices
Make channel subsystem (CSS) devices available in the node_device driver. The CCS devices reside in the computer system and provide CCW devices, e.g.: +- css_0_0_003a | +- ccw_0_0_1a2b | +- scsi_host0 | +- scsi_target0_0_0 | +- scsi_0_0_0_0 Reviewed-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com> Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
This commit is contained in:
parent
0e7f8bb6c1
commit
05e6cdafa6
@ -85,6 +85,7 @@
|
||||
<ref name="capdrm"/>
|
||||
<ref name="capmdev"/>
|
||||
<ref name="capccwdev"/>
|
||||
<ref name="capcssdev"/>
|
||||
</choice>
|
||||
</element>
|
||||
</define>
|
||||
@ -659,6 +660,21 @@
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='capcssdev'>
|
||||
<attribute name='type'>
|
||||
<value>css</value>
|
||||
</attribute>
|
||||
<element name='cssid'>
|
||||
<ref name='ccwCssidRange'/>
|
||||
</element>
|
||||
<element name='ssid'>
|
||||
<ref name='ccwSsidRange'/>
|
||||
</element>
|
||||
<element name='devno'>
|
||||
<ref name='ccwDevnoRange'/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='address'>
|
||||
<element name='address'>
|
||||
<attribute name='domain'><ref name='hexuint'/></attribute>
|
||||
|
@ -65,6 +65,7 @@ VIR_ENUM_IMPL(virNodeDevCap,
|
||||
"mdev_types",
|
||||
"mdev",
|
||||
"ccw",
|
||||
"css",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virNodeDevNetCap,
|
||||
@ -602,6 +603,7 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def)
|
||||
virNodeDeviceCapMdevDefFormat(&buf, data);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_CCW_DEV:
|
||||
case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
virBufferAsprintf(&buf, "<cssid>0x%x</cssid>\n",
|
||||
data->ccw_dev.cssid);
|
||||
virBufferAsprintf(&buf, "<ssid>0x%x</ssid>\n",
|
||||
@ -1904,6 +1906,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
||||
ret = virNodeDevCapMdevParseXML(ctxt, def, node, &caps->data.mdev);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_CCW_DEV:
|
||||
case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
ret = virNodeDevCapCCWParseXML(ctxt, def, node, &caps->data.ccw_dev);
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
||||
@ -2228,6 +2231,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
|
||||
case VIR_NODE_DEV_CAP_FC_HOST:
|
||||
case VIR_NODE_DEV_CAP_VPORTS:
|
||||
case VIR_NODE_DEV_CAP_CCW_DEV:
|
||||
case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
case VIR_NODE_DEV_CAP_LAST:
|
||||
/* This case is here to shutup the compiler */
|
||||
break;
|
||||
@ -2281,6 +2285,7 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def)
|
||||
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_CSS_DEV:
|
||||
case VIR_NODE_DEV_CAP_LAST:
|
||||
break;
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ typedef enum {
|
||||
VIR_NODE_DEV_CAP_MDEV_TYPES, /* Device capable of mediated devices */
|
||||
VIR_NODE_DEV_CAP_MDEV, /* Mediated device */
|
||||
VIR_NODE_DEV_CAP_CCW_DEV, /* s390 CCW device */
|
||||
VIR_NODE_DEV_CAP_CSS_DEV, /* s390 channel subsystem device */
|
||||
|
||||
VIR_NODE_DEV_CAP_LAST
|
||||
} virNodeDevCapType;
|
||||
|
@ -710,6 +710,7 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj,
|
||||
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_CSS_DEV:
|
||||
case VIR_NODE_DEV_CAP_LAST:
|
||||
break;
|
||||
}
|
||||
|
@ -1097,6 +1097,24 @@ udevProcessCCW(struct udev_device *device,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
udevProcessCSS(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
/* only process IO subchannel and vfio-ccw devices to keep the list sane */
|
||||
if (STRNEQ(def->driver, "io_subchannel") &&
|
||||
STRNEQ(def->driver, "vfio_ccw"))
|
||||
return -1;
|
||||
|
||||
if (udevGetCCWAddress(def->sysfs_path, &def->caps->data) < 0)
|
||||
return -1;
|
||||
|
||||
if (udevGenerateDeviceName(device, def, NULL) != 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
udevGetDeviceNodes(struct udev_device *device,
|
||||
virNodeDeviceDefPtr def)
|
||||
@ -1175,6 +1193,8 @@ udevGetDeviceType(struct udev_device *device,
|
||||
*type = VIR_NODE_DEV_CAP_MDEV;
|
||||
else if (STREQ_NULLABLE(subsystem, "ccw"))
|
||||
*type = VIR_NODE_DEV_CAP_CCW_DEV;
|
||||
else if (STREQ_NULLABLE(subsystem, "css"))
|
||||
*type = VIR_NODE_DEV_CAP_CSS_DEV;
|
||||
|
||||
VIR_FREE(subsystem);
|
||||
}
|
||||
@ -1219,6 +1239,8 @@ udevGetDeviceDetails(struct udev_device *device,
|
||||
return udevProcessMediatedDevice(device, def);
|
||||
case VIR_NODE_DEV_CAP_CCW_DEV:
|
||||
return udevProcessCCW(device, def);
|
||||
case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
return udevProcessCSS(device, def);
|
||||
case VIR_NODE_DEV_CAP_MDEV_TYPES:
|
||||
case VIR_NODE_DEV_CAP_SYSTEM:
|
||||
case VIR_NODE_DEV_CAP_FC_HOST:
|
||||
|
@ -1,7 +1,7 @@
|
||||
<device>
|
||||
<name>ccw_0_0_10000</name>
|
||||
<path>/sys/devices/css0/0.0.0000/0.0.10000</path>
|
||||
<parent>computer</parent>
|
||||
<path>/sys/devices/css0/0.0.0070/0.0.10000</path>
|
||||
<parent>css_0_0_0070</parent>
|
||||
<capability type='ccw'>
|
||||
<cssid>0x0</cssid>
|
||||
<ssid>0x0</ssid>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<device>
|
||||
<name>ccw_0_0_ffff</name>
|
||||
<path>/sys/devices/css0/0.0.0000/0.0.ffff</path>
|
||||
<parent>computer</parent>
|
||||
<path>/sys/devices/css0/0.0.0070/0.0.ffff</path>
|
||||
<parent>css_0_0_0070</parent>
|
||||
<capability type='ccw'>
|
||||
<cssid>0x0</cssid>
|
||||
<ssid>0x0</ssid>
|
||||
|
10
tests/nodedevschemadata/css_0_0_ffff.xml
Normal file
10
tests/nodedevschemadata/css_0_0_ffff.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<device>
|
||||
<name>css_0_0_ffff</name>
|
||||
<path>/sys/devices/css0/0.0.ffff</path>
|
||||
<parent>computer</parent>
|
||||
<capability type='css'>
|
||||
<cssid>0x0</cssid>
|
||||
<ssid>0x0</ssid>
|
||||
<devno>0xffff</devno>
|
||||
</capability>
|
||||
</device>
|
@ -123,6 +123,7 @@ mymain(void)
|
||||
DO_TEST("pci_0000_02_10_7_mdev_types");
|
||||
DO_TEST("mdev_3627463d_b7f0_4fea_b468_f1da537d301b");
|
||||
DO_TEST("ccw_0_0_ffff");
|
||||
DO_TEST("css_0_0_ffff");
|
||||
|
||||
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
@ -461,6 +461,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED)
|
||||
case VIR_NODE_DEV_CAP_CCW_DEV:
|
||||
flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV;
|
||||
break;
|
||||
case VIR_NODE_DEV_CAP_CSS_DEV:
|
||||
case VIR_NODE_DEV_CAP_LAST:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user