diff options
author | Matthew Rosato | 2020-10-26 16:34:40 +0100 |
---|---|---|
committer | Alex Williamson | 2020-11-01 20:30:52 +0100 |
commit | 92fe289ace3e559e2d18d0c2e49cdfb4cbd5a59b (patch) | |
tree | d442f2b340b85314770c88992f17b4092a6c261f /hw/vfio | |
parent | s390x/pci: use a PCI Function structure (diff) | |
download | qemu-92fe289ace3e559e2d18d0c2e49cdfb4cbd5a59b.tar.gz qemu-92fe289ace3e559e2d18d0c2e49cdfb4cbd5a59b.tar.xz qemu-92fe289ace3e559e2d18d0c2e49cdfb4cbd5a59b.zip |
vfio: Add routine for finding VFIO_DEVICE_GET_INFO capabilities
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>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio')
-rw-r--r-- | hw/vfio/common.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 920786a23e..57f55f0447 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1159,6 +1159,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) { |