From nobody Thu May 2 06:49:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1605183356; cv=none; d=zohomail.com; s=zohoarc; b=FSUZNhPfy4q/evmm8ZAb2jow+KCPY9bDH2FYztPKEuZgoG+8ffaeFKmPi+WUXQaD9z3NKeBnX5z4P5Y4OMQbCKTRhGrBtpmqiUAjWOG8M7DIkKElXDo+KU/LXr0vyAQISZu7qv9l0MRIOD6b03vbb3FIuwU2Sv/gzNs4C0eRsAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183356; 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=ufuc9GwnzlIIRqaNcGcHPlFyovfnweISGXB63dQKKnA=; b=LkNnXfnr134lEXaXi2k3dNTetiHdR8jrLKgvUAB3tItFuspx3UySBJCHTkBNtjQj2o9Wn/qozzRfso+1kbj0fML8MicyFJLXLb5JE6ez7XYWKVAUa6NouVDWrio7RZNY/eQjWNWXwDHMwZJ9SKdPi3tCMRSpGp48KOlItJ4W7sM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605183356717802.6201966968852; Thu, 12 Nov 2020 04:15:56 -0800 (PST) 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-535-QjFK1SS6OcmLgPUHcylFPw-1; Thu, 12 Nov 2020 07:15:53 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 05F731882FAB; Thu, 12 Nov 2020 12:15:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D62BD5D9E8; Thu, 12 Nov 2020 12:15:46 +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 C5F8358104; Thu, 12 Nov 2020 12:15:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACCFiWs032582 for ; Thu, 12 Nov 2020 07:15:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 257ADF51BF; Thu, 12 Nov 2020 12:15:44 +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 1F874F51A4 for ; Thu, 12 Nov 2020 12:15:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 034CE858290 for ; Thu, 12 Nov 2020 12:15:44 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-451-KQ61LoydMVKN86xA4dwYlQ-1; Thu, 12 Nov 2020 07:15:41 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC1QUG123021 for ; Thu, 12 Nov 2020 07:15:41 -0500 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 34rj5wynq0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:40 -0500 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 0ACC7vT1015562 for ; Thu, 12 Nov 2020 12:15:39 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 34njuh5mxy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:38 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFZvJ61604120 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:36 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6177C52065; Thu, 12 Nov 2020 12:15:35 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4466F52074; Thu, 12 Nov 2020 12:15:35 +0000 (GMT) X-MC-Unique: QjFK1SS6OcmLgPUHcylFPw-1 X-MC-Unique: KQ61LoydMVKN86xA4dwYlQ-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 01/11] nodedev: detect AP card device Date: Thu, 12 Nov 2020 13:15:09 +0100 Message-Id: <20201112121519.2212991-2-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 spamscore=0 phishscore=0 suspectscore=9 clxscore=1015 malwarescore=0 priorityscore=1501 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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.79 on 10.11.54.5 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.79 on 10.5.11.14 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" Introduce support for the Adjunct Processor (AP) crypto card device. Udev already detects the device, so add support for libvirt nodedev driver. Signed-off-by: Farhan Ali Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- docs/formatnode.html.in | 8 ++++++ docs/schemas/nodedev.rng | 34 ++++++++++++++++++++----- src/conf/node_device_conf.c | 41 ++++++++++++++++++++++++++++++ src/conf/node_device_conf.h | 8 ++++++ src/conf/virnodedeviceobj.c | 1 + src/node_device/node_device_udev.c | 29 +++++++++++++++++++++ tools/virsh-nodedev.c | 1 + 7 files changed, 116 insertions(+), 6 deletions(-) diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index c7df69c9..d10a79e3 100644 --- a/docs/formatnode.html.in +++ b/docs/formatnode.html.in @@ -431,6 +431,14 @@ device. +
ap_card
+
Describes the Adjunct Processor (AP) Card device on a S390 h= ost. + Sub-elements include: +
+
ap-adapter
+
AP Card identifier.
+
+
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index b3e98665..d02e5377 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -87,6 +87,7 @@ + @@ -668,12 +669,21 @@ =20 - - - - - - + + + ap_card + + + + + + + + + + + + =20 @@ -716,4 +726,16 @@ =20 + + + + (0x)?[0-9a-fA-F]{1,2} + + + 0 + 255 + + + + diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 4e2837c1..5d7a23cb 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -67,6 +67,7 @@ VIR_ENUM_IMPL(virNodeDevCap, "ccw", "css", "vdpa", + "ap_card", ); =20 VIR_ENUM_IMPL(virNodeDevNetCap, @@ -650,6 +651,10 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) case VIR_NODE_DEV_CAP_VDPA: virNodeDeviceCapVDPADefFormat(&buf, data); break; + case VIR_NODE_DEV_CAP_AP_CARD: + virBufferAsprintf(&buf, "0x%02x\n", + data->ap_card.ap_adapter); + break; case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_FC_HOST: case VIR_NODE_DEV_CAP_VPORTS: @@ -941,6 +946,36 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt, } =20 =20 +static int +virNodeDevCapAPCardParseXML(xmlXPathContextPtr ctxt, + virNodeDeviceDefPtr def, + xmlNodePtr node, + virNodeDevCapAPCardPtr ap_card) +{ + xmlNodePtr orig; + g_autofree char *adapter =3D NULL; + + orig =3D ctxt->node; + ctxt->node =3D node; + + if (!(adapter =3D virXPathString("string(./ap-adapter[1])", ctxt))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("missing ap-adapter value for '%s'"), def->name); + return -1; + } + + if (virStrToLong_uip(adapter, NULL, 0, &ap_card->ap_adapter) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid ap-adapter value '%s' for '%s'"), + adapter, def->name); + return -1; + } + + ctxt->node =3D orig; + return 0; +} + + static int virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virNodeDeviceDefPtr def, @@ -1979,6 +2014,10 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, case VIR_NODE_DEV_CAP_CSS_DEV: ret =3D virNodeDevCapCCWParseXML(ctxt, def, node, &caps->data.ccw_= dev); break; + case VIR_NODE_DEV_CAP_AP_CARD: + ret =3D virNodeDevCapAPCardParseXML(ctxt, def, node, + &caps->data.ap_card); + break; case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_FC_HOST: case VIR_NODE_DEV_CAP_VPORTS: @@ -2306,6 +2345,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) case VIR_NODE_DEV_CAP_VPORTS: case VIR_NODE_DEV_CAP_CCW_DEV: case VIR_NODE_DEV_CAP_VDPA: + case VIR_NODE_DEV_CAP_AP_CARD: case VIR_NODE_DEV_CAP_LAST: /* This case is here to shutup the compiler */ break; @@ -2365,6 +2405,7 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def) case VIR_NODE_DEV_CAP_MDEV: case VIR_NODE_DEV_CAP_CCW_DEV: case VIR_NODE_DEV_CAP_VDPA: + case VIR_NODE_DEV_CAP_AP_CARD: case VIR_NODE_DEV_CAP_LAST: break; } diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 262524fc..f86f880c 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -66,6 +66,7 @@ typedef enum { VIR_NODE_DEV_CAP_CCW_DEV, /* s390 CCW device */ VIR_NODE_DEV_CAP_CSS_DEV, /* s390 channel subsystem device */ VIR_NODE_DEV_CAP_VDPA, /* vDPA device */ + VIR_NODE_DEV_CAP_AP_CARD, /* s390 AP Card device */ =20 VIR_NODE_DEV_CAP_LAST } virNodeDevCapType; @@ -289,6 +290,12 @@ struct _virNodeDevCapVDPA { char *chardev; }; =20 +typedef struct _virNodeDevCapAPCard virNodeDevCapAPCard; +typedef virNodeDevCapAPCard *virNodeDevCapAPCardPtr; +struct _virNodeDevCapAPCard { + unsigned int ap_adapter; +}; + typedef struct _virNodeDevCapData virNodeDevCapData; typedef virNodeDevCapData *virNodeDevCapDataPtr; struct _virNodeDevCapData { @@ -308,6 +315,7 @@ struct _virNodeDevCapData { virNodeDevCapMdev mdev; virNodeDevCapCCW ccw_dev; virNodeDevCapVDPA vdpa; + virNodeDevCapAPCard ap_card; }; }; =20 diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 9e46d22a..0aa59289 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -717,6 +717,7 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj, case VIR_NODE_DEV_CAP_MDEV: case VIR_NODE_DEV_CAP_CCW_DEV: case VIR_NODE_DEV_CAP_VDPA: + case VIR_NODE_DEV_CAP_AP_CARD: 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 65f312d8..b4eb4553 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1193,6 +1193,31 @@ udevProcessVDPA(struct udev_device *device, } =20 =20 +static int +udevProcessAPCard(struct udev_device *device, + virNodeDeviceDefPtr def) +{ + char *c; + virNodeDevCapDataPtr data =3D &def->caps->data; + + /* The sysfs path would be in the format /sys/bus/ap/devices/cardXX, + where XX is the ap adapter id */ + if ((c =3D strrchr(def->sysfs_path, '/')) =3D=3D NULL || + virStrToLong_ui(c + 1 + strlen("card"), NULL, 16, + &data->ap_card.ap_adapter) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse the AP Card from sysfs path: '%s= '"), + def->sysfs_path); + return -1; + } + + if (udevGenerateDeviceName(device, def, NULL) !=3D 0) + return -1; + + return 0; +} + + static int udevGetDeviceNodes(struct udev_device *device, virNodeDeviceDefPtr def) @@ -1247,6 +1272,8 @@ udevGetDeviceType(struct udev_device *device, *type =3D VIR_NODE_DEV_CAP_NET; else if (STREQ(devtype, "drm_minor")) *type =3D VIR_NODE_DEV_CAP_DRM; + else if (STREQ(devtype, "ap_card")) + *type =3D VIR_NODE_DEV_CAP_AP_CARD; } else { /* PCI devices don't set the DEVTYPE property. */ if (udevHasDeviceProperty(device, "PCI_CLASS")) @@ -1322,6 +1349,8 @@ udevGetDeviceDetails(struct udev_device *device, return udevProcessCSS(device, def); case VIR_NODE_DEV_CAP_VDPA: return udevProcessVDPA(device, def); + case VIR_NODE_DEV_CAP_AP_CARD: + return udevProcessAPCard(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/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 527bf49f..32c12553 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -467,6 +467,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G= _GNUC_UNUSED) case VIR_NODE_DEV_CAP_VDPA: flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA; break; + case VIR_NODE_DEV_CAP_AP_CARD: case VIR_NODE_DEV_CAP_LAST: break; } --=20 2.26.2 From nobody Thu May 2 06:49:41 2024 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=1605183364; cv=none; d=zohomail.com; s=zohoarc; b=brR/4QNMMgfjAQAVk9rBA9dBytUFjYdGUOJRPSLj4ks9onw5OB1Ot75EJIXQefsDp61CFRY4KTY83yYLE2/58hze+keFa66CjJIaSRMnWQZRkgwlNjddkaBLCQJqrV+EO/CGjmMsCzliJyZx0jtjyEZA7ffwlYXwv5aCVAHg07A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183364; 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=STY7OwgI1ieRCn6nsmj8WrtXcuAAbGcsy3TKx9PPxUY=; b=IBsf21ljIDKORG0unST9D6sHxrTQj8pfeOSrXgQw+udjZfDDucycM1LVRolYd50w+n8v+pmqusUCewclqehjHbBSlpgOysapdSy1gGpSnxevWTvK2WMQ92Zea5AnZZnMU1YOihWEONVcYIWc9CWBNZoMCMbX5sdH1k0+LB81wN4= 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 1605183364039630.9636752081128; Thu, 12 Nov 2020 04:16:04 -0800 (PST) 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-244-ni-6TQD2MR2gVlpEBqiiOQ-1; Thu, 12 Nov 2020 07:16:00 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 97628107B000; Thu, 12 Nov 2020 12:15:55 +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 6C1785C5DE; Thu, 12 Nov 2020 12:15:55 +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 298E0181A06E; Thu, 12 Nov 2020 12:15:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACCFkvh032598 for ; Thu, 12 Nov 2020 07:15:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3914AF51A4; Thu, 12 Nov 2020 12:15:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 339F3F51BF for ; Thu, 12 Nov 2020 12:15:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 1B68D102F1E0 for ; Thu, 12 Nov 2020 12:15:46 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-zKZK9K23Ppmb7xaH27EE4w-1; Thu, 12 Nov 2020 07:15:42 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC1QWW123007 for ; Thu, 12 Nov 2020 07:15:42 -0500 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 34rj5wynqr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:42 -0500 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC7rYk005017 for ; Thu, 12 Nov 2020 12:15:40 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 34p26pmur7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:40 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFb0l43909486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:37 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB17552067; Thu, 12 Nov 2020 12:15:37 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8E74652073; Thu, 12 Nov 2020 12:15:37 +0000 (GMT) X-MC-Unique: ni-6TQD2MR2gVlpEBqiiOQ-1 X-MC-Unique: zKZK9K23Ppmb7xaH27EE4w-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 02/11] tests: AP card node device Date: Thu, 12 Nov 2020 13:15:10 +0100 Message-Id: <20201112121519.2212991-3-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=920 lowpriorityscore=0 mlxscore=0 spamscore=0 phishscore=0 suspectscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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.79 on 10.11.54.5 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.79 on 10.5.11.16 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 tests to verify libvirt node device driver support for AP card device. Signed-off-by: Farhan Ali Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- tests/nodedevschemadata/ap_card07.xml | 8 ++++++++ tests/nodedevxml2xmltest.c | 1 + 2 files changed, 9 insertions(+) create mode 100644 tests/nodedevschemadata/ap_card07.xml diff --git a/tests/nodedevschemadata/ap_card07.xml b/tests/nodedevschemadat= a/ap_card07.xml new file mode 100644 index 00000000..14a845fd --- /dev/null +++ b/tests/nodedevschemadata/ap_card07.xml @@ -0,0 +1,8 @@ + + ap_card07 + /sys/devices/ap/card07 + computer + + 0x07 + + diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index a009ecb3..7b8a5a82 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -125,6 +125,7 @@ mymain(void) DO_TEST("ccw_0_0_ffff"); DO_TEST("css_0_0_ffff"); DO_TEST("css_0_0_fffe_mdev_types"); + DO_TEST("ap_card07"); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } --=20 2.26.2 From nobody Thu May 2 06:49:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1605183364; cv=none; d=zohomail.com; s=zohoarc; b=Flqz3d58mOBd0MjtiNqzt3MWdxbz3Vxu/0yKENkoN5Yb0mz/HEFciJepBilX+9xTm7SZJ8HHYi+CegE5P3n6H25fcgqWHSF9yVZPthz7kYiUJ2e3Hp8ib2geuylgKFFjelHRdKg4mATbk/s/mPIcCijnVOYIrPS565OSjgvgOak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183364; 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=qHCnRvNHIsf3+DUaPMguNO/qY7NgQfC9z+hynn5c540=; b=Q42h6TuiPjZ/+J0Gzp33aUvfpt5rF+LRw3hAJ4EMzVk4R9gmLyUMwhAb+suoq0mHYifXHU30IUYo0nBNmyJfxvWzWPoHnYqrHRk+c6ioTzmxTbkMzQpS266RNSmJvapmVpwG42AT5CaOFaGv5Apy5rDGbZtOicpS6WqI1pLO4zY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605183364532876.9446492414936; Thu, 12 Nov 2020 04:16:04 -0800 (PST) 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-189-eIHjvQLAPae2A8zn4dp80g-1; Thu, 12 Nov 2020 07:16:01 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2911B80B71A; Thu, 12 Nov 2020 12:15:55 +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 025491002C11; Thu, 12 Nov 2020 12:15:55 +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 B9822181A06E; Thu, 12 Nov 2020 12:15:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACCFmJn032614 for ; Thu, 12 Nov 2020 07:15:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id B9542F5561; Thu, 12 Nov 2020 12:15:48 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B38B0F51BF for ; Thu, 12 Nov 2020 12:15:47 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 87468185A794 for ; Thu, 12 Nov 2020 12:15:47 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-499-b2RXkVU6PV-u69RY174Q1A-1; Thu, 12 Nov 2020 07:15:45 -0500 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACCF4vV132704 for ; Thu, 12 Nov 2020 07:15:44 -0500 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 34re45kwgr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:44 -0500 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC8Dw5015714 for ; Thu, 12 Nov 2020 12:15:42 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma01fra.de.ibm.com with ESMTP id 34nk782vrw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:42 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFdOY8520134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:39 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A083D5206B; Thu, 12 Nov 2020 12:15:39 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 7F24F5205F; Thu, 12 Nov 2020 12:15:39 +0000 (GMT) X-MC-Unique: eIHjvQLAPae2A8zn4dp80g-1 X-MC-Unique: b2RXkVU6PV-u69RY174Q1A-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 03/11] nodedev: detect AP queues Date: Thu, 12 Nov 2020 13:15:11 +0100 Message-Id: <20201112121519.2212991-4-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 mlxscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 suspectscore=9 lowpriorityscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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.79 on 10.11.54.5 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.22 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" Each AP card device can support upto 256 AP queues. AP queues are also detected by udev, so add support for libvirt nodedev driver. Signed-off-by: Farhan Ali Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- docs/formatnode.html.in | 11 ++++++ docs/schemas/nodedev.rng | 25 +++++++++++++ src/conf/node_device_conf.c | 59 ++++++++++++++++++++++++++++++ src/conf/node_device_conf.h | 9 +++++ src/conf/virnodedeviceobj.c | 1 + src/node_device/node_device_udev.c | 27 ++++++++++++++ tools/virsh-nodedev.c | 1 + 7 files changed, 133 insertions(+) diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index d10a79e3..45281363 100644 --- a/docs/formatnode.html.in +++ b/docs/formatnode.html.in @@ -439,6 +439,17 @@
AP Card identifier.
+
ap_queue
+
Describes the AP Queue on a S390 host. An AP Queue is + identified by it's ap-adapter and ap-domain id. Sub-elements= include: +
+
ap-adapter
+
The ap-adapter of an AP Queue identifies AP Card to which + this queue belongs.
+
ap-domain
+
AP Queue identifier.
+
+
diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index d02e5377..51cb8854 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -88,6 +88,7 @@ + @@ -678,6 +679,18 @@ =20 + + + ap_queue + + + + + + + + + @@ -738,4 +751,16 @@ =20 + + + + (0x)?[0-9a-fA-F]{1,4} + + + 0 + 255 + + + + diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 5d7a23cb..fa3b823f 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -68,6 +68,7 @@ VIR_ENUM_IMPL(virNodeDevCap, "css", "vdpa", "ap_card", + "ap_queue", ); =20 VIR_ENUM_IMPL(virNodeDevNetCap, @@ -655,6 +656,12 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) virBufferAsprintf(&buf, "0x%02x\n", data->ap_card.ap_adapter); break; + case VIR_NODE_DEV_CAP_AP_QUEUE: + virBufferAsprintf(&buf, "0x%02x\n", + data->ap_queue.ap_adapter); + virBufferAsprintf(&buf, "0x%04x\n", + data->ap_queue.ap_domain); + break; case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_FC_HOST: case VIR_NODE_DEV_CAP_VPORTS: @@ -976,6 +983,52 @@ virNodeDevCapAPCardParseXML(xmlXPathContextPtr ctxt, } =20 =20 +static int +virNodeDevCapAPQueueParseXML(xmlXPathContextPtr ctxt, + virNodeDeviceDefPtr def, + xmlNodePtr node, + virNodeDevCapAPQueuePtr ap_queue) +{ + xmlNodePtr orig; + int ret =3D -1; + g_autofree char *adapter =3D NULL, *dom =3D NULL; + + orig =3D ctxt->node; + ctxt->node =3D node; + + if (!(adapter =3D virXPathString("string(./ap-adapter[1])", ctxt))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("missing ap-adapter value for '%s'"), def->name); + return -1; + } + + if (virStrToLong_uip(adapter, NULL, 0, &ap_queue->ap_adapter) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid ap-adapter value '%s' for '%s'"), + adapter, def->name); + goto out; + } + + if (!(dom =3D virXPathString("string(./ap-domain[1])", ctxt))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("missing ap-domain value for '%s'"), def->name); + goto out; + } + + if (virStrToLong_uip(dom, NULL, 0, &ap_queue->ap_domain) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid ap-domain value '%s' for '%s'"), + dom, def->name); + goto out; + } + + ret =3D 0; + out: + ctxt->node =3D orig; + return ret; +} + + static int virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virNodeDeviceDefPtr def, @@ -2018,6 +2071,10 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, ret =3D virNodeDevCapAPCardParseXML(ctxt, def, node, &caps->data.ap_card); break; + case VIR_NODE_DEV_CAP_AP_QUEUE: + ret =3D virNodeDevCapAPQueueParseXML(ctxt, def, node, + &caps->data.ap_queue); + break; case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_FC_HOST: case VIR_NODE_DEV_CAP_VPORTS: @@ -2346,6 +2403,7 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) case VIR_NODE_DEV_CAP_CCW_DEV: case VIR_NODE_DEV_CAP_VDPA: case VIR_NODE_DEV_CAP_AP_CARD: + case VIR_NODE_DEV_CAP_AP_QUEUE: case VIR_NODE_DEV_CAP_LAST: /* This case is here to shutup the compiler */ break; @@ -2406,6 +2464,7 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def) case VIR_NODE_DEV_CAP_CCW_DEV: case VIR_NODE_DEV_CAP_VDPA: case VIR_NODE_DEV_CAP_AP_CARD: + case VIR_NODE_DEV_CAP_AP_QUEUE: case VIR_NODE_DEV_CAP_LAST: break; } diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index f86f880c..27cb0004 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_VDPA, /* vDPA device */ VIR_NODE_DEV_CAP_AP_CARD, /* s390 AP Card device */ + VIR_NODE_DEV_CAP_AP_QUEUE, /* s390 AP Queue */ =20 VIR_NODE_DEV_CAP_LAST } virNodeDevCapType; @@ -296,6 +297,13 @@ struct _virNodeDevCapAPCard { unsigned int ap_adapter; }; =20 +typedef struct _virNodeDevCapAPQueue virNodeDevCapAPQueue; +typedef virNodeDevCapAPQueue *virNodeDevCapAPQueuePtr; +struct _virNodeDevCapAPQueue { + unsigned int ap_adapter; + unsigned int ap_domain; +}; + typedef struct _virNodeDevCapData virNodeDevCapData; typedef virNodeDevCapData *virNodeDevCapDataPtr; struct _virNodeDevCapData { @@ -316,6 +324,7 @@ struct _virNodeDevCapData { virNodeDevCapCCW ccw_dev; virNodeDevCapVDPA vdpa; virNodeDevCapAPCard ap_card; + virNodeDevCapAPQueue ap_queue; }; }; =20 diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 0aa59289..8b4302d7 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -718,6 +718,7 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj, case VIR_NODE_DEV_CAP_CCW_DEV: case VIR_NODE_DEV_CAP_VDPA: case VIR_NODE_DEV_CAP_AP_CARD: + case VIR_NODE_DEV_CAP_AP_QUEUE: 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 b4eb4553..6bbff571 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1218,6 +1218,29 @@ udevProcessAPCard(struct udev_device *device, } =20 =20 +static int +udevProcessAPQueue(struct udev_device *device, + virNodeDeviceDefPtr def) +{ + char *c; + virNodeDevCapDataPtr data =3D &def->caps->data; + + if ((c =3D strrchr(def->sysfs_path, '/')) =3D=3D NULL || + virStrToLong_ui(c + 1, &c, 16, &data->ap_queue.ap_adapter) < 0 || + virStrToLong_ui(c + 1, &c, 16, &data->ap_queue.ap_domain) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to parse the AP Queue from sysfs path: '%= s'"), + def->sysfs_path); + return -1; + } + + if (udevGenerateDeviceName(device, def, NULL) !=3D 0) + return -1; + + return 0; +} + + static int udevGetDeviceNodes(struct udev_device *device, virNodeDeviceDefPtr def) @@ -1274,6 +1297,8 @@ udevGetDeviceType(struct udev_device *device, *type =3D VIR_NODE_DEV_CAP_DRM; else if (STREQ(devtype, "ap_card")) *type =3D VIR_NODE_DEV_CAP_AP_CARD; + else if (STREQ(devtype, "ap_queue")) + *type =3D VIR_NODE_DEV_CAP_AP_QUEUE; } else { /* PCI devices don't set the DEVTYPE property. */ if (udevHasDeviceProperty(device, "PCI_CLASS")) @@ -1351,6 +1376,8 @@ udevGetDeviceDetails(struct udev_device *device, return udevProcessVDPA(device, def); case VIR_NODE_DEV_CAP_AP_CARD: return udevProcessAPCard(device, def); + case VIR_NODE_DEV_CAP_AP_QUEUE: + return udevProcessAPQueue(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/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 32c12553..81752e85 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -468,6 +468,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G= _GNUC_UNUSED) flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA; break; case VIR_NODE_DEV_CAP_AP_CARD: + case VIR_NODE_DEV_CAP_AP_QUEUE: case VIR_NODE_DEV_CAP_LAST: break; } --=20 2.26.2 From nobody Thu May 2 06:49:41 2024 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=1605183366; cv=none; d=zohomail.com; s=zohoarc; b=QcVjgI8p3ix07RWHs+SxxXIgzTzBsXah50WVy0XxJgdI5Rqjjoy7fgadY/8OvKx5uEVbv6xhdTdRvRQYJptdf9Gm6GdOoyZFC6ckfwujyG1g/iHBY3jMM8OJTEFpHhatEPVtXSBpmjyaipu/Ko6cEpmaX4Upt0J32Xf2xDnVar4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183366; 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=U1+9dal4Xz8M/DScCjofeIGS4NBAQ+m/ORieACatkic=; b=KTlwIPZ6AGZLEYWI2NquylmrTB6zxCVW7XDq7NK61gCMka4z/Epxdcc6wlP7233ewY2SSKcOjwTLKxn/wJJBEZgUpDOxlvTChSAN7pNG3Swqu8d1Ad5UXvtRMlZsj5QJ2yzicMju6l5Q9ZU5ICLyZSRwIOQct0ijsuMz9G2xu50= 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 1605183366753744.1195136177071; Thu, 12 Nov 2020 04:16:06 -0800 (PST) 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-236-jQYUQSU5NjKFxPKq2YX1iA-1; Thu, 12 Nov 2020 07:16:03 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 273E480475C; Thu, 12 Nov 2020 12:15:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01E3D7513D; Thu, 12 Nov 2020 12:15:58 +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 C4DDA5810F; Thu, 12 Nov 2020 12:15:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACCFqcQ032732 for ; Thu, 12 Nov 2020 07:15:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id C6226200E216; Thu, 12 Nov 2020 12:15:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0DF1202343D for ; Thu, 12 Nov 2020 12:15:50 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 6BC01102F1E0 for ; Thu, 12 Nov 2020 12:15:50 +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-391-mGizq-STOCOWKD3cp0uJhw-1; Thu, 12 Nov 2020 07:15:48 -0500 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 0ACC3AsK028681 for ; Thu, 12 Nov 2020 07:15:47 -0500 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 34rfyfak25-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:46 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC7FfY026058 for ; Thu, 12 Nov 2020 12:15:43 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03fra.de.ibm.com with ESMTP id 34q08420fk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:43 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFe9d46399918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:40 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A4C8A52077; Thu, 12 Nov 2020 12:15:40 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 79DA252065; Thu, 12 Nov 2020 12:15:40 +0000 (GMT) X-MC-Unique: jQYUQSU5NjKFxPKq2YX1iA-1 X-MC-Unique: mGizq-STOCOWKD3cp0uJhw-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 04/11] tests: AP queue node device Date: Thu, 12 Nov 2020 13:15:12 +0100 Message-Id: <20201112121519.2212991-5-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 phishscore=0 bulkscore=0 clxscore=1015 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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.4 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.79 on 10.5.11.15 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 tests to verify libvirt node device driver support for AP queues Signed-off-by: Farhan Ali Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- tests/nodedevschemadata/ap_07_0038.xml | 9 +++++++++ tests/nodedevxml2xmltest.c | 1 + 2 files changed, 10 insertions(+) create mode 100644 tests/nodedevschemadata/ap_07_0038.xml diff --git a/tests/nodedevschemadata/ap_07_0038.xml b/tests/nodedevschemada= ta/ap_07_0038.xml new file mode 100644 index 00000000..553c68f2 --- /dev/null +++ b/tests/nodedevschemadata/ap_07_0038.xml @@ -0,0 +1,9 @@ + + ap_07_0038 + /sys/devices/ap/card07/07.0038 + ap_card07 + + 0x07 + 0x0038 + + diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index 7b8a5a82..a8cbe6a9 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -126,6 +126,7 @@ mymain(void) DO_TEST("css_0_0_ffff"); DO_TEST("css_0_0_fffe_mdev_types"); DO_TEST("ap_card07"); + DO_TEST("ap_07_0038"); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } --=20 2.26.2 From nobody Thu May 2 06:49:41 2024 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=1605183372; cv=none; d=zohomail.com; s=zohoarc; b=d+8LjjzX2HZpJrT3MnLF1+1WE4nPgRfh2L/kZH2OJ+4dJ70HPvHoMFN6mTYtxPw3C7V3UE4nEyKhi3Zi6l5d8d3eU1jWoyW4Xq1qsBseOhijXjZ2N3cv+voUkUvuZQ9LN66ct3ZfIgRWDxu92AF1PgGwtT9o6uje0/GOMr0mOuE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183372; 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=fTbydqoPOvKdYfr9WTFQmHGinPrP64tkqHwUPgzdU1g=; b=TBXIwGEjTuGHj78ASjqcKC9q2PdBj4ZJtAqyjSadawRTf2Q/7uwmJzFWIuHLRsw5CVhjbqarPKV7jpeeyvjkKxUSLQtp16e7eIk2WlXxdlkYLm4LZodYAIfZMvi2f82ibnSY+qu8ThdihFVLSO/7ZN5gztBqcQEPHG1v+h2CEfk= 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 1605183372201881.1467906939976; Thu, 12 Nov 2020 04:16:12 -0800 (PST) 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-442-KseDwS1YOR-PlZ6vhcxgjg-1; Thu, 12 Nov 2020 07:16:08 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 84C051882FB6; Thu, 12 Nov 2020 12:16:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5EEE855763; Thu, 12 Nov 2020 12:16:02 +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 2ADCC58116; Thu, 12 Nov 2020 12:16:02 +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 0ACCFtBk000645 for ; Thu, 12 Nov 2020 07:15:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9DB3C1111C7B; Thu, 12 Nov 2020 12:15:55 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 997541111C64 for ; Thu, 12 Nov 2020 12:15:52 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C656801184 for ; Thu, 12 Nov 2020 12:15:52 +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-282-8Di7_sA6Oi2zaZxN_trxRg-1; Thu, 12 Nov 2020 07:15:49 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACBXmf8083265 for ; Thu, 12 Nov 2020 07:15:49 -0500 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 34s1bs6wnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:48 -0500 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC7rYl005017 for ; Thu, 12 Nov 2020 12:15:46 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04ams.nl.ibm.com with ESMTP id 34p26pmurc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:46 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFhwO59638076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:43 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74C7A52051; Thu, 12 Nov 2020 12:15:43 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 57ED55205F; Thu, 12 Nov 2020 12:15:43 +0000 (GMT) X-MC-Unique: KseDwS1YOR-PlZ6vhcxgjg-1 X-MC-Unique: 8Di7_sA6Oi2zaZxN_trxRg-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 05/11] virsh: nodedev: Filter by AP card and AP queue capabilities Date: Thu, 12 Nov 2020 13:15:13 +0100 Message-Id: <20201112121519.2212991-6-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 mlxscore=0 spamscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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: Farhan Ali , 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.79 on 10.5.11.15 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" From: Farhan Ali Add support to filter by 'ap_card' and 'ap_queue' capabilities. Signed-off-by: Farhan Ali Reviewed-by: Boris Fiuczynski Reviewed-by: Bjoern Walk Signed-off-by: Shalini Chellathurai Saroja --- docs/manpages/virsh.rst | 2 +- include/libvirt/libvirt-nodedev.h | 2 ++ src/conf/node_device_conf.h | 4 +++- src/conf/virnodedeviceobj.c | 4 +++- src/libvirt-nodedev.c | 2 ++ tools/virsh-nodedev.c | 4 ++++ 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index bfd26e31..1e71818a 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -4972,7 +4972,7 @@ List all of the devices available on the node that ar= e known by libvirt. separated by comma, e.g. --cap pci,scsi. Valid capability types include 'system', 'pci', 'usb_device', 'usb', 'net', 'scsi_host', 'scsi_target', 'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm', 'mdev', -'mdev_types', 'ccw', 'css'. +'mdev_types', 'ccw', 'css', 'ap_card', 'ap_queue'. If *--tree* is used, the output is formatted in a tree representing parent= s of each node. *cap* and *--tree* are mutually exclusive. =20 diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-no= dedev.h index b73b076f..d5091aa2 100644 --- a/include/libvirt/libvirt-nodedev.h +++ b/include/libvirt/libvirt-nodedev.h @@ -83,6 +83,8 @@ typedef enum { VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV =3D 1 << 15, /* CCW de= vice */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV =3D 1 << 16, /* CSS de= vice */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA =3D 1 << 17, /* vDPA d= evice */ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD =3D 1 << 18, /* s390 A= P Card device */ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE =3D 1 << 19, /* s390 A= P Queue */ } virConnectListAllNodeDeviceFlags; =20 int virConnectListAllNodeDevices (virConnectPtr conn, diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 27cb0004..b580d6cf 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -402,7 +402,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA) + VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA | \ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD | \ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE) =20 int virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host); diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 8b4302d7..691632c6 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -871,7 +871,9 @@ virNodeDeviceObjMatch(virNodeDeviceObjPtr obj, MATCH(MDEV) || MATCH(CCW_DEV) || MATCH(CSS_DEV) || - MATCH(VDPA))) + MATCH(VDPA) || + MATCH(AP_CARD) || + MATCH(AP_QUEUE))) return false; } =20 diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c index 28765b9c..762413eb 100644 --- a/src/libvirt-nodedev.c +++ b/src/libvirt-nodedev.c @@ -102,6 +102,8 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap= , unsigned int flags) * VIR_CONNECT_LIST_NODE_DEVICES_CAP_MDEV * VIR_CONNECT_LIST_NODE_DEVICES_CAP_CCW_DEV * VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV + * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD + * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE * * Returns the number of node devices found or -1 and sets @devices to NUL= L in * case of error. On success, the array stored into @devices is guarantee= d to diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 81752e85..f5ffe525 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -468,7 +468,11 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd = G_GNUC_UNUSED) flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA; break; case VIR_NODE_DEV_CAP_AP_CARD: + flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD; + break; case VIR_NODE_DEV_CAP_AP_QUEUE: + flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE; + break; case VIR_NODE_DEV_CAP_LAST: break; } --=20 2.26.2 From nobody Thu May 2 06:49:41 2024 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=1605183367; cv=none; d=zohomail.com; s=zohoarc; b=ifOaEfyfW98oYk2YPqY+AsexnS94glnRX1avYr6oudPnTUTAtM+Aevswg5sZa9d0yZs7aEXKyPefSJctWdRCrFf7V8b3hKhls7Srj542AwVL0JxmtINMfx9UOdwmRkzuM/8SCkLcHqH7+t2sfmtHyPAQdqMZgFrvI8rxZj0EYGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183367; 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=/NKGOw3+xZmv0QdufgJNdtAhtFYcoSaAnUMAAnlpnnw=; b=OpX2QEknrqNXgEgT5bldPyxycMCLCO4v5wgr1jxQMsKaHOKcvIdWsH6fHyuQ7Wb+OJ8Wg0ewDyXIxJprIq/xwOeB+HdtkwHPO+fzU8uba9ShzeBburHK0gzWgNkVgHIOkZcMt8+g1XoK+QQiE0LALNzyueg0SOKPPobBB4Y6t4s= 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 1605183367594640.7525024033692; Thu, 12 Nov 2020 04:16:07 -0800 (PST) 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-246-1Zdy_WFlOSy4CDwYUal6Dg-1; Thu, 12 Nov 2020 07:16:04 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 912AB100747C; Thu, 12 Nov 2020 12:15:58 +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 6B8BF7513F; Thu, 12 Nov 2020 12:15:58 +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 35EB7181A07E; Thu, 12 Nov 2020 12:15:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACCFsnI000492 for ; Thu, 12 Nov 2020 07:15:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id EF942F51BF; Thu, 12 Nov 2020 12:15:53 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9EE4F51A4 for ; Thu, 12 Nov 2020 12:15:53 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 CD1DC8007D9 for ; Thu, 12 Nov 2020 12:15:53 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-408-tkBxMIVvPkWsCtLyRtmOEg-1; Thu, 12 Nov 2020 07:15:51 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACBYNR8080268 for ; Thu, 12 Nov 2020 07:15:51 -0500 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 34s0g2gg77-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:51 -0500 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC6ReM027202 for ; Thu, 12 Nov 2020 12:15:49 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04fra.de.ibm.com with ESMTP id 34nk77tvfh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:49 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFksa66584982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:46 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B9645205F; Thu, 12 Nov 2020 12:15:46 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id E839252059; Thu, 12 Nov 2020 12:15:45 +0000 (GMT) X-MC-Unique: 1Zdy_WFlOSy4CDwYUal6Dg-1 X-MC-Unique: tkBxMIVvPkWsCtLyRtmOEg-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 06/11] nodedev: detect AP matrix device Date: Thu, 12 Nov 2020 13:15:14 +0100 Message-Id: <20201112121519.2212991-7-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 suspectscore=2 adultscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 phishscore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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.79 on 10.11.54.5 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.79 on 10.5.11.15 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 node device 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 | 11 ++++++++++- src/conf/node_device_conf.h | 8 ++++++++ src/conf/virnodedeviceobj.c | 1 + src/node_device/node_device_udev.c | 23 +++++++++++++++++++++++ tools/virsh-nodedev.c | 1 + 6 files changed, 50 insertions(+), 1 deletion(-) diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 51cb8854..5be21145 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -89,6 +89,7 @@ + @@ -691,6 +692,12 @@ =20 + + + ap_matrix + + + diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index fa3b823f..f3d146a5 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -69,6 +69,7 @@ VIR_ENUM_IMPL(virNodeDevCap, "vdpa", "ap_card", "ap_queue", + "ap_matrix", ); =20 VIR_ENUM_IMPL(virNodeDevNetCap, @@ -665,6 +666,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; } @@ -2075,6 +2077,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: @@ -2396,6 +2401,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) virMediatedDeviceTypeFree(data->ccw_dev.mdev_types[i]); VIR_FREE(data->ccw_dev.mdev_types); 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: @@ -2465,6 +2473,7 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def) case VIR_NODE_DEV_CAP_VDPA: 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; } @@ -2806,6 +2815,7 @@ virNodeDeviceGetPCIDynamicCaps(const char *sysfsPath, &pci_dev->mdev_types, &pci_dev->nmdev_types) < 0) return -1; + if (pci_dev->nmdev_types > 0) pci_dev->flags |=3D VIR_NODE_DEV_CAP_FLAG_PCI_MDEV; =20 @@ -2849,7 +2859,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 b580d6cf..b863653b 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -68,6 +68,7 @@ typedef enum { VIR_NODE_DEV_CAP_VDPA, /* vDPA 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; @@ -304,6 +305,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 { @@ -325,6 +332,7 @@ struct _virNodeDevCapData { virNodeDevCapVDPA vdpa; virNodeDevCapAPCard ap_card; virNodeDevCapAPQueue ap_queue; + virNodeDevCapAPMatrix ap_matrix; }; }; =20 diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 691632c6..8fbef5f5 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -719,6 +719,7 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj, case VIR_NODE_DEV_CAP_VDPA: 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 6bbff571..5f57000e 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1241,6 +1241,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) @@ -1326,6 +1345,8 @@ udevGetDeviceType(struct udev_device *device, *type =3D VIR_NODE_DEV_CAP_CSS_DEV; else if (STREQ_NULLABLE(subsystem, "vdpa")) *type =3D VIR_NODE_DEV_CAP_VDPA; + else if (STREQ_NULLABLE(subsystem, "matrix")) + *type =3D VIR_NODE_DEV_CAP_AP_MATRIX; =20 VIR_FREE(subsystem); } @@ -1378,6 +1399,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/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index f5ffe525..f69030d2 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -473,6 +473,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 From nobody Thu May 2 06:49:41 2024 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=1605183370; cv=none; d=zohomail.com; s=zohoarc; b=VGzu3bl5D4dq6DNPU+kWAfbsYsUVfz8bXMwZA8nRPzDtl9w1oPabZ8eDopMCHHiVREc00douN3yl0p/ajKThGXsYMPs8qvQHs7iBIIYhqyjRjCvHYVrHqRzavHxNKwEWBrMa+Lvj3SzuukC5JeDv1vHRcUlfCM57CqHUtaI9KXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183370; 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=KggucKP34J5GMkaSxwDG2LU+H3zzVcZr5FDmtMHZgkw=; b=bh88yUO15J4LhS46cAzMncxplIZlR8JZakKFBo723btN19H4bH2WJcF6Ub+tcZm5Jf+mVcElghq2wsMMDOmuiu37KTMi45bhLycQbh5YEu9TPeUOUNrYRyhXJo3pv0kC14+8A149EFZGu/HTWlv2l9fm5Zt0BboKAz7GaYeEYnk= 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 1605183370913911.2052875216337; Thu, 12 Nov 2020 04:16:10 -0800 (PST) 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-404-XVEKjM6BMN-gDReLsyynmQ-1; Thu, 12 Nov 2020 07:16:07 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D7181882FB3; Thu, 12 Nov 2020 12:16:01 +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 4CB8075138; Thu, 12 Nov 2020 12:16:01 +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 18EE9181A271; Thu, 12 Nov 2020 12:16:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACCFvrE000652 for ; Thu, 12 Nov 2020 07:15:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 445062156A4D; Thu, 12 Nov 2020 12:15:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F4B92156A49 for ; Thu, 12 Nov 2020 12:15:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 25297185A794 for ; Thu, 12 Nov 2020 12:15:55 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-587-sKTsTQ88OIm-2xbUsA5c7w-1; Thu, 12 Nov 2020 07:15:53 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC58sj004240 for ; Thu, 12 Nov 2020 07:15:52 -0500 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 34s2wq35dr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:52 -0500 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC6NG1009017 for ; Thu, 12 Nov 2020 12:15:50 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03ams.nl.ibm.com with ESMTP id 34nk78nnd0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:50 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFluZ59572576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:47 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 40E3852074; Thu, 12 Nov 2020 12:15:47 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2925452065; Thu, 12 Nov 2020 12:15:47 +0000 (GMT) X-MC-Unique: XVEKjM6BMN-gDReLsyynmQ-1 X-MC-Unique: sKTsTQ88OIm-2xbUsA5c7w-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 07/11] tests: AP matrix node device Date: Thu, 12 Nov 2020 13:15:15 +0100 Message-Id: <20201112121519.2212991-8-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 phishscore=0 mlxscore=0 bulkscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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.6 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.79 on 10.5.11.15 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 tests to verify libvirt node device driver support for AP matrix device. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- tests/nodedevschemadata/ap_matrix.xml | 7 +++++++ .../mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml | 9 +++++++++ tests/nodedevxml2xmltest.c | 2 ++ 3 files changed, 18 insertions(+) create mode 100644 tests/nodedevschemadata/ap_matrix.xml create mode 100644 tests/nodedevschemadata/mdev_ee0b88c4_f554_4dc1_809d_b2= a01e8e48ad.xml 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 a8cbe6a9..dc8cb04f 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -127,6 +127,8 @@ mymain(void) DO_TEST("css_0_0_fffe_mdev_types"); 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; } --=20 2.26.2 From nobody Thu May 2 06:49:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1605183477; cv=none; d=zohomail.com; s=zohoarc; b=PSkXjybKNiX+NfkI/1fb++y4hBN4BPs6mUI8FSr8k6XMQDty5G5sKehEaVN0kfS4eBA6hCLMEhcE7WKE9wumH+NpXLEJ1MZL4gUTGNEZ4BW++eq/lJHxY3Y0tLJUpH5Hq27Y9Ib6Kl5Tjz6HxeAQxGbFm56oEqpsIwGyqUnBp90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183477; 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=/wkh2H+P14Cy3JXOobBcW7zNwhDIjcRyu2J/mOKtWF8=; b=bu41sCNlrYnmQDydvBba3QXA7edKBUUwMyxkPCAFsYxq34yJ6Qw+tNMGbHSYCLAIPk5jCa6SAXVOBGlpkg/tUlWDCIPU/9eY86BzLXqwiVWZixJ48Cb/RCeiuORrPoq8BnyokYjf1WEX+fVliJhA+3Dms+mR6OB5j5aNPkRqOH0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1605183477125144.82453975149497; Thu, 12 Nov 2020 04:17:57 -0800 (PST) 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-441-EZiSJZvTPFe55nPLDAWAgQ-1; Thu, 12 Nov 2020 07:17:52 -0500 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 B5DB91074661; Thu, 12 Nov 2020 12:17:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F10C26327; Thu, 12 Nov 2020 12:17:46 +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 5B13F58103; Thu, 12 Nov 2020 12:17:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACCFvAB000653 for ; Thu, 12 Nov 2020 07:15:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 74A4B2156A4F; Thu, 12 Nov 2020 12:15:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FF852156A49 for ; Thu, 12 Nov 2020 12:15:57 +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 56A9790E422 for ; Thu, 12 Nov 2020 12:15:57 +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-272-UlEw7NJQOyGCVOYJkaxmcQ-1; Thu, 12 Nov 2020 07:15:55 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC38OA135649 for ; Thu, 12 Nov 2020 07:15:54 -0500 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 34rg32ma0k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:53 -0500 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC6MYq009012 for ; Thu, 12 Nov 2020 12:15:51 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03ams.nl.ibm.com with ESMTP id 34nk78nnd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:51 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFmMP58523974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:49 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CAF4352051; Thu, 12 Nov 2020 12:15:48 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id B3AF45205F; Thu, 12 Nov 2020 12:15:48 +0000 (GMT) X-MC-Unique: EZiSJZvTPFe55nPLDAWAgQ-1 X-MC-Unique: UlEw7NJQOyGCVOYJkaxmcQ-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 08/11] virsh: nodedev: filter by AP Matrix capability Date: Thu, 12 Nov 2020 13:15:16 +0100 Message-Id: <20201112121519.2212991-9-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 bulkscore=0 priorityscore=1501 phishscore=0 clxscore=1015 adultscore=0 suspectscore=9 mlxscore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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.6 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 to filter by 'ap_matrix' capability. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- docs/formatnode.html.in | 3 +++ docs/manpages/virsh.rst | 2 +- include/libvirt/libvirt-nodedev.h | 1 + src/conf/node_device_conf.h | 3 ++- src/conf/virnodedeviceobj.c | 3 ++- src/libvirt-nodedev.c | 1 + tools/virsh-nodedev.c | 2 ++ 7 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index 45281363..8a84d0dc 100644 --- a/docs/formatnode.html.in +++ b/docs/formatnode.html.in @@ -450,6 +450,9 @@
AP Queue identifier.
+
ap_matrix
+
Describes an AP Matrix device on a S390 architecture providi= ng + cryptographic host resources usable for virtualization.
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 1e71818a..23068dcb 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -4972,7 +4972,7 @@ List all of the devices available on the node that ar= e known by libvirt. separated by comma, e.g. --cap pci,scsi. Valid capability types include 'system', 'pci', 'usb_device', 'usb', 'net', 'scsi_host', 'scsi_target', 'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm', 'mdev', -'mdev_types', 'ccw', 'css', 'ap_card', 'ap_queue'. +'mdev_types', 'ccw', 'css', 'ap_card', 'ap_queue', 'ap_matrix'. If *--tree* is used, the output is formatted in a tree representing parent= s of each node. *cap* and *--tree* are mutually exclusive. =20 diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-no= dedev.h index d5091aa2..eab8abf6 100644 --- a/include/libvirt/libvirt-nodedev.h +++ b/include/libvirt/libvirt-nodedev.h @@ -85,6 +85,7 @@ typedef enum { VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA =3D 1 << 17, /* vDPA d= evice */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD =3D 1 << 18, /* s390 A= P Card device */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE =3D 1 << 19, /* s390 A= P Queue */ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX =3D 1 << 20, /* s390 A= P Matrix */ } virConnectListAllNodeDeviceFlags; =20 int virConnectListAllNodeDevices (virConnectPtr conn, diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index b863653b..b8397128 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -412,7 +412,8 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps); VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_VDPA | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE) + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE | \ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX) =20 int virNodeDeviceGetSCSIHostCaps(virNodeDevCapSCSIHostPtr scsi_host); diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 8fbef5f5..25d12776 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -874,7 +874,8 @@ virNodeDeviceObjMatch(virNodeDeviceObjPtr obj, MATCH(CSS_DEV) || MATCH(VDPA) || MATCH(AP_CARD) || - MATCH(AP_QUEUE))) + MATCH(AP_QUEUE) || + MATCH(AP_MATRIX))) return false; } =20 diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c index 762413eb..eb8c735a 100644 --- a/src/libvirt-nodedev.c +++ b/src/libvirt-nodedev.c @@ -104,6 +104,7 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap= , unsigned int flags) * VIR_CONNECT_LIST_NODE_DEVICES_CAP_CSS_DEV * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE + * VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX * * Returns the number of node devices found or -1 and sets @devices to NUL= L in * case of error. On success, the array stored into @devices is guarantee= d to diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index f69030d2..69422e20 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -474,6 +474,8 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G= _GNUC_UNUSED) flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE; break; case VIR_NODE_DEV_CAP_AP_MATRIX: + flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX; + break; case VIR_NODE_DEV_CAP_LAST: break; } --=20 2.26.2 From nobody Thu May 2 06:49:41 2024 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=1605183372; cv=none; d=zohomail.com; s=zohoarc; b=Dqgpo0tOSSmbwNyJY6Dx9G7G0H4sMV/0XOcQ34QLV8cvgOqTrLebfWUuDLx8dO6rUfPvJOrBYNED+KvOXzuecOTCpY2bNegc74pvFNE3yunyQ+FZlK4v8PHwJq/pyd26qFtqiLH6g/OD3c4vyf33fO+MSM54HzUNsgRJuAEJJjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183372; 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=8B9C5MFhWHKgTs02Ok2u3OhMSKAB0DlEBzR55lqpm0Q=; b=TgTt9YKuoUlvygyWwISrmAmQJ5SfpywSEIjAAW3QucxdYfD4Xgu4DzNau/z0eqqLDJ/R8QPJ9cl247tH5vfU7YSAyqnhIOnMpeeXuYQIWVl6DutPyuGR4L5NZ6nd42jF22sos5o3V7lXtyVZy6YO4cpnFPHfSxmqh220N9N92pc= 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 1605183372893530.9523153348883; Thu, 12 Nov 2020 04:16:12 -0800 (PST) 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-46-TN56v49hOnmOQlfttLvGJg-1; Thu, 12 Nov 2020 07:16:09 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 223EC64096; Thu, 12 Nov 2020 12:16:04 +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 0158B5B4AB; Thu, 12 Nov 2020 12:16:04 +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 BD1F4181A2E6; Thu, 12 Nov 2020 12:16:03 +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 0ACCG0Yc000680 for ; Thu, 12 Nov 2020 07:16:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 194EA1111C7B; Thu, 12 Nov 2020 12:16:00 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1535C1111C64 for ; Thu, 12 Nov 2020 12:16:00 +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-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F264D102F1E1 for ; Thu, 12 Nov 2020 12:15:59 +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-362-eTV6VPyIOaKQ4MK1O-S08Q-1; Thu, 12 Nov 2020 07:15:57 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACBXl8S083208 for ; Thu, 12 Nov 2020 07:15:56 -0500 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 34s1bs6wss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:56 -0500 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC6NKD009018 for ; Thu, 12 Nov 2020 12:15:53 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03ams.nl.ibm.com with ESMTP id 34nk78nnd8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:53 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFoJJ46924034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:51 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 88B3252057; Thu, 12 Nov 2020 12:15:50 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 719825205F; Thu, 12 Nov 2020 12:15:50 +0000 (GMT) X-MC-Unique: TN56v49hOnmOQlfttLvGJg-1 X-MC-Unique: eTV6VPyIOaKQ4MK1O-S08Q-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 09/11] node_device: refactor address retrieval of node device Date: Thu, 12 Nov 2020 13:15:17 +0100 Message-Id: <20201112121519.2212991-10-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 mlxscore=0 spamscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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.79 on 10.5.11.11 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" Use switch statements instead of if-else condition in the method nodeDeviceFindAddressByName to retrieve address of a node device. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- src/node_device/node_device_driver.c | 30 ++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index f5ea973c..65c647f5 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -638,7 +638,8 @@ nodeDeviceFindAddressByName(const char *name) =20 def =3D virNodeDeviceObjGetDef(dev); for (caps =3D def->caps; caps !=3D NULL; caps =3D caps->next) { - if (caps->data.type =3D=3D VIR_NODE_DEV_CAP_PCI_DEV) { + switch (caps->data.type) { + case VIR_NODE_DEV_CAP_PCI_DEV: { virPCIDeviceAddress pci_addr =3D { .domain =3D caps->data.pci_dev.domain, .bus =3D caps->data.pci_dev.bus, @@ -648,7 +649,9 @@ nodeDeviceFindAddressByName(const char *name) =20 addr =3D virPCIDeviceAddressAsString(&pci_addr); break; - } else if (caps->data.type =3D=3D VIR_NODE_DEV_CAP_CSS_DEV) { + } + + case VIR_NODE_DEV_CAP_CSS_DEV: { virDomainDeviceCCWAddress ccw_addr =3D { .cssid =3D caps->data.ccw_dev.cssid, .ssid =3D caps->data.ccw_dev.ssid, @@ -657,6 +660,29 @@ nodeDeviceFindAddressByName(const char *name) =20 addr =3D virDomainCCWAddressAsString(&ccw_addr); break; + } + + case VIR_NODE_DEV_CAP_SYSTEM: + case VIR_NODE_DEV_CAP_USB_DEV: + case VIR_NODE_DEV_CAP_USB_INTERFACE: + case VIR_NODE_DEV_CAP_NET: + case VIR_NODE_DEV_CAP_SCSI_HOST: + case VIR_NODE_DEV_CAP_SCSI_TARGET: + case VIR_NODE_DEV_CAP_SCSI: + case VIR_NODE_DEV_CAP_STORAGE: + case VIR_NODE_DEV_CAP_FC_HOST: + case VIR_NODE_DEV_CAP_VPORTS: + case VIR_NODE_DEV_CAP_SCSI_GENERIC: + case VIR_NODE_DEV_CAP_DRM: + 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_VDPA: + 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; } } =20 --=20 2.26.2 From nobody Thu May 2 06:49:41 2024 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=1605183377; cv=none; d=zohomail.com; s=zohoarc; b=XqkYLE6u6Q31uQmL/g5RAY3bkk92+CrEFtvBFWtryWlOdNcynWyWIWAa9WksXtWlm87Oi3MCTQv150+J0vDwYppfOBr8anSN6GH2jJE7YCulgwpjyQLgAm8dgn30UdOlgKPE5VfAIM5/80uByIQSiWvxrPKzqI0I0h4xNThL5mo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183377; 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=3QvGke7AfGbcb4DBK7R1l6MmHTu2oXEaFUK6Nh+x0EM=; b=gRu7kz++X+IqVd+e/p5Tl+tL+M8F1O9eF4Aiy1LKLAdxO3n6MxVPP3tMHM7VnAbwLwCdZeoBKo4RR69/tFDHspCsl/at36dxHIVUjyydT1g6oXEfBJpZK1ejnI3wj9Lzo34Gl04LOxpDlMVLrp1e7DXU1DRFt+Sho3J7xrFsr4Y= 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 1605183377137978.9346817129486; Thu, 12 Nov 2020 04:16:17 -0800 (PST) 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-358-yGG-SKH-N_qhmHDl0B8Xaw-1; Thu, 12 Nov 2020 07:16:13 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 182AB107B476; Thu, 12 Nov 2020 12:16:07 +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 E3BBA5C3E1; Thu, 12 Nov 2020 12:16:06 +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 AD006181A71E; Thu, 12 Nov 2020 12:16:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACCG106000698 for ; Thu, 12 Nov 2020 07:16:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 24B282023438; Thu, 12 Nov 2020 12:16:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1EFD1202450E for ; Thu, 12 Nov 2020 12:16:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 06150811E78 for ; Thu, 12 Nov 2020 12:16:01 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-498-4ewzzmgkPvuKle2df-HW0Q-1; Thu, 12 Nov 2020 07:15:58 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC3Dm9127822 for ; Thu, 12 Nov 2020 07:15:58 -0500 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 34ryawa1mj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:15:58 -0500 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 0ACC8Dhl015588 for ; Thu, 12 Nov 2020 12:15:56 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma06ams.nl.ibm.com with ESMTP id 34njuh5myj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:56 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFrXp36569532 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:53 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9427C52059; Thu, 12 Nov 2020 12:15:53 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 7328B5206B; Thu, 12 Nov 2020 12:15:53 +0000 (GMT) X-MC-Unique: yGG-SKH-N_qhmHDl0B8Xaw-1 X-MC-Unique: 4ewzzmgkPvuKle2df-HW0Q-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 10/11] node_device: mdev matrix support Date: Thu, 12 Nov 2020 13:15:18 +0100 Message-Id: <20201112121519.2212991-11-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 phishscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 adultscore=0 spamscore=0 suspectscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120067 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.4 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.79 on 10.5.11.16 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" Allow mdev devices to be created on the matrix device. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- src/node_device/node_device_driver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 65c647f5..e254b492 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -662,6 +662,10 @@ nodeDeviceFindAddressByName(const char *name) break; } =20 + case VIR_NODE_DEV_CAP_AP_MATRIX: + addr =3D g_strdup(caps->data.ap_matrix.addr); + break; + case VIR_NODE_DEV_CAP_SYSTEM: case VIR_NODE_DEV_CAP_USB_DEV: case VIR_NODE_DEV_CAP_USB_INTERFACE: @@ -680,7 +684,6 @@ nodeDeviceFindAddressByName(const char *name) case VIR_NODE_DEV_CAP_VDPA: 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; } --=20 2.26.2 From nobody Thu May 2 06:49:41 2024 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=1605183479; cv=none; d=zohomail.com; s=zohoarc; b=jKo2lR8ESBAphbyPwghtoZ4pwgcxij8TFD/HPvAJOou5dNGJKeDxcpZt0jxV9wHTSCY2F4NstlS8YCNrW41ztk4mHf2xncYcTkicIic7GiFzxGg7nxisbkMbke1XwAaf+teZ3RvsBLtp+fPas9bIwjBF9fnFvuteTRgucKYg8YY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605183479; 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=oyyaOZEOfrybaniwUS1uGSWFk9xRbF/M/O9OPHDLJwY=; b=LreJ/XixULasqR3aFE45zQmKYQRtu7VqpnIWjVIUP0NwJMEmE/hPS70c10t7ZIuM5j4AmGQiR7vBMZRrrQwY4BaRUqGyJ8JGgGBHMtPxq+mvLf2jRZHl1YubyZRyLEeljJa+m3hQA/KyCBwHRxHsSZgNyOfDyE37g93cuOl/6Mg= 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 1605183479570920.3603645350777; Thu, 12 Nov 2020 04:17:59 -0800 (PST) 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-444-cfPOGaDgOau8IDcqvFC0KQ-1; Thu, 12 Nov 2020 07:17:56 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D01231007484; Thu, 12 Nov 2020 12:17:50 +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 AB69D1002C11; Thu, 12 Nov 2020 12:17:50 +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 75ACF181A869; Thu, 12 Nov 2020 12:17:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0ACCG6nZ000740 for ; Thu, 12 Nov 2020 07:16:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id B28A0F51BF; Thu, 12 Nov 2020 12:16:06 +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 AA78CF51A4 for ; Thu, 12 Nov 2020 12:16:04 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 4FC6689C563 for ; Thu, 12 Nov 2020 12:16:04 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-335-G-NtGanPMMyVxR4NLZ0KeQ-1; Thu, 12 Nov 2020 07:16:01 -0500 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC2snC142136 for ; Thu, 12 Nov 2020 07:16:00 -0500 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0b-001b2d01.pphosted.com with ESMTP id 34s38su39y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 07:16:00 -0500 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0ACC8HAO005463 for ; Thu, 12 Nov 2020 12:15:58 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma02fra.de.ibm.com with ESMTP id 34nk782v9y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Nov 2020 12:15:58 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0ACCFtij42795420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Nov 2020 12:15:55 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4CF5352073; Thu, 12 Nov 2020 12:15:55 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2D3E95206B; Thu, 12 Nov 2020 12:15:55 +0000 (GMT) X-MC-Unique: cfPOGaDgOau8IDcqvFC0KQ-1 X-MC-Unique: G-NtGanPMMyVxR4NLZ0KeQ-1 From: Shalini Chellathurai Saroja To: Libvirt Mailing List Subject: [PATCH libvirt v2 11/11] node_device: detecting mdev_types capability on ap_matrix device Date: Thu, 12 Nov 2020 13:15:19 +0100 Message-Id: <20201112121519.2212991-12-shalini@linux.ibm.com> In-Reply-To: <20201112121519.2212991-1-shalini@linux.ibm.com> References: <20201112121519.2212991-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.312, 18.0.737 definitions=2020-11-12_05:2020-11-12, 2020-11-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 spamscore=0 suspectscore=29 malwarescore=0 bulkscore=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011120069 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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Boris Fiuczynski , 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.22 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" From: Boris Fiuczynski Add detection of mdev_types capability to Adjunct Processor Matrix device. Signed-off-by: Boris Fiuczynski Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Jonathon Jongsma --- docs/formatnode.html.in | 24 +++- docs/schemas/nodedev.rng | 4 + src/conf/node_device_conf.c | 108 +++++++++++++++++- src/conf/node_device_conf.h | 11 ++ src/conf/virnodedeviceobj.c | 7 +- src/libvirt_private.syms | 1 + src/node_device/node_device_udev.c | 4 + .../ap_matrix_mdev_types.xml | 14 +++ tests/nodedevxml2xmltest.c | 1 + 9 files changed, 168 insertions(+), 6 deletions(-) create mode 100644 tests/nodedevschemadata/ap_matrix_mdev_types.xml diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index 8a84d0dc..66f38c51 100644 --- a/docs/formatnode.html.in +++ b/docs/formatnode.html.in @@ -452,7 +452,26 @@
ap_matrix
Describes an AP Matrix device on a S390 architecture providi= ng - cryptographic host resources usable for virtualization.
+ cryptographic host resources usable for virtualization. + Sub-elements include: +
+
capability
+
+ This optional element can occur multiple times. If it + exists, it has a mandatory type attribute + which will be set to: +
+
mdev_types=
+
+ Since 6.10.0 + This device is capable of creating mediated devices. + The sub-elements are summarized in + mdev_types capability. +
+
+
+
+ @@ -460,7 +479,8 @@

mdev_types capability

=20

- PCI and CSS + PCI, C= SS + and AP Matrix devices can be capable of creating mediated devices. If they indeed are capable, then the parent capability element for mdev_types type will contain a list of diff --git a/docs/schemas/nodedev.rng b/docs/schemas/nodedev.rng index 5be21145..8ea74f23 100644 --- a/docs/schemas/nodedev.rng +++ b/docs/schemas/nodedev.rng @@ -696,6 +696,9 @@ ap_matrix + + + =20 @@ -736,6 +739,7 @@ vfio-pci vfio-ccw + vfio-ap diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index f3d146a5..01a4d5cd 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -663,10 +663,15 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def) virBufferAsprintf(&buf, "0x%04x\n", data->ap_queue.ap_domain); break; + case VIR_NODE_DEV_CAP_AP_MATRIX: + if (data->ap_matrix.flags & VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MD= EV) + virNodeDeviceCapMdevTypesFormat(&buf, + data->ap_matrix.mdev_types, + data->ap_matrix.nmdev_type= s); + 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; } @@ -861,6 +866,33 @@ virNodeDevCapMdevTypesParseXML(xmlXPathContextPtr ctxt, } =20 =20 +static int +virNodeDevAPMatrixCapabilityParseXML(xmlXPathContextPtr ctxt, + xmlNodePtr node, + virNodeDevCapAPMatrixPtr apm_dev) +{ + g_autofree char *type =3D virXMLPropString(node, "type"); + VIR_XPATH_NODE_AUTORESTORE(ctxt) + + ctxt->node =3D node; + + if (!type) { + virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing capability type= ")); + return -1; + } + + if (STREQ(type, "mdev_types")) { + if (virNodeDevCapMdevTypesParseXML(ctxt, + &apm_dev->mdev_types, + &apm_dev->nmdev_types) < 0) + return -1; + apm_dev->flags |=3D VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV; + } + + return 0; +} + + static int virNodeDevCSSCapabilityParseXML(xmlXPathContextPtr ctxt, xmlNodePtr node, @@ -1031,6 +1063,31 @@ virNodeDevCapAPQueueParseXML(xmlXPathContextPtr ctxt, } =20 =20 +static int +virNodeDevCapAPMatrixParseXML(xmlXPathContextPtr ctxt, + virNodeDeviceDefPtr def G_GNUC_UNUSED, + xmlNodePtr node, + virNodeDevCapAPMatrixPtr ap_matrix) +{ + VIR_XPATH_NODE_AUTORESTORE(ctxt) + g_autofree xmlNodePtr *nodes =3D NULL; + int n =3D 0; + size_t i =3D 0; + + ctxt->node =3D node; + + if ((n =3D virXPathNodeSet("./capability", ctxt, &nodes)) < 0) + return -1; + + for (i =3D 0; i < n; i++) { + if (virNodeDevAPMatrixCapabilityParseXML(ctxt, nodes[i], ap_matrix= ) < 0) + return -1; + } + + return 0; +} + + static int virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virNodeDeviceDefPtr def, @@ -2078,7 +2135,8 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, &caps->data.ap_queue); break; case VIR_NODE_DEV_CAP_AP_MATRIX: - ret =3D 0; + ret =3D virNodeDevCapAPMatrixParseXML(ctxt, def, node, + &caps->data.ap_matrix); break; case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_FC_HOST: @@ -2403,6 +2461,9 @@ virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) break; case VIR_NODE_DEV_CAP_AP_MATRIX: VIR_FREE(data->ap_matrix.addr); + for (i =3D 0; i < data->ap_matrix.nmdev_types; i++) + virMediatedDeviceTypeFree(data->ap_matrix.mdev_types[i]); + VIR_FREE(data->ap_matrix.mdev_types); break; case VIR_NODE_DEV_CAP_MDEV_TYPES: case VIR_NODE_DEV_CAP_DRM: @@ -2454,6 +2515,11 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def) &cap->data.ccw_dev) < 0) return -1; break; + case VIR_NODE_DEV_CAP_AP_MATRIX: + if (virNodeDeviceGetAPMatrixDynamicCaps(def->sysfs_path, + &cap->data.ap_matrix) = < 0) + return -1; + break; =20 /* all types that (supposedly) don't require any updates * relative to what's in the cache. @@ -2473,7 +2539,6 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def) case VIR_NODE_DEV_CAP_VDPA: 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; } @@ -2556,6 +2621,15 @@ virNodeDeviceCapsListExport(virNodeDeviceDefPtr def, ncaps++; } } + + if (caps->data.type =3D=3D VIR_NODE_DEV_CAP_AP_MATRIX) { + flags =3D caps->data.ap_matrix.flags; + + if (flags & VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV) { + MAYBE_ADD_CAP(VIR_NODE_DEV_CAP_MDEV_TYPES); + ncaps++; + } + } } =20 #undef MAYBE_ADD_CAP @@ -2844,6 +2918,27 @@ virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath, return 0; } =20 +/* virNodeDeviceGetAPMatrixDynamicCaps() get info that is stored in sysfs + * about devices related to this device, i.e. things that can change + * without this device itself changing. These must be refreshed + * anytime full XML of the device is requested, because they can + * change with no corresponding notification from the kernel/udev. + */ +int +virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath, + virNodeDevCapAPMatrixPtr ap_matrix) +{ + ap_matrix->flags &=3D ~VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV; + if (virNodeDeviceGetMdevTypesCaps(sysfsPath, + &ap_matrix->mdev_types, + &ap_matrix->nmdev_types) < 0) + return -1; + if (ap_matrix->nmdev_types > 0) + ap_matrix->flags |=3D VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV; + + return 0; +} + #else =20 int @@ -2872,4 +2967,11 @@ virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath= G_GNUC_UNUSED, return -1; } =20 +int +virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath G_GNUC_UNUSED, + virNodeDevCapAPMatrixPtr ap_matrix G_G= NUC_UNUSED) +{ + return -1; +} + #endif /* __linux__ */ diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index b8397128..c67b8e2a 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -109,6 +109,10 @@ typedef enum { VIR_NODE_DEV_CAP_FLAG_CSS_MDEV =3D (1 << 0), } virNodeDevCCWCapFlags; =20 +typedef enum { + VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV =3D (1 << 0), +} virNodeDevAPMatrixCapFlags; + typedef enum { /* Keep in sync with VIR_ENUM_IMPL in node_device_conf.c */ VIR_NODE_DEV_DRM_PRIMARY, @@ -309,6 +313,9 @@ typedef struct _virNodeDevCapAPMatrix virNodeDevCapAPMa= trix; typedef virNodeDevCapAPMatrix *virNodeDevCapAPMatrixPtr; struct _virNodeDevCapAPMatrix { char *addr; + unsigned int flags; /* enum virNodeDevAPMatrixCapFlags */ + virMediatedDeviceTypePtr *mdev_types; + size_t nmdev_types; }; =20 typedef struct _virNodeDevCapData virNodeDevCapData; @@ -430,6 +437,10 @@ int virNodeDeviceGetCSSDynamicCaps(const char *sysfsPath, virNodeDevCapCCWPtr ccw_dev); =20 +int +virNodeDeviceGetAPMatrixDynamicCaps(const char *sysfsPath, + virNodeDevCapAPMatrixPtr ap_matrix); + int virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def); =20 diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 25d12776..c9bda77b 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -702,6 +702,12 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj, return true; break; =20 + case VIR_NODE_DEV_CAP_AP_MATRIX: + if (type =3D=3D VIR_NODE_DEV_CAP_MDEV_TYPES && + (cap->data.ap_matrix.flags & VIR_NODE_DEV_CAP_FLAG_AP_MATR= IX_MDEV)) + return true; + break; + case VIR_NODE_DEV_CAP_SYSTEM: case VIR_NODE_DEV_CAP_USB_DEV: case VIR_NODE_DEV_CAP_USB_INTERFACE: @@ -719,7 +725,6 @@ virNodeDeviceObjHasCap(const virNodeDeviceObj *obj, case VIR_NODE_DEV_CAP_VDPA: 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/libvirt_private.syms b/src/libvirt_private.syms index 491bd5bd..25c3456a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -824,6 +824,7 @@ virNodeDeviceDefFree; virNodeDeviceDefParseFile; virNodeDeviceDefParseNode; virNodeDeviceDefParseString; +virNodeDeviceGetAPMatrixDynamicCaps; virNodeDeviceGetCSSDynamicCaps; virNodeDeviceGetPCIDynamicCaps; virNodeDeviceGetSCSIHostCaps; diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 5f57000e..53f3c24b 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1256,6 +1256,10 @@ udevProcessAPMatrix(struct udev_device *device, *(def->name + i) =3D '_'; } =20 + if (virNodeDeviceGetAPMatrixDynamicCaps(def->sysfs_path, + &data->ap_matrix) < 0) + return -1; + return 0; } =20 diff --git a/tests/nodedevschemadata/ap_matrix_mdev_types.xml b/tests/noded= evschemadata/ap_matrix_mdev_types.xml new file mode 100644 index 00000000..0ca83680 --- /dev/null +++ b/tests/nodedevschemadata/ap_matrix_mdev_types.xml @@ -0,0 +1,14 @@ + + ap_matrix + /sys/devices/vfio_ap/matrix + computer + + + + VFIO AP Passthrough Device + vfio-ap + 65536 + + + + diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c index dc8cb04f..a2321d13 100644 --- a/tests/nodedevxml2xmltest.c +++ b/tests/nodedevxml2xmltest.c @@ -128,6 +128,7 @@ mymain(void) DO_TEST("ap_card07"); DO_TEST("ap_07_0038"); DO_TEST("ap_matrix"); + DO_TEST("ap_matrix_mdev_types"); DO_TEST("mdev_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad"); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; --=20 2.26.2