On Tue, 15 Sep 2020 09:57:03 -0400 Matthew Rosato <mjros...@linux.ibm.com> wrote:
> On 9/15/20 6:33 AM, Cornelia Huck wrote: > > 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? > > > > You are right of course, though the associated header change is not yet > merged in the kernel so it's a bit flaky. But bottom line: yes, we > need a header sync first, I'll include one in v3. Just include a placeholder patch :) It's easy to replace them with a real update prior to merging.