|
|
3a9410 |
From 5921eeddf0a284ccbec04896901c9bd4177de6dd Mon Sep 17 00:00:00 2001
|
|
|
3a9410 |
Message-Id: <5921eeddf0a284ccbec04896901c9bd4177de6dd@dist-git>
|
|
|
3a9410 |
From: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
|
3a9410 |
Date: Fri, 13 May 2022 12:31:15 +0200
|
|
|
3a9410 |
Subject: [PATCH] nodedev: add optional device address of channel device to css
|
|
|
3a9410 |
device
|
|
|
3a9410 |
|
|
|
3a9410 |
Add the new introduced sysfs attribute dev_busid which provides the address
|
|
|
3a9410 |
of the device in the subchannel independent from the bound device driver.
|
|
|
3a9410 |
It is added if available in the sysfs as optional channel_dev_addr element into
|
|
|
3a9410 |
the css device capabilty providing the ccw deivce address attributes cssid,
|
|
|
3a9410 |
ssid and devno.
|
|
|
3a9410 |
|
|
|
3a9410 |
Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
|
|
3a9410 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
3a9410 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
3a9410 |
(cherry picked from commit 122b975e4004c83b6fc442ec6cdfd71eb5b55cc4)
|
|
|
3a9410 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2165011
|
|
|
3a9410 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
3a9410 |
---
|
|
|
3a9410 |
docs/schemas/nodedev.rng | 5 +++++
|
|
|
3a9410 |
src/conf/node_device_conf.c | 28 ++++++++++++++++++++++++++++
|
|
|
3a9410 |
src/conf/node_device_conf.h | 2 ++
|
|
|
3a9410 |
src/node_device/node_device_udev.c | 8 ++++++++
|
|
|
3a9410 |
4 files changed, 43 insertions(+)
|
|
|
3a9410 |
|
|
|
3a9410 |
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng
|
|
|
3a9410 |
index 29515d2d7e..43f1abc247 100644
|
|
|
3a9410 |
--- a/docs/schemas/nodedev.rng
|
|
|
3a9410 |
+++ b/docs/schemas/nodedev.rng
|
|
|
3a9410 |
@@ -677,6 +677,11 @@
|
|
|
3a9410 |
<value>css</value>
|
|
|
3a9410 |
</attribute>
|
|
|
3a9410 |
<ref name="capccwaddress"/>
|
|
|
3a9410 |
+ <optional>
|
|
|
3a9410 |
+ <element name="channel_dev_addr">
|
|
|
3a9410 |
+ <ref name="capccwaddress"/>
|
|
|
3a9410 |
+ </element>
|
|
|
3a9410 |
+ </optional>
|
|
|
3a9410 |
<optional>
|
|
|
3a9410 |
<ref name="mdev_types"/>
|
|
|
3a9410 |
</optional>
|
|
|
3a9410 |
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
|
|
|
3a9410 |
index fcb5be24e1..16b9497faf 100644
|
|
|
3a9410 |
--- a/src/conf/node_device_conf.c
|
|
|
3a9410 |
+++ b/src/conf/node_device_conf.c
|
|
|
3a9410 |
@@ -643,6 +643,17 @@ virNodeDeviceCapCSSDefFormat(virBuffer *buf,
|
|
|
3a9410 |
|
|
|
3a9410 |
virNodeDeviceCapCCWDefFormat(buf, data);
|
|
|
3a9410 |
|
|
|
3a9410 |
+ if (ccw_dev.channel_dev_addr) {
|
|
|
3a9410 |
+ virCCWDeviceAddress *ccw = ccw_dev.channel_dev_addr;
|
|
|
3a9410 |
+ virBufferAddLit(buf, "<channel_dev_addr>\n");
|
|
|
3a9410 |
+ virBufferAdjustIndent(buf, 2);
|
|
|
3a9410 |
+ virBufferAsprintf(buf, "<cssid>0x%x</cssid>\n", ccw->cssid);
|
|
|
3a9410 |
+ virBufferAsprintf(buf, "<ssid>0x%x</ssid>\n", ccw->ssid);
|
|
|
3a9410 |
+ virBufferAsprintf(buf, "<devno>0x%04x</devno>\n", ccw->devno);
|
|
|
3a9410 |
+ virBufferAdjustIndent(buf, -2);
|
|
|
3a9410 |
+ virBufferAddLit(buf, "</channel_dev_addr>\n");
|
|
|
3a9410 |
+ }
|
|
|
3a9410 |
+
|
|
|
3a9410 |
if (ccw_dev.flags & VIR_NODE_DEV_CAP_FLAG_CSS_MDEV)
|
|
|
3a9410 |
virNodeDeviceCapMdevTypesFormat(buf,
|
|
|
3a9410 |
ccw_dev.mdev_types,
|
|
|
3a9410 |
@@ -1255,6 +1266,7 @@ virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt,
|
|
|
3a9410 |
g_autofree xmlNodePtr *nodes = NULL;
|
|
|
3a9410 |
int n = 0;
|
|
|
3a9410 |
size_t i = 0;
|
|
|
3a9410 |
+ xmlNodePtr channel_ddno = NULL;
|
|
|
3a9410 |
|
|
|
3a9410 |
ctxt->node = node;
|
|
|
3a9410 |
|
|
|
3a9410 |
@@ -1269,6 +1281,21 @@ virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt,
|
|
|
3a9410 |
return -1;
|
|
|
3a9410 |
}
|
|
|
3a9410 |
|
|
|
3a9410 |
+ /* channel_dev_addr is optional */
|
|
|
3a9410 |
+ if ((channel_ddno = virXPathNode("./channel_dev_addr[1]", ctxt))) {
|
|
|
3a9410 |
+ g_autofree virCCWDeviceAddress *channel_dev = NULL;
|
|
|
3a9410 |
+
|
|
|
3a9410 |
+ channel_dev = g_new0(virCCWDeviceAddress, 1);
|
|
|
3a9410 |
+
|
|
|
3a9410 |
+ if (virNodeDevCCWDeviceAddressParseXML(ctxt,
|
|
|
3a9410 |
+ channel_ddno,
|
|
|
3a9410 |
+ def->name,
|
|
|
3a9410 |
+ channel_dev) < 0)
|
|
|
3a9410 |
+ return -1;
|
|
|
3a9410 |
+
|
|
|
3a9410 |
+ ccw_dev->channel_dev_addr = g_steal_pointer(&channel_dev);
|
|
|
3a9410 |
+ }
|
|
|
3a9410 |
+
|
|
|
3a9410 |
return 0;
|
|
|
3a9410 |
}
|
|
|
3a9410 |
|
|
|
3a9410 |
@@ -2637,6 +2664,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDef *caps)
|
|
|
3a9410 |
for (i = 0; i < data->ccw_dev.nmdev_types; i++)
|
|
|
3a9410 |
virMediatedDeviceTypeFree(data->ccw_dev.mdev_types[i]);
|
|
|
3a9410 |
g_free(data->ccw_dev.mdev_types);
|
|
|
3a9410 |
+ g_free(data->ccw_dev.channel_dev_addr);
|
|
|
3a9410 |
break;
|
|
|
3a9410 |
case VIR_NODE_DEV_CAP_AP_MATRIX:
|
|
|
3a9410 |
g_free(data->ap_matrix.addr);
|
|
|
3a9410 |
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
|
|
|
3a9410 |
index e4d1f67d53..d1751ed874 100644
|
|
|
3a9410 |
--- a/src/conf/node_device_conf.h
|
|
|
3a9410 |
+++ b/src/conf/node_device_conf.h
|
|
|
3a9410 |
@@ -24,6 +24,7 @@
|
|
|
3a9410 |
|
|
|
3a9410 |
#include "internal.h"
|
|
|
3a9410 |
#include "virbitmap.h"
|
|
|
3a9410 |
+#include "virccw.h"
|
|
|
3a9410 |
#include "virpcivpd.h"
|
|
|
3a9410 |
#include "virscsihost.h"
|
|
|
3a9410 |
#include "virpci.h"
|
|
|
3a9410 |
@@ -279,6 +280,7 @@ struct _virNodeDevCapCCW {
|
|
|
3a9410 |
unsigned int flags; /* enum virNodeDevCCWCapFlags */
|
|
|
3a9410 |
virMediatedDeviceType **mdev_types;
|
|
|
3a9410 |
size_t nmdev_types;
|
|
|
3a9410 |
+ virCCWDeviceAddress *channel_dev_addr;
|
|
|
3a9410 |
};
|
|
|
3a9410 |
|
|
|
3a9410 |
typedef struct _virNodeDevCapVDPA virNodeDevCapVDPA;
|
|
|
3a9410 |
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
|
|
|
3a9410 |
index ffcb3e8640..611a2592ca 100644
|
|
|
3a9410 |
--- a/src/node_device/node_device_udev.c
|
|
|
3a9410 |
+++ b/src/node_device/node_device_udev.c
|
|
|
3a9410 |
@@ -1128,6 +1128,8 @@ static int
|
|
|
3a9410 |
udevProcessCSS(struct udev_device *device,
|
|
|
3a9410 |
virNodeDeviceDef *def)
|
|
|
3a9410 |
{
|
|
|
3a9410 |
+ g_autofree char *dev_busid = NULL;
|
|
|
3a9410 |
+
|
|
|
3a9410 |
/* only process IO subchannel and vfio-ccw devices to keep the list sane */
|
|
|
3a9410 |
if (!def->driver ||
|
|
|
3a9410 |
(STRNEQ(def->driver, "io_subchannel") &&
|
|
|
3a9410 |
@@ -1139,6 +1141,12 @@ udevProcessCSS(struct udev_device *device,
|
|
|
3a9410 |
|
|
|
3a9410 |
udevGenerateDeviceName(device, def, NULL);
|
|
|
3a9410 |
|
|
|
3a9410 |
+ /* process optional channel devices information */
|
|
|
3a9410 |
+ udevGetStringSysfsAttr(device, "dev_busid", &dev_busid);
|
|
|
3a9410 |
+
|
|
|
3a9410 |
+ if (dev_busid != NULL)
|
|
|
3a9410 |
+ def->caps->data.ccw_dev.channel_dev_addr = virCCWDeviceAddressFromString(dev_busid);
|
|
|
3a9410 |
+
|
|
|
3a9410 |
if (virNodeDeviceGetCSSDynamicCaps(def->sysfs_path, &def->caps->data.ccw_dev) < 0)
|
|
|
3a9410 |
return -1;
|
|
|
3a9410 |
|
|
|
3a9410 |
--
|
|
|
3a9410 |
2.39.1
|
|
|
3a9410 |
|