From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 0D8EC5A52 for ; Fri, 10 Jul 2015 09:47:43 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 10 Jul 2015 00:47:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,445,1432623600"; d="scan'208";a="744284844" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 10 Jul 2015 00:47:40 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t6A7lY5P026375; Fri, 10 Jul 2015 15:47:34 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t6A7lUQp004929; Fri, 10 Jul 2015 15:47:32 +0800 Received: (from dayuqiu@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t6A7lKK2004924; Fri, 10 Jul 2015 15:47:20 +0800 From: Michael Qiu To: dev@dpdk.org Date: Fri, 10 Jul 2015 15:47:19 +0800 Message-Id: <1436514439-4893-1-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] BugFix: VFIO never works X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jul 2015 07:47:44 -0000 Commit 35b3313e322b ("pci: merge mapping functions for linux and bsd") introduced a bug that all vfio will be blocked. Root cause is that VFIO_PRESENT is unaccessable in eal common level. This patch is to fix this. Signed-off-by: Michael Qiu --- lib/librte_eal/common/eal_common_pci.c | 2 -- lib/librte_eal/common/eal_private.h | 3 +++ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c index 3805aed..f3dc697 100644 --- a/lib/librte_eal/common/eal_common_pci.c +++ b/lib/librte_eal/common/eal_common_pci.c @@ -146,10 +146,8 @@ pci_map_device(struct rte_pci_device *dev) /* try mapping the NIC resources using VFIO if it exists */ switch (dev->kdrv) { case RTE_KDRV_VFIO: -#ifdef VFIO_PRESENT if (pci_vfio_is_enabled()) ret = pci_vfio_map_resource(dev); -#endif break; case RTE_KDRV_IGB_UIO: case RTE_KDRV_UIO_GENERIC: diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index e16bb68..10995c3 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -174,6 +174,9 @@ int pci_unbind_kernel_driver(struct rte_pci_device *dev); */ int pci_uio_map_resource(struct rte_pci_device *dev); +int pci_vfio_is_enabled(void); + +int pci_vfio_map_resource(struct rte_pci_device *dev); /** * Unmap the PCI resource of a PCI device * diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 426953a..3b5da34 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -909,4 +909,14 @@ pci_vfio_is_enabled(void) { return vfio_cfg.vfio_enabled; } +#else +int pci_vfio_is_enabled(void) +{ + return 0; +} + +int pci_vfio_map_resource(__rte_unused struct rte_pci_device *dev) +{ + return -1; +} #endif -- 2.1.0