[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/13] vfio: Add routine for finding VFIO_DEVICE_GET_INFO capabil
From: |
Matthew Rosato |
Subject: |
[PATCH 12/13] vfio: Add routine for finding VFIO_DEVICE_GET_INFO capabilities |
Date: |
Mon, 26 Oct 2020 11:34:40 -0400 |
Now that VFIO_DEVICE_GET_INFO supports capability chains, add a helper
function to find specific capabilities in the chain.
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
---
hw/vfio/common.c | 10 ++++++++++
include/hw/vfio/vfio-common.h | 2 ++
2 files changed, 12 insertions(+)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 20914bf..dca017d 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -859,6 +859,16 @@ vfio_get_iommu_type1_info_cap(struct vfio_iommu_type1_info
*info, uint16_t id)
return vfio_get_cap((void *)info, info->cap_offset, id);
}
+struct vfio_info_cap_header *
+vfio_get_device_info_cap(struct vfio_device_info *info, uint16_t id)
+{
+ if (!(info->flags & VFIO_DEVICE_FLAGS_CAPS)) {
+ return NULL;
+ }
+
+ return vfio_get_cap((void *)info, info->cap_offset, id);
+}
+
bool vfio_get_info_dma_avail(struct vfio_iommu_type1_info *info,
unsigned int *avail)
{
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index 661a380..d2524f8 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -193,6 +193,8 @@ int vfio_get_dev_region_info(VFIODevice *vbasedev, uint32_t
type,
bool vfio_has_region_cap(VFIODevice *vbasedev, int region, uint16_t cap_type);
struct vfio_info_cap_header *
vfio_get_region_info_cap(struct vfio_region_info *info, uint16_t id);
+struct vfio_info_cap_header *
+vfio_get_device_info_cap(struct vfio_device_info *info, uint16_t id);
#endif
extern const MemoryListener vfio_prereg_listener;
--
1.8.3.1
- [PATCH 03/13] s390x/pci: Move header files to include/hw/s390x, (continued)
- [PATCH 03/13] s390x/pci: Move header files to include/hw/s390x, Matthew Rosato, 2020/10/26
- [PATCH 04/13] vfio: Create shared routine for scanning info capabilities, Matthew Rosato, 2020/10/26
- [PATCH 05/13] vfio: Find DMA available capability, Matthew Rosato, 2020/10/26
- [PATCH 06/13] s390x/pci: Add routine to get the vfio dma available count, Matthew Rosato, 2020/10/26
- [PATCH 07/13] s390x/pci: Honor DMA limits set by vfio, Matthew Rosato, 2020/10/26
- [PATCH 08/13] s390x/pci: create a header dedicated to PCI CLP, Matthew Rosato, 2020/10/26
- [PATCH 11/13] s390x/pci: use a PCI Function structure, Matthew Rosato, 2020/10/26
- [PATCH 02/13] linux-headers: update against 5.10-rc1, Matthew Rosato, 2020/10/26
- [PATCH 12/13] vfio: Add routine for finding VFIO_DEVICE_GET_INFO capabilities,
Matthew Rosato <=
- [PATCH 01/13] update-linux-headers: Add vfio_zdev.h, Matthew Rosato, 2020/10/26
- [PATCH 09/13] s390x/pci: use a PCI Group structure, Matthew Rosato, 2020/10/26
- [PATCH 10/13] s390x/pci: clean up s390 PCI groups, Matthew Rosato, 2020/10/26
- [PATCH 13/13] s390x/pci: get zPCI function info from host, Matthew Rosato, 2020/10/26
- Re: [PATCH 00/13] s390x/pci: s390-pci updates for kernel 5.10-rc1, Cornelia Huck, 2020/10/26