Add support to filter by 'ap_matrix' capability.

Signed-off-by: Shalini Chellathurai Saroja <shal...@linux.ibm.com>
Reviewed-by: Bjoern Walk <bw...@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiu...@linux.ibm.com>
---
 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 e8c5be79..f76b3981 100644
--- a/docs/formatnode.html.in
+++ b/docs/formatnode.html.in
@@ -454,6 +454,9 @@
               <dd>AP Queue identifier.</dd>
             </dl>
           </dd>
+          <dt><code>ap_matrix</code></dt>
+          <dd>Describes an AP Matrix device on a S390 architecture providing
+              cryptographic host resources usable for virtualization.</dd>
         </dl>
       </dd>
     </dl>
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index 7658b53b..aa3a0095 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -5043,7 +5043,7 @@ List all of the devices available on the node that are 
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 parents of 
each
 node.  *cap* and *--tree* are mutually exclusive.
 
diff --git a/include/libvirt/libvirt-nodedev.h 
b/include/libvirt/libvirt-nodedev.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          = 1 << 17, /* vDPA device 
*/
     VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_CARD       = 1 << 18, /* s390 AP Card 
device */
     VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE      = 1 << 19, /* s390 AP 
Queue */
+    VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX     = 1 << 20, /* s390 AP 
Matrix */
 } virConnectListAllNodeDeviceFlags;
 
 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)
 
 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;
     }
 
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 NULL in
  * case of error.  On success, the array stored into @devices is guaranteed 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 |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_QUEUE;
             break;
         case VIR_NODE_DEV_CAP_AP_MATRIX:
+            flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_AP_MATRIX;
+            break;
         case VIR_NODE_DEV_CAP_LAST:
             break;
         }
-- 
2.26.2

Reply via email to