From patchwork Fri Feb 26 01:53:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huawei Xie X-Patchwork-Id: 10901 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 [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id CA26A68E8; Fri, 26 Feb 2016 18:47:51 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id C2D085AB7 for ; Fri, 26 Feb 2016 18:47:50 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 26 Feb 2016 09:47:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,498,1449561600"; d="scan'208";a="921875518" Received: from dpdk15.sh.intel.com ([10.239.129.25]) by orsmga002.jf.intel.com with ESMTP; 26 Feb 2016 09:47:47 -0800 From: Huawei Xie To: dev@dpdk.org Date: Fri, 26 Feb 2016 09:53:55 +0800 Message-Id: <1456451636-118476-4-git-send-email-huawei.xie@intel.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1456451636-118476-1-git-send-email-huawei.xie@intel.com> References: <20151222035041.GA7532@pxdev.xzpeter.org> <1456451636-118476-1-git-send-email-huawei.xie@intel.com> Cc: nikita.troitsky@intel.com Subject: [dpdk-dev] [PATCH v4 3/4] eal: call pci_ioport_map when kernel driver isn't managing the device 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Call rte_eal_pci_ioport_map only if driver type is RTE_KDRV_NONE, which means kernel driver(including UIO/VFIO) isn't managing the device. other minor changes: * use RTE_ARCH_X86 for pci ioport map * rework rte_eal_pci_ioport_map a bit Signed-off-by: Huawei Xie Acked-by: David Marchand --- lib/librte_eal/linuxapp/eal/eal_pci.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index b44fa32..112d540 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -621,7 +621,7 @@ int rte_eal_pci_write_config(const struct rte_pci_device *device, } } -#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) +#if defined(RTE_ARCH_X86) static int pci_ioport_map(struct rte_pci_device *dev, int bar __rte_unused, struct rte_pci_ioport *p) @@ -685,12 +685,11 @@ int rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar, struct rte_pci_ioport *p) { - int ret; + int ret = -1; switch (dev->kdrv) { #ifdef VFIO_PRESENT case RTE_KDRV_VFIO: - ret = -1; if (pci_vfio_is_enabled()) ret = pci_vfio_ioport_map(dev, bar, p); break; @@ -699,14 +698,13 @@ rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar, case RTE_KDRV_UIO_GENERIC: ret = pci_uio_ioport_map(dev, bar, p); break; - default: -#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) - /* special case for x86 ... */ + case RTE_KDRV_NONE: +#if defined(RTE_ARCH_X86) ret = pci_ioport_map(dev, bar, p); -#else - ret = -1; #endif break; + default: + break; } if (!ret)