[vfio-users] VFIO_IOMMU_MAP_DMA succeeds only on second try?
Oliver Heid
Oliver.Heid at h-next.de
Mon Mar 5 11:37:24 UTC 2018
Do I miss something here? I want to allow RW access of a peripheral
device to a memory region via
struct vfio_iommu_type1_dma_map dma_map = { .argsz = sizeof(dma_map) };
__u32* mem = (__u32*)mmap(NULL,size,PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_ANONYMOUS|MAP_LOCKED, -1, 0);
dma_map.argsz = sizeof(dma_map);
dma_map.flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE;
dma_map.vaddr = (__u64)mem;
dma_map.iova = 0;
dma_map.size = size;
ioctl(container, VFIO_IOMMU_MAP_DMA, &dma_map);
Any idea why theVFIO_IOMMU_MAP_DMA ioctl fails with EINVAL, but then a
second, identical call succeeds? Does it actually succeed then? QEMU
re-tries if the first attempt fails with EBUSY, but not with EINVAL.
The latest 4.15.7 kernel (4.15.6 too IIRC) does not recognize the AMD
Ryzen 3 1200 as VFIO_TYPE1_IOMMU so I am using version 4.15.4.
Thanks!
More information about the vfio-users
mailing list