From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.ru (ozlabs.ru [107.173.13.209]) by dpdk.org (Postfix) with ESMTP id D99BB7EDB for ; Wed, 26 Apr 2017 10:09:10 +0200 (CEST) Received: from vpl2.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 840BE3A60026; Wed, 26 Apr 2017 04:09:27 -0400 (EDT) From: Alexey Kardashevskiy To: dev@dpdk.org Cc: Alexey Kardashevskiy Date: Wed, 26 Apr 2017 18:09:08 +1000 Message-Id: <20170426080908.24026-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 Subject: [dpdk-dev] [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA window was created at unexpected offset X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 08:09:11 -0000 VFIO_IOMMU_SPAPR_TCE_CREATE ioctl() returns the actual bus address for just created DMA window. It happens to start from zero because the default window is removed (leaving no windows) and new window starts from zero. However this is not guaranteed and a new window may start from another address, this adds a check and an error message. Signed-off-by: Alexey Kardashevskiy --- Changes: v2: * this just prints warning and fails instead of incorrectly changing IOVA addresses --- lib/librte_eal/linuxapp/eal/eal_vfio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index 46f951f4d..530815790 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -702,6 +702,13 @@ vfio_spapr_dma_map(int vfio_container_fd) return -1; } + if (create.start_addr) { + RTE_LOG(ERR, EAL, + " DMA offsets other than zero is not supported, " + "new window is created at %lx\n", create.start_addr); + return -1; + } + /* map all DPDK segments for DMA. use 1:1 PA to IOVA mapping */ for (i = 0; i < RTE_MAX_MEMSEG; i++) { struct vfio_iommu_type1_dma_map dma_map; @@ -734,7 +741,6 @@ vfio_spapr_dma_map(int vfio_container_fd) "error %i (%s)\n", errno, strerror(errno)); return -1; } - } return 0; -- 2.11.0