Commit 62b9210c authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

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: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7470


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent dfe9cee5
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -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: