env_dpdk/memory: don't retrun error for VFIO_IOMMU_MAP_DMA ioctl

There are cases that the valid vfio container doesn't contain
any IOMMU group, so for this case we should not return error.

Fix issue #1855.

Change-Id: I2057dc9a519a31ec16452b1e9d1c470eccfc4992
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7470
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2021-04-19 21:58:04 +08:00 committed by Jim Harris
parent dfe9cee5e3
commit 62b9210cc5

View File

@ -832,10 +832,8 @@ vtophys_iommu_map_dma(uint64_t vaddr, uint64_t iova, uint64_t size)
ret = ioctl(g_vfio.fd, VFIO_IOMMU_MAP_DMA, &dma_map->map);
if (ret) {
DEBUG_PRINT("Cannot set up DMA mapping, error %d\n", errno);
pthread_mutex_unlock(&g_vfio.mutex);
free(dma_map);
return ret;
/* There are cases the vfio container doesn't have IOMMU group, it's safe for this case */
SPDK_NOTICELOG("Cannot set up DMA mapping, error %d, ignored\n", errno);
}
out_insert:
@ -892,9 +890,7 @@ vtophys_iommu_unmap_dma(uint64_t iova, uint64_t size)
unmap.size = dma_map->map.size;
ret = ioctl(g_vfio.fd, VFIO_IOMMU_UNMAP_DMA, &unmap);
if (ret) {
DEBUG_PRINT("Cannot clear DMA mapping, error %d\n", errno);
pthread_mutex_unlock(&g_vfio.mutex);
return ret;
SPDK_NOTICELOG("Cannot clear DMA mapping, error %d, ignored\n", errno);
}
out_remove: