From patchwork Tue Jul 7 07:56:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Lakkireddy X-Patchwork-Id: 6130 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 B145A3772; Tue, 7 Jul 2015 09:56:39 +0200 (CEST) Received: from stargate3.asicdesigners.com (stargate.chelsio.com [67.207.112.58]) by dpdk.org (Postfix) with ESMTP id 1EB2FE72 for ; Tue, 7 Jul 2015 09:56:37 +0200 (CEST) Received: from localhost (scalar.blr.asicdesigners.com [10.193.185.94]) by stargate3.asicdesigners.com (8.13.8/8.13.8) with ESMTP id t677uW8s009424; Tue, 7 Jul 2015 00:56:33 -0700 Date: Tue, 7 Jul 2015 13:26:25 +0530 From: Rahul Lakkireddy To: Alejandro Lucero Message-ID: <20150707075623.GA28061@scalar.blr.asicdesigners.com> References: <61d1c9174f7f9159d4005dd2cea16c7719cec964.1434462470.git.rahul.lakkireddy@chelsio.com> <2eeeff646a329cca169033f541de3e96cec3a27a.1435067129.git.rahul.lakkireddy@chelsio.com> <4201419.gIoUKGuTjB@xps13> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev , Felix Marti , Nirranjan Kirubaharan , Kumar Sanghvi Subject: Re: [dpdk-dev] [PATCH v2] vfio: Fix overflow while assigning vfio BAR region offset and size 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" Hi Alejandro, On Mon, Jul 06, 2015 at 16:45:01 +0100, Alejandro Lucero wrote: > Hi all, > > From the kernel VFIO maintainer: > > "I suppose in the short term, mmap should not be advertised as available > on 32bit hosts. Thanks," > > So, as VFIO support for 32bit systems is broken, DPDK should not configure > VFIO in that case. > Thank you very much for the clarification. > > If we need to support 4G BARs, our only choice is really to extend the > vfio region support for a separate file descriptor per region. The only > devices I'm aware of with 4G BARs are Nvidia Tesla. This is possible, > but I would expect such devices would be extremely rare on 32bit hosts. > Our Chelsio T5 cards can also have 4G bar size. So, it seems this won't work on 32-bit with current state of kernel vfio driver. Nevertheless, updating your patch with below diff works fine on 64-bit for vfio testing on Chelsio T5 cards and it compiles for 32-bit targets as well. Thanks, Rahul diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 426953a..6127f5f 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -728,7 +728,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) struct vfio_region_info reg = { .argsz = sizeof(reg) }; void *bar_addr; struct memreg { - uint32_t offset, size; + unsigned long offset, size; } memreg[2] = {}; reg.index = i; @@ -771,7 +771,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) RTE_LOG(DEBUG, EAL, "Trying to map BAR %d that contains the MSI-X " "table. Trying offsets: " - "%04x:%04x, %04x:%04x\n", i, + "0x%04lx:0x%04lx, 0x%04lx:0x%04lx\n", i, memreg[0].offset, memreg[0].size, memreg[1].offset, memreg[1].size); }