From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f172.google.com (mail-pf0-f172.google.com [209.85.192.172]) by dpdk.org (Postfix) with ESMTP id 3BF8E68A5 for ; Wed, 16 Dec 2015 14:51:56 +0100 (CET) Received: by mail-pf0-f172.google.com with SMTP id e66so12933704pfe.0 for ; Wed, 16 Dec 2015 05:51:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mvista-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=XeWhmWXjdULS/Q5Mrnj5TmcFVj/4gt+smo+Hfhcb/SU=; b=gzQGAeBjr+ABWkrYrFAySdkVVYyjsHDUked7rmks8G6V/sSdF9PS4svylaK3Zjhg9h jqMxe9yvm1MzKNufCsbwOGaDb8MqqL6i06wmC50tXLsRsOoOcbtbBQALI31CUJvHcd4W yU64EkVzes1nhDIt/ktyCuy4Ugj+Hgl8aX+oV0yrtdgKOwm+EUHZerIFQ5ssF6x1rel+ 9vfmuAQ+Fx2Hzj9NNqgd2WwHUFOTW7AXduOhKHH3UMy962aMmWNN4mYEPHrl7zGouPtG 6sPno8Jwd1ndzsZoN+N6NEIWfWK6vUgePYyMFUauRo+lJMlUUR3t6A9ihefRnk2094Jb zDtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=XeWhmWXjdULS/Q5Mrnj5TmcFVj/4gt+smo+Hfhcb/SU=; b=drfcX7ms433D9j8xkWzy/49WnhzDijNwfkdmmn3BGL3+HB0VlATDWZ/Ck8M5fwEvjE 9IeWE4TcHE7ZC1QJf288K/62cJDnyl47yRX+R80/AJ1KGg606kozBznxHgE5dQtRWiQO a8SJ2mlgXYqMpsR3Hll+N/XV3QB1I73wty7NFR5LkKW7HrtPFBnJ1ai+JpNAFcush1yH lJz2G5wssywTK1WOiEubHrQF04ZcSmf1EaCyXsabB/6v4Ur+PXYaX/oT0ia/99gKcU1A rfSyAzoHbayKJ5JTrTh0rxo6/9v0+JgCbiqt94TiIc0iluZ0ptVhLauVfewEZcBMb/4t EEPQ== X-Gm-Message-State: ALoCoQmXpf61W5QDdblKTsZbuGSqH6fr2uZPbNUUtaDCl6+cXZBsKnv6n4ejJZ/Fh3Lmjdd9+9i5NPaoSWWM0t0yAXNScVEBO8mm3a7uNhlktrj/9Tw1pjY= MIME-Version: 1.0 X-Received: by 10.98.19.9 with SMTP id b9mr5412581pfj.28.1450273915589; Wed, 16 Dec 2015 05:51:55 -0800 (PST) Received: by 10.66.13.233 with HTTP; Wed, 16 Dec 2015 05:51:55 -0800 (PST) In-Reply-To: <20151216124834.GR29571@yliu-dev.sh.intel.com> References: <1450269064-23608-1-git-send-email-david.marchand@6wind.com> <20151216124834.GR29571@yliu-dev.sh.intel.com> Date: Wed, 16 Dec 2015 19:21:55 +0530 Message-ID: From: Santosh Shukla To: Yuanhan Liu Content-Type: text/plain; charset=UTF-8 Cc: dev@dpdk.org Subject: Re: [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 13:51:56 -0000 On Wed, Dec 16, 2015 at 6:18 PM, Yuanhan Liu wrote: > On Wed, Dec 16, 2015 at 01:31:04PM +0100, David Marchand wrote: >> 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. > > One question: this patch could be a replacement of the igbuio_iomap patch > from Santosh? If so, I like it: It's more elegant. > > --yliu > I did tried similar in past but not in parse_sysfs (such that mem.resource_addr to accept IO_RESOURCE_IO types) and observed that pci_map_resource not able to map address hence segfault at tespmd initialization. i was getting these: EAL: pci_map_resource(): cannot mmap(19, 0x7fa5c00000, 0x20, 0x0): Invalid argument (0xffffffffffffffff) after enabling RTE_PCI_NEED_DRV_MAPPING flags in virtio_ethdev. I guess patch assume that flag enabled for driver right? >> >> 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