From nobody Wed Apr 24 01:32:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1487345022788364.6761255817479; Fri, 17 Feb 2017 07:23:42 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1HFK0GL035374; Fri, 17 Feb 2017 10:20:00 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1HFJwIc008445 for ; Fri, 17 Feb 2017 10:19:58 -0500 Received: from moe.brq.redhat.com (dhcp129-131.brq.redhat.com [10.34.129.131]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1HFJvKn031094; Fri, 17 Feb 2017 10:19:57 -0500 From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 17 Feb 2017 16:19:38 +0100 Message-Id: <78c018693b4090a5ae9716276ed2ac60da4814ef.1487344778.git.mprivozn@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: marcandre.lureau@redhat.com Subject: [libvirt] [PATCH] nodedev: Introduce new drm cap 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" After 7f1bdec5fa0a0cd25 our nodedev driver is capable of determining DRM devices (DRM stands for Direct Render Manager not Digital rights management). There is still one bit missing though: virConnectListAllNodeDevices() is capable of listing either all devices or just those with specified capability. Well, DRM capability is missing there. Signed-off-by: Michal Privoznik Reviewed-by: Marc-Andr=C3=A9 Lureau --- include/libvirt/libvirt-nodedev.h | 1 + src/conf/node_device_conf.c | 3 ++- src/conf/node_device_conf.h | 3 ++- src/libvirt-nodedev.c | 1 + tools/virsh-nodedev.c | 7 +++++-- tools/virsh.pod | 6 +++--- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/libvirt/libvirt-nodedev.h b/include/libvirt/libvirt-no= dedev.h index 4ff8b416a..85003903d 100644 --- a/include/libvirt/libvirt-nodedev.h +++ b/include/libvirt/libvirt-nodedev.h @@ -78,6 +78,7 @@ typedef enum { VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST =3D 1 << 9, /* FC Hos= t Bus Adapter */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS =3D 1 << 10, /* Capabl= e of vport */ VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC =3D 1 << 11, /* Capabl= e of scsi_generic */ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM =3D 1 << 12, /* DRM de= vice */ } virConnectListAllNodeDeviceFlags; =20 int virConnectListAllNodeDevices (virConnectPtr conn, diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index f996db115..b3063d9ec 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -2224,7 +2224,8 @@ virNodeDeviceMatch(virNodeDeviceObjPtr devobj, MATCH(STORAGE) || MATCH(FC_HOST) || MATCH(VPORTS) || - MATCH(SCSI_GENERIC))) + MATCH(SCSI_GENERIC) || + MATCH(DRM))) return false; } =20 diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index be7e0e003..40e930a28 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -340,7 +340,8 @@ void virNodeDeviceObjUnlock(virNodeDeviceObjPtr obj); VIR_CONNECT_LIST_NODE_DEVICES_CAP_STORAGE | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST | \ VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS | \ - VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC) + VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC | \ + VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM) =20 typedef bool (*virNodeDeviceObjListFilter)(virConnectPtr conn, virNodeDeviceDefPtr def); diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c index 6ea14b3e3..83376b0d9 100644 --- a/src/libvirt-nodedev.c +++ b/src/libvirt-nodedev.c @@ -97,6 +97,7 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, = unsigned int flags) * VIR_CONNECT_LIST_NODE_DEVICES_CAP_FC_HOST * VIR_CONNECT_LIST_NODE_DEVICES_CAP_VPORTS * VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC + * VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM * * 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 9ede96886..c69144021 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -414,7 +414,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd A= TTRIBUTE_UNUSED) goto cleanup; } =20 - switch (cap_type) { + switch ((virNodeDevCapType) cap_type) { case VIR_NODE_DEV_CAP_SYSTEM: flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM; break; @@ -451,7 +451,10 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd = ATTRIBUTE_UNUSED) case VIR_NODE_DEV_CAP_SCSI_GENERIC: flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_SCSI_GENERIC; break; - default: + case VIR_NODE_DEV_CAP_DRM: + flags |=3D VIR_CONNECT_LIST_NODE_DEVICES_CAP_DRM; + break; + case VIR_NODE_DEV_CAP_LAST: break; } } diff --git a/tools/virsh.pod b/tools/virsh.pod index a47040984..90f4b5a1f 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -3072,9 +3072,9 @@ List all of the devices available on the node that ar= e known by libvirt. I is used to filter the list by capability types, the types must be 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'. If I<--tree> is -used, the output is formatted in a tree representing parents of each node. -I and I<--tree> are mutually exclusive. +'scsi', 'storage', 'fc_host', 'vports', 'scsi_generic', 'drm'.If I<--tree> +is used, the output is formatted in a tree representing parents of each +node. I and I<--tree> are mutually exclusive. =20 =3Ditem B I =20 --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list