[vfio-users] VFIO_IOMMU_MAP_DMA succeeds only on second try?

Alex Williamson alex.williamson at redhat.com
Mon Mar 12 14:30:02 UTC 2018


On Mon, 12 Mar 2018 15:18:30 +0100
Oliver Heid <Oliver.Heid at h-next.de> wrote:

> Many thanks!
> 
> mmap succeeds - I removed the checks only to post the code on this list. 
> I use this now:
> 
>      if ( !ioctl(container, VFIO_IOMMU_MAP_DMA, &dma_map) )
>      {    if ( !ioctl(container, VFIO_IOMMU_MAP_DMA, &dma_map) )
>           {   perror("mmap ioctl"); return 1; }
>      }
> 

Um, the ioctl returns zero on success, as most ioctls do.  Your test
only reaches the perror if it's able to successfully dma map the same
area twice, so yeah, I would expect that never "fails".




More information about the vfio-users mailing list