On Mon, 14 Sep 2020 18:29:28 -0400 Matthew Rosato <mjros...@linux.ibm.com> wrote:
> The underlying host may be limiting the number of outstanding DMA > requests for type 1 IOMMU. Add helper functions to check for the > DMA available capability and retrieve the current number of DMA > mappings allowed. > > Signed-off-by: Matthew Rosato <mjros...@linux.ibm.com> > --- > hw/vfio/common.c | 37 +++++++++++++++++++++++++++++++++++++ > include/hw/vfio/vfio-common.h | 2 ++ > 2 files changed, 39 insertions(+) > (...) > +bool vfio_get_info_dma_avail(struct vfio_iommu_type1_info *info, > + unsigned int *avail) > +{ > + struct vfio_info_cap_header *hdr; > + struct vfio_iommu_type1_info_dma_avail *cap; > + > + /* If the capability cannot be found, assume no DMA limiting */ > + hdr = vfio_get_iommu_type1_info_cap(info, > + VFIO_IOMMU_TYPE1_INFO_DMA_AVAIL); ...don't you need a headers sync first to get the new definitions? (...)