From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from netronome.com (host-79-78-33-110.static.as9105.net [79.78.33.110]) by dpdk.org (Postfix) with ESMTP id 62D5C11D4 for ; Fri, 5 Oct 2018 14:08:18 +0200 (CEST) Received: from netronome.com (localhost [127.0.0.1]) by netronome.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id w95C6wKr007983 for ; Fri, 5 Oct 2018 13:06:58 +0100 Received: (from alucero@localhost) by netronome.com (8.14.4/8.14.4/Submit) id w95C6whI007982 for dev@dpdk.org; Fri, 5 Oct 2018 13:06:58 +0100 From: Alejandro Lucero To: dev@dpdk.org Date: Fri, 5 Oct 2018 13:06:50 +0100 Message-Id: <1538741212-7922-5-git-send-email-alejandro.lucero@netronome.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1538741212-7922-1-git-send-email-alejandro.lucero@netronome.com> References: <1538741212-7922-1-git-send-email-alejandro.lucero@netronome.com> Subject: [dpdk-dev] [PATCH v2 4/6] bus/pci: use IOVAs dmak mask check when setting IOVA mode 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: Fri, 05 Oct 2018 12:08:18 -0000 Currently the code precludes IOVA mode if IOMMU hardware reports less addressing bits than necessary for full virtual memory range. Although VT-d emulation currently only supports 39 bits, it could be iovas for allocated memlory being within that supported range. This patch allows IOVA mode in such a case adding a call to rte_eal_check_dma_mask using the reported addressing bits by the IOMMU hardware. Indeed, memory initialization code has been modified for using lower virtual addresses than those used by the kernel for 64 bits processes by default, and therefore memsegs iovas can use 39 bits or less for most systems. And this is likely 100% true for VMs. Signed-off-by: Alejandro Lucero --- drivers/bus/pci/linux/pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index a871549..5cf78d7 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -588,10 +588,8 @@ fclose(fp); mgaw = ((vtd_cap_reg & VTD_CAP_MGAW_MASK) >> VTD_CAP_MGAW_SHIFT) + 1; - if (mgaw < X86_VA_WIDTH) - return false; - return true; + return rte_eal_check_dma_mask(mgaw) == 0 ? true : false; } #elif defined(RTE_ARCH_PPC_64) static bool -- 1.9.1