mirror of
https://github.com/qemu/qemu.git
synced 2025-01-20 04:23:28 +08:00
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>
This commit is contained in:
parent
9670ee7527
commit
92fe289ace
@ -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);
|
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,
|
bool vfio_get_info_dma_avail(struct vfio_iommu_type1_info *info,
|
||||||
unsigned int *avail)
|
unsigned int *avail)
|
||||||
{
|
{
|
||||||
|
@ -216,6 +216,8 @@ struct vfio_info_cap_header *
|
|||||||
vfio_get_region_info_cap(struct vfio_region_info *info, uint16_t id);
|
vfio_get_region_info_cap(struct vfio_region_info *info, uint16_t id);
|
||||||
bool vfio_get_info_dma_avail(struct vfio_iommu_type1_info *info,
|
bool vfio_get_info_dma_avail(struct vfio_iommu_type1_info *info,
|
||||||
unsigned int *avail);
|
unsigned int *avail);
|
||||||
|
struct vfio_info_cap_header *
|
||||||
|
vfio_get_device_info_cap(struct vfio_device_info *info, uint16_t id);
|
||||||
#endif
|
#endif
|
||||||
extern const MemoryListener vfio_prereg_listener;
|
extern const MemoryListener vfio_prereg_listener;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user