From nobody Sun Feb 8 14:11:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1603278054; cv=none; d=zohomail.com; s=zohoarc; b=faw5VvwrNaqeTq/KVS9pGvaVD38oKgXsjOVHWNT+Dy8+id0pE6H+huP/YuVSdVLJrszIxPWI6KRT5aBDE1r91Lxym+l7+c+PjwbCO500Mi4VK5YV81n7nN3lz8w2Fb47swjJ6xkL3/8ME9a7cmQKHmdDE/Zim5EYZ+y3l5MNICY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603278054; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DfHHIHq9i9Ef6/0C0J7sfior4YptomMphzA3yflSov0=; b=jefncgpT3KOK7yjRWx14h730boQa94X1omx6UlIVpg93+Tny++Xo3qxrAMTsoLmg0qk6ZNKJ/GDIbchjjIgWLNEz3NO41ZL5V2I1NBu2xeGu3DGQ5ZLMY6AqUAs1J+vAzfFffAY10dpAPRee4JbCf6LNYcMsSc7fTMYV7N9/C9U= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1603278054830503.41378400368603; Wed, 21 Oct 2020 04:00:54 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-492-m4v_1dzkNBa9OinCWclQmQ-1; Wed, 21 Oct 2020 07:00:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E74D410E2181; Wed, 21 Oct 2020 11:00:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFF742616B; Wed, 21 Oct 2020 11:00:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 891EF181A06D; Wed, 21 Oct 2020 11:00:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09LB0NiX025211 for ; Wed, 21 Oct 2020 07:00:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id D3ADA114B304; Wed, 21 Oct 2020 11:00:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF148114B303 for ; Wed, 21 Oct 2020 11:00:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8A18E85829E for ; Wed, 21 Oct 2020 11:00:20 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-452-7PArFrPEM42NgNPu2Y_A0A-1; Wed, 21 Oct 2020 07:00:18 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09LAVhwL004382 for ; Wed, 21 Oct 2020 07:00:17 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 34ak37h2qq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 21 Oct 2020 07:00:16 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 09LAwPsJ014842 for ; Wed, 21 Oct 2020 11:00:13 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06ams.nl.ibm.com with ESMTP id 347qvhc7sj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 21 Oct 2020 11:00:13 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 09LB0A2e28574028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Oct 2020 11:00:10 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1213FA4078; Wed, 21 Oct 2020 11:00:10 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7B89A4053; Wed, 21 Oct 2020 11:00:09 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 21 Oct 2020 11:00:09 +0000 (GMT) X-MC-Unique: m4v_1dzkNBa9OinCWclQmQ-1 X-MC-Unique: 7PArFrPEM42NgNPu2Y_A0A-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v1 4/7] nodedev: detect AP Matrix device Date: Wed, 21 Oct 2020 12:59:59 +0200 Message-Id: <20201021110002.303518-5-shalini@linux.ibm.com> In-Reply-To: <20201021110002.303518-1-shalini@linux.ibm.com> References: <20201021110002.303518-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.737 definitions=2020-10-21_03:2020-10-20, 2020-10-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 suspectscore=2 bulkscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010210078 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.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Shalini Chellathurai Saroja X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Content-Type: text/plain; charset="utf-8" Add support for AP matrix device in libvirt nodedev driver. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- docs/schemas/nodedev.rng | 7 ++++++ src/conf/node_device_conf.c | 10 +++++++- src/conf/node_device_conf.h | 8 +++++++ src/conf/virnodedeviceobj.c | 1 + src/node_device/node_device_udev.c | 23 +++++++++++++++++++ tests/nodedevschemadata/ap_matrix.xml | 7 ++++++ ...v_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml | 9 ++++++++ tests/nodedevxml2xmltest.c | 2 ++ tools/virsh-nodedev.c | 1 + 9 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tests/nodedevschemadata/ap_matrix.xml create mode 100644 tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2= a01e8e48ad.xml diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 5f812c8f..7c017ff1 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -88,6 +88,7 @@ + @@ -698,6 +699,12 @@ =20 + + + ap_matrix + + + diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index d27b0c71..33c9a020 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -68,6 +68,7 @@ VIR_ENUM_IMPL(virNodeDevCap, "css", "ap_card", "ap_queue", + "ap_matrix", ); =20 VIR_ENUM_IMPL(virNodeDevNetCap, @@ -626,6 +627,7 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_FC_HOST: case VIR_NODE_DEV_CAP_VPORTS: + case VIR_NODE_DEV_CAP_AP_MATRIX: case VIR_NODE_DEV_CAP_LAST: break; } @@ -1995,6 +1997,9 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, ret =3D virNodeDevCapAPQueueParseXML(ctxt, def, node, &caps->data.ap_queue); break; + case VIR_NODE_DEV_CAP_AP_MATRIX: + ret =3D 0; + break; case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_FC_HOST: case VIR_NODE_DEV_CAP_VPORTS: @@ -2310,6 +2315,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) virMediatedDeviceAttrFree(data->mdev.attributes[i]); VIR_FREE(data->mdev.attributes); break; + case VIR_NODE_DEV_CAP_AP_MATRIX: + VIR_FREE(data->ap_matrix.addr); + break; case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_DRM: case VIR_NODE_DEV_CAP_FC_HOST: @@ -2374,6 +2382,7 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def) case VIR_NODE_DEV_CAP_CSS_DEV: case VIR_NODE_DEV_CAP_AP_CARD: case VIR_NODE_DEV_CAP_AP_QUEUE: + case VIR_NODE_DEV_CAP_AP_MATRIX: case VIR_NODE_DEV_CAP_LAST: break; } @@ -2722,7 +2731,6 @@ virNodeDeviceGetPCIDynamicCaps(const char *sysfsPath = G_GNUC_UNUSED, return -1; } =20 - int virNodeDeviceGetSCSITargetCaps(const char *sysfsPath G_GNUC_UNUSED, virNodeDevCapSCSITargetPtr scsi_target = G_GNUC_UNUSED) { diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index d732efaa..f1e57ad7 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -67,6 +67,7 @@ typedef enum { VIR_NODE_DEV_CAP_CSS_DEV, /* s390 channel subsystem device */ VIR_NODE_DEV_CAP_AP_CARD, /* s390 AP Card device */ VIR_NODE_DEV_CAP_AP_QUEUE, /* s390 AP Queue */ + VIR_NODE_DEV_CAP_AP_MATRIX, /* s390 AP Matrix device */ =20 VIR_NODE_DEV_CAP_LAST } virNodeDevCapType; @@ -290,6 +291,12 @@ struct _virNodeDevCapAPQueue { unsigned int ap_domain; }; =20 +typedef struct _virNodeDevCapAPMatrix virNodeDevCapAPMatrix; +typedef virNodeDevCapAPMatrix *virNodeDevCapAPMatrixPtr; +struct _virNodeDevCapAPMatrix { + char *addr; +}; + typedef struct _virNodeDevCapData virNodeDevCapData; typedef virNodeDevCapData *virNodeDevCapDataPtr; struct _virNodeDevCapData { @@ -310,6 +317,7 @@ struct _virNodeDevCapData { virNodeDevCapCCW ccw_dev; virNodeDevCapAPCard ap_card; virNodeDevCapAPQueue ap_queue; + virNodeDevCapAPMatrix ap_matrix; }; }; =20 diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 0ce230db..a19017b8 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -713,6 +713,7 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj, case VIR_NODE_DEV_CAP_CSS_DEV: case VIR_NODE_DEV_CAP_AP_CARD: case VIR_NODE_DEV_CAP_AP_QUEUE: + case VIR_NODE_DEV_CAP_AP_MATRIX: case VIR_NODE_DEV_CAP_LAST: break; } diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 16a73db2..ea983726 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1191,6 +1191,25 @@ udevProcessAPQueue(struct udev_device *device, } =20 =20 +static int +udevProcessAPMatrix(struct udev_device *device, + virNodeDeviceDefPtr def) +{ + size_t i; + virNodeDevCapDataPtr data =3D &def->caps->data; + + data->ap_matrix.addr =3D g_strdup(udev_device_get_sysname(device)); + def->name =3D g_strdup_printf("ap_%s", data->ap_matrix.addr); + + for (i =3D 0; i < strlen(def->name); i++) { + if (!(g_ascii_isalnum(*(def->name + i)))) + *(def->name + i) =3D '_'; + } + + return 0; +} + + static int udevGetDeviceNodes(struct udev_device *device, virNodeDeviceDefPtr def) @@ -1274,6 +1293,8 @@ udevGetDeviceType(struct udev_device *device, *type =3D VIR_NODE_DEV_CAP_CCW_DEV; else if (STREQ_NULLABLE(subsystem, "css")) *type =3D VIR_NODE_DEV_CAP_CSS_DEV; + else if (STREQ_NULLABLE(subsystem, "matrix")) + *type =3D VIR_NODE_DEV_CAP_AP_MATRIX; =20 VIR_FREE(subsystem); } @@ -1324,6 +1345,8 @@ udevGetDeviceDetails(struct udev_device *device, return udevProcessAPCard(device, def); case VIR_NODE_DEV_CAP_AP_QUEUE: return udevProcessAPQueue(device, def); + case VIR_NODE_DEV_CAP_AP_MATRIX: + return udevProcessAPMatrix(device, def); case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_SYSTEM: case VIR_NODE_DEV_CAP_FC_HOST: diff --git a/tests/nodedevschemadata/ap_matrix.xml b/tests/nodedevschemadat= a/ap_matrix.xml new file mode 100644 index 00000000..30dab9cf --- /dev/null +++ b/tests/nodedevschemadata/ap_matrix.xml @@ -0,0 +1,7 @@ + + ap_matrix + /sys/devices/vfio_ap/matrix + computer + + + diff --git a/tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e4= 8ad.xml b/tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad= .xml new file mode 100644 index 00000000..106f7593 --- /dev/null +++ b/tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml @@ -0,0 +1,9 @@ + + mdev_ee0b88c4-f554-4dc1-809d-b2a01e8e48ad + /sys/devices/vfio_ap/matrix/mdev_ee0b88c4-f554-4dc1-809d-b2a01e8e4= 8ad + ap_matrix + + + + + diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index d6ab25bf..69d72ff0 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -126,6 +126,8 @@ mymain(void) DO_TEST("css_0_0_ffff"); DO_TEST("ap_card07"); DO_TEST("ap_07_0038"); + DO_TEST("ap_matrix"); + DO_TEST("mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad"); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 3862d8f3..d39d87c7 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -470,6 +470,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G= _GNUC_UNUSED) case VIR_NODE_DEV_CAP_AP_QUEUE: flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE; break; + case VIR_NODE_DEV_CAP_AP_MATRIX: case VIR_NODE_DEV_CAP_LAST: break; } --=20 2.26.2