From patchwork Fri Sep 7 14:53:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Stojaczyk, Dariusz" X-Patchwork-Id: 44392 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 613CB2BEA; Fri, 7 Sep 2018 16:55:43 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id CB1E21041 for ; Fri, 7 Sep 2018 16:55:41 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Sep 2018 07:55:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,342,1531810800"; d="scan'208";a="86865390" Received: from violet.igk.intel.com ([10.102.17.58]) by fmsmga004.fm.intel.com with ESMTP; 07 Sep 2018 07:55:38 -0700 From: Darek Stojaczyk To: dev@dpdk.org, Santosh Shukla , Hemant Agrawal , Jerin Jacob Cc: Maxime Coquelin , Anatoly Burakov , Chas Williams , Darek Stojaczyk Date: Fri, 7 Sep 2018 16:53:40 +0200 Message-Id: <20180907145340.79670-1-dariusz.stojaczyk@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] pci/linux: use RTE_IOVA_VA whenever possible 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" This allows DPDK to use RTE_IOVA_VA with VFIO/UIO-bound PCI devices present on the system, but not attached to any rte_pci_driver at the time of init. So far we used RTE_IOVA_VA whenever there was at least one device attached to a driver with an RTE_PCI_DRV_IOVA_AS_VA flag, meaning that other drivers which didn't explicitly report such flag could have been forced to work in RTE_IOVA_VA as well. This patch makes the RTE_PCI_DRV_IOVA_AS_VA explicitly a hint. If it's set, but RTE_IOVA_VA cannot be used, then EAL will print a proper warning. Signed-off-by: Darek Stojaczyk --- drivers/bus/pci/linux/pci.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 04648ac93..961e24024 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -534,7 +534,7 @@ pci_one_device_bound_uio(void) * Any one of the device has iova as va */ static inline int -pci_one_device_has_iova_va(void) +pci_one_device_want_iova_va(void) { struct rte_pci_device *dev = NULL; struct rte_pci_driver *drv = NULL; @@ -635,7 +635,7 @@ rte_pci_get_iommu_class(void) { bool is_bound; bool is_vfio_noiommu_enabled = true; - bool has_iova_va; + bool want_iova_va; bool is_bound_uio; bool iommu_no_va; @@ -643,7 +643,7 @@ rte_pci_get_iommu_class(void) if (!is_bound) return RTE_IOVA_DC; - has_iova_va = pci_one_device_has_iova_va(); + want_iova_va = pci_one_device_want_iova_va(); is_bound_uio = pci_one_device_bound_uio(); iommu_no_va = !pci_devices_iommu_support_va(); #ifdef VFIO_PRESENT @@ -651,11 +651,10 @@ rte_pci_get_iommu_class(void) true : false; #endif - if (has_iova_va && !is_bound_uio && !is_vfio_noiommu_enabled && - !iommu_no_va) + if (!is_bound_uio && !is_vfio_noiommu_enabled && !iommu_no_va) return RTE_IOVA_VA; - if (has_iova_va) { + if (want_iova_va) { RTE_LOG(WARNING, EAL, "Some devices want iova as va but pa will be used because.. "); if (is_vfio_noiommu_enabled) RTE_LOG(WARNING, EAL, "vfio-noiommu mode configured\n");