From patchwork Thu Nov 1 19:53:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Lucero X-Patchwork-Id: 47692 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7A8661B1EA; Thu, 1 Nov 2018 20:53:37 +0100 (CET) Received: from netronome.com (host-79-78-33-110.static.as9105.net [79.78.33.110]) by dpdk.org (Postfix) with ESMTP id 41D501B131 for ; Thu, 1 Nov 2018 20:53:31 +0100 (CET) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.15.2/8.15.2/Debian-10) with ESMTP id wA1JrVd2019531 for ; Thu, 1 Nov 2018 19:53:31 GMT Received: (from root@localhost) by netronome.com (8.15.2/8.15.2/Submit) id wA1JrVBm019530 for dev@dpdk.org; Thu, 1 Nov 2018 19:53:31 GMT From: Alejandro Lucero To: dev@dpdk.org Date: Thu, 1 Nov 2018 19:53:27 +0000 Message-Id: <20181101195330.19464-5-alejandro.lucero@netronome.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181101195330.19464-1-alejandro.lucero@netronome.com> References: <20181101195330.19464-1-alejandro.lucero@netronome.com> Subject: [dpdk-dev] [PATCH v2 4/7] bus/pci: avoid call to DMA mask check 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Calling rte_mem_check_dma_mask when memory has not been initialized yet is wrong. This patch use rte_mem_set_dma_mask instead. Once memory initialization is done, the dma mask set will be used for checking memory mapped is within the specified mask. Fixes: fe822eb8c565 ("bus/pci: use IOVA DMA mask check when setting IOVA mode") Signed-off-by: Alejandro Lucero --- drivers/bus/pci/linux/pci.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 0a81e063b..d87384c72 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -590,7 +590,16 @@ pci_one_device_iommu_support_va(struct rte_pci_device *dev) mgaw = ((vtd_cap_reg & VTD_CAP_MGAW_MASK) >> VTD_CAP_MGAW_SHIFT) + 1; - return rte_mem_check_dma_mask(mgaw) == 0 ? true : false; + /* + * Assuming there is no limitation by now. We can not know at this point + * because the memory has not been initialized yet. Setting the dma mask + * will force a check once memory initialization is done. We can not do + * a fallback to IOVA PA now, but if the dma check fails, the error + * message should advice for using '--iova-mode pa' if IOVA VA is the + * current mode. + */ + rte_mem_set_dma_mask(mgaw); + return true; } #elif defined(RTE_ARCH_PPC_64) static bool