From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id CC87E1B44E; Tue, 10 Jul 2018 12:14:35 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E5C077889; Tue, 10 Jul 2018 10:14:35 +0000 (UTC) Received: from [10.36.117.44] (ovpn-117-44.ams2.redhat.com [10.36.117.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6FF0111AF0B; Tue, 10 Jul 2018 10:14:31 +0000 (UTC) From: "Eelco Chaudron" To: "Alejandro Lucero" Cc: dev@dpdk.org, stable@dpdk.org, anatoly.burakov@intel.com, maxime.coquelin@redhat.com, ferruh.yigit@intel.com Date: Tue, 10 Jul 2018 12:14:30 +0200 Message-ID: <79AD128F-0B7B-49B6-8F20-3C9A72036769@redhat.com> In-Reply-To: <1530708838-2682-4-git-send-email-alejandro.lucero@netronome.com> References: <1530708838-2682-1-git-send-email-alejandro.lucero@netronome.com> <1530708838-2682-4-git-send-email-alejandro.lucero@netronome.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 10 Jul 2018 10:14:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 10 Jul 2018 10:14:35 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'echaudro@redhat.com' RCPT:'' Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH v3 3/6] bus/pci: use IOVAs 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: Tue, 10 Jul 2018 10:14:36 -0000 On 4 Jul 2018, at 14:53, Alejandro Lucero wrote: > Although VT-d emulation currently only supports 39 bits, it could > be iovas being within that supported range. This patch allows > IOVA mode in such a case. > > Indeed, memory initialization code can be 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 system. And this is likely 100% true for VMs. > > Signed-off-by: Alejandro Lucero > --- > drivers/bus/pci/linux/pci.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c > index 74deef3..792c819 100644 > --- a/drivers/bus/pci/linux/pci.c > +++ b/drivers/bus/pci/linux/pci.c > @@ -43,6 +43,7 @@ > #include > #include > #include > +#include > > #include "eal_private.h" > #include "eal_filesystem.h" > @@ -613,10 +614,12 @@ > fclose(fp); > > mgaw = ((vtd_cap_reg & VTD_CAP_MGAW_MASK) >> VTD_CAP_MGAW_SHIFT) + > 1; > - if (mgaw < X86_VA_WIDTH) > + > + if (!rte_eal_check_dma_mask(mgaw)) If think in this case we still need to check the X86_VA_WIDTH, i.e. if (mgaw < X86_VA_WIDTH && !rte_eal_check_dma_mask(mgaw)) > + return true; > + else > return false; > > - return true; > } > #elif defined(RTE_ARCH_PPC_64) > static bool > @@ -640,13 +643,17 @@ > { > struct rte_pci_device *dev = NULL; > struct rte_pci_driver *drv = NULL; > + int iommu_dma_mask_check_done = 0; > > FOREACH_DRIVER_ON_PCIBUS(drv) { > FOREACH_DEVICE_ON_PCIBUS(dev) { > if (!rte_pci_match(drv, dev)) > continue; > - if (!pci_one_device_iommu_support_va(dev)) > - return false; > + if (!iommu_dma_mask_check_done) { > + if (pci_one_device_iommu_support_va(dev) < 0) > + return false; > + iommu_dma_mask_check_done = 1; Not sure why this change? Why do we only need to check one device on the bus? In addition, if this is what was intended, rather than a variable you can return true in this case, or did you intended to clear the iommu_dma_mask_check_done on every PCI BUS iteration? > + } > } > } > return true; > -- > 1.9.1