From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 20F7E952 for ; Wed, 16 Dec 2015 13:31:37 +0100 (CET) Received: by mail-wm0-f44.google.com with SMTP id l126so36322454wml.0 for ; Wed, 16 Dec 2015 04:31:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p+AP+0v43MyYzdn9B625MN8PBQ+RljRXbZ485qE37a4=; b=xK9viWsdvHPUb9hORMn6dig7rmcdVe+yNUt10XPMhXk/DHJQbd5DgDDtJm+oFV0qwp SlmjGqz/kfuWsQerXw6zjTCaHAJ61UJBGY73Vcixo/i7BMnoA64fe57emQyvw7jINjyJ lZolsXeFMNcqHOuMHy3+81/HZxyejbQ2ASJR04axmFAa1l+DgNwEYm9vhAdq7F8Pz6rt 5iJTWDWLFj8xDu+vTopLPYIqHoBdoH+GzhLhNswIwxInsRvUyDbTazN/OimmETzbpMIO acDhqe956FiwThAEgJe7dHIbvM+xov1IuH80oXTa3AM3TyIsIJD56cl3Tz4mtFMuNz5x QwBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p+AP+0v43MyYzdn9B625MN8PBQ+RljRXbZ485qE37a4=; b=QCREqARcQqBkrfnj0LBF4QeMk9p/M+CG7OUnEVMbnd6pElMqdff4YLf5l5OyGXbTx7 c+a2G6sy5r7EGLofhY2JBSphVcpvN9IJTwT2yYQhH8WqUKAIacadjrlun/mWOmTb5tT+ YMMGamcri+MgBwzt7WlRGX0FHlAdNxhX88GzXlne1YLhaFLRgSQr2Z+9A53fhhv+lg20 mOx6+1wLt42UoSZLm+DwillCWQ09fV1+IRvBcyLLfZqQQrsyREU3YR1QVG5/McvgBarn b1P9j7P2KByn7BfyUPALdsf4BXlkoeNVAaZhcIVtkPNQPdl/1i7v0+lnG8E/unbehmKb Zojg== X-Gm-Message-State: ALoCoQndg4UsMwrpaUcSDTdn4o9vOMMJovozgaEUZz/MF6eRNG7TZhk05ZVIxheIz6dTA2QJNlBlRFnbcNofkCxIr9R15DjFVw== X-Received: by 10.28.48.194 with SMTP id w185mr4306024wmw.73.1450269096899; Wed, 16 Dec 2015 04:31:36 -0800 (PST) Received: from alcyon.dev.6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id qm9sm5807683wjc.39.2015.12.16.04.31.35 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Dec 2015 04:31:36 -0800 (PST) From: David Marchand To: sshukla@mvista.com Date: Wed, 16 Dec 2015 13:31:04 +0100 Message-Id: <1450269064-23608-1-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: Cc: dev@dpdk.org Subject: [dpdk-dev] [PATCH] eal: map io resources for non x86 architectures 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: Wed, 16 Dec 2015 12:31:37 -0000 x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources. So let eal remap io resources by accepting IORESOURCE_IO flag for architectures other than x86. Signed-off-by: David Marchand --- lib/librte_eal/common/include/rte_pci.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_pci.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 334c12e..8aaab4a 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -105,7 +105,8 @@ extern struct pci_device_list pci_device_list; /**< Global list of PCI devices. /** Nb. of values in PCI resource format. */ #define PCI_RESOURCE_FMT_NVAL 3 -/** IO resource type: memory address space */ +/** IO resource type: */ +#define IORESOURCE_IO 0x00000100 #define IORESOURCE_MEM 0x00000200 /** diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index bc5b5be..9c4651d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -236,12 +236,21 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev) goto error; } - if (flags & IORESOURCE_MEM) { - dev->mem_resource[i].phys_addr = phys_addr; - dev->mem_resource[i].len = end_addr - phys_addr + 1; - /* not mapped for now */ - dev->mem_resource[i].addr = NULL; - } + /* we only care about IORESOURCE_IO or IORESOURCE_MEM */ + if (!(flags & IORESOURCE_IO) && + !(flags & IORESOURCE_MEM)) + continue; + +#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) + /* x86 can not remap ioports, so skip it, remapping code will + * look at dev->mem_resource[i].phys_addr == 0 and skip it */ + if (flags & IORESOURCE_IO) + continue; +#endif + dev->mem_resource[i].phys_addr = phys_addr; + dev->mem_resource[i].len = end_addr - phys_addr + 1; + /* not mapped for now */ + dev->mem_resource[i].addr = NULL; } fclose(f); return 0; -- 1.7.10.4