From 62b9210cc55268941ab04abf84c33ee89f91dd25 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Mon, 19 Apr 2021 21:58:04 +0800 Subject: [PATCH] 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 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7470 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/env_dpdk/memory.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/env_dpdk/memory.c b/lib/env_dpdk/memory.c index dd30c79c1..707a51d08 100644 --- a/lib/env_dpdk/memory.c +++ b/lib/env_dpdk/memory.c @@ -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: