From nobody Sun Feb 8 16:30:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1652437911974224.29845888322507; Fri, 13 May 2022 03:31:51 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-484-0aANmLKaME6lqMNNQetTDQ-1; Fri, 13 May 2022 06:31:45 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 40F8A80378A; Fri, 13 May 2022 10:31:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C851438BE1; Fri, 13 May 2022 10:31:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BD0041932232; Fri, 13 May 2022 10:31:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D4C34192B8E9 for ; Fri, 13 May 2022 10:31:32 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B0F2DC53365; Fri, 13 May 2022 10:31:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ABDB4C53361 for ; Fri, 13 May 2022 10:31:32 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 933662919EC0 for ; Fri, 13 May 2022 10:31:31 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-624-aRVCJZj6OBSyWmbOBFebwQ-1; Fri, 13 May 2022 06:31:30 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24DA3TNx011442 for ; Fri, 13 May 2022 10:31:29 GMT Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1n898get-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 13 May 2022 10:31:29 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24DANS2B007310 for ; Fri, 13 May 2022 10:31:27 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 3fyrkk4aqg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 13 May 2022 10:31:27 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24DAVOt352167106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 May 2022 10:31:24 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9187411C04C; Fri, 13 May 2022 10:31:24 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 711AE11C052; Fri, 13 May 2022 10:31:24 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.93.141]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 May 2022 10:31:24 +0000 (GMT) X-MC-Unique: 0aANmLKaME6lqMNNQetTDQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: aRVCJZj6OBSyWmbOBFebwQ-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH 16/17] nodedev: add optional device address of channel device to css device Date: Fri, 13 May 2022 12:31:15 +0200 Message-Id: <20220513103116.3751-17-fiuczy@linux.ibm.com> In-Reply-To: <20220513103116.3751-1-fiuczy@linux.ibm.com> References: <20220513103116.3751-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: cYYXDeuuFd9Ng-y2uroB7p8uj0UqluMH X-Proofpoint-GUID: cYYXDeuuFd9Ng-y2uroB7p8uj0UqluMH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-13_04,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=800 spamscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205130043 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Fiuczynski Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1652437913127100002 Content-Type: text/plain; charset="utf-8"; x-default="true" Add the new introduced sysfs attribute dev_busid which provides the address of the device in the subchannel independent from the bound device driver. It is added if available in the sysfs as optional channel_dev_addr element = into the css device capabilty providing the ccw deivce address attributes cssid, ssid and devno. Signed-off-by: Boris Fiuczynski --- src/conf/node_device_conf.c | 26 ++++++++++++++++++++++++++ src/conf/node_device_conf.h | 2 ++ src/conf/schemas/nodedev.rng | 5 +++++ src/node_device/node_device_udev.c | 8 ++++++++ 4 files changed, 41 insertions(+) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 5aafcbb838..d5ee8da3ee 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -645,6 +645,17 @@ virNodeDeviceCapCSSDefFormat(virBuffer *buf, =20 virNodeDeviceCapCCWDefFormat(buf, data); =20 + if (ccw_dev.channel_dev_addr) { + virCCWDeviceAddress *ccw =3D ccw_dev.channel_dev_addr; + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + virBufferAsprintf(buf, "0x%x\n", ccw->cssid); + virBufferAsprintf(buf, "0x%x\n", ccw->ssid); + virBufferAsprintf(buf, "0x%04x\n", ccw->devno); + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } + if (ccw_dev.flags & VIR_NODE_DEV_CAP_FLAG_CSS_MDEV) virNodeDeviceCapMdevTypesFormat(buf, ccw_dev.mdev_types, @@ -1257,6 +1268,8 @@ virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt, g_autofree xmlNodePtr *nodes =3D NULL; int n =3D 0; size_t i =3D 0; + xmlNodePtr channel_ddno =3D NULL; + g_autofree virCCWDeviceAddress *channel_dev =3D NULL; =20 ctxt->node =3D node; =20 @@ -1271,6 +1284,19 @@ virNodeDevCapCSSParseXML(xmlXPathContextPtr ctxt, return -1; } =20 + // channel_dev_addr is optional + if ((channel_ddno =3D virXPathNode("./channel_dev_addr[1]", ctxt))) { + channel_dev =3D g_new0(virCCWDeviceAddress, 1); + + if (virNodeDevCCWDeviceAddressParseXML(ctxt, + channel_ddno, + def->name, + channel_dev) < 0) + return -1; + + ccw_dev->channel_dev_addr =3D g_steal_pointer(&channel_dev); + } + return 0; } =20 diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index e4d1f67d53..d1751ed874 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -24,6 +24,7 @@ =20 #include "internal.h" #include "virbitmap.h" +#include "virccw.h" #include "virpcivpd.h" #include "virscsihost.h" #include "virpci.h" @@ -279,6 +280,7 @@ struct _virNodeDevCapCCW { unsigned int flags; /* enum virNodeDevCCWCapFlags */ virMediatedDeviceType **mdev_types; size_t nmdev_types; + virCCWDeviceAddress *channel_dev_addr; }; =20 typedef struct _virNodeDevCapVDPA virNodeDevCapVDPA; diff --git a/src/conf/schemas/nodedev.rng b/src/conf/schemas/nodedev.rng index a9f83e048c..e40243e257 100644 --- a/src/conf/schemas/nodedev.rng +++ b/src/conf/schemas/nodedev.rng @@ -682,6 +682,11 @@ css + + + + + diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 4bb841c66b..16314627ca 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1124,6 +1124,8 @@ static int udevProcessCSS(struct udev_device *device, virNodeDeviceDef *def) { + char *dev_busid; + /* only process IO subchannel and vfio-ccw devices to keep the list sa= ne */ if (!def->driver || (STRNEQ(def->driver, "io_subchannel") && @@ -1135,6 +1137,12 @@ udevProcessCSS(struct udev_device *device, =20 udevGenerateDeviceName(device, def, NULL); =20 + /* process optional channel devices information */ + udevGetStringSysfsAttr(device, "dev_busid", &dev_busid); + + if (dev_busid !=3D NULL) + def->caps->data.ccw_dev.channel_dev_addr =3D virCCWDeviceAddressFr= omString(dev_busid); + if (virNodeDeviceGetCSSDynamicCaps(def->sysfs_path, &def->caps->data.c= cw_dev) < 0) return -1; =20 --=20 2.33.1