Message ID | 1452184390-5994-5-git-send-email-sshukla@mvista.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> 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 A48E7B3D6; Thu, 7 Jan 2016 17:34:21 +0100 (CET) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by dpdk.org (Postfix) with ESMTP id CFAA5AF85 for <dev@dpdk.org>; Thu, 7 Jan 2016 17:34:20 +0100 (CET) Received: by mail-pa0-f52.google.com with SMTP id yy13so169915213pab.3 for <dev@dpdk.org>; Thu, 07 Jan 2016 08:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mvista-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yeIDRcR7TaJ9PjieJBgffRPvO7JHQ5IGcM4+g6Z/Dag=; b=L0f05+wCMep+ZX7J0UfObn2Sn80mNv05j65pWn7ryDG+YPEPYpfSML1YnPZB4acg6a Wtz21jIWULVtBREgp+NZaImfhyGoEYd3AbTL1WSGSEwKMNqaKM63LKuJ8jr2iQi+DY/r Ddiu0w9FmnY6wSu7OBq8BiFsPtoonRqjPLLlRaS2XKQlhyot7EvqaFt4WngPHm3FeK1W Il3KFzcuLPxwWFjMezRyxG1fCAzaC7zM2BgFdy6gsEcdCzoq3kIoViN9BF5PD6w8cpe+ FipIFuwt6K2AEHf5pJdpAKVR6YFj0KyYPoZE+nPKAuMWB2/ljseuUOXBieWJxGJWRlTl +z1Q== 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=yeIDRcR7TaJ9PjieJBgffRPvO7JHQ5IGcM4+g6Z/Dag=; b=dhviZBKFZAo9DCg8NrTUUOrG8DfH6H7Q8gbEb8i/bmQ6nIBet23GCo37Tb4sJDurMf dTl7f6QHMkOMDqxwD43dSCXZ+zou4OPedOiiYOjl3J/9+ghyixzt9oSXz4Wd2L+FALbC 7xl7AWFO6tafPcp4szvePrQPx/qDELrYVpasXxJkbep4R1EcP6TGWwUmsn9sOjKjvdm5 WIT31iijHxXcpOXACcaoglJQpb5Ixwy+HKI52kkXlYn2s3ezkq10KSG73UjmBBSO89GN O2Xfkn5SXkGSLHdUvxV1qyTBeS+WATcTdatg/v7BRD2Yzk+xWxn6U2zoGvfcBZ8Jub3L OJbg== X-Gm-Message-State: ALoCoQnaMOL1YPZ+6tSmHzLvWnzfpazMHYmuYBRCQrSkUlWfPjw24CZArprxaSa9gz4NQVQJKkfz7ax2S5kQe/RdXPoXh8JPfQ== X-Received: by 10.67.7.200 with SMTP id de8mr7243116pad.28.1452184460230; Thu, 07 Jan 2016 08:34:20 -0800 (PST) Received: from santosh-Latitude-E5530-non-vPro.mvista.com ([111.93.218.67]) by smtp.gmail.com with ESMTPSA id yn8sm159454163pac.32.2016.01.07.08.34.17 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Jan 2016 08:34:19 -0800 (PST) From: Santosh Shukla <sshukla@mvista.com> To: dev@dpdk.org Date: Thu, 7 Jan 2016 22:03:01 +0530 Message-Id: <1452184390-5994-5-git-send-email-sshukla@mvista.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1452184390-5994-1-git-send-email-sshukla@mvista.com> References: <1452184390-5994-1-git-send-email-sshukla@mvista.com> Subject: [dpdk-dev] [PATCH v3 04/12] linuxapp/vfio: ignore mapping for ioport region X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Santosh Shukla
Jan. 7, 2016, 4:33 p.m. UTC
vfio_pci_mmap() try to map all pci bars. ioport region ar not mapped in
vfio/kernel so ignore mmaping for ioport.
Signed-off-by: Santosh Shukla <sshukla@mvista.com>
---
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
Comments
This looks like the right thing to do. Minor nits. > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > index 74f91ba..4077eb6 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > @@ -760,6 +760,26 @@ pci_vfio_map_resource(struct rte_pci_device *dev) > return -1; > } > > + /* chk for io port region */ > + uint32_t ioport_bar; In general DPDK has followed the kernel practice of putting declarations at the start of function/basic block. It is ok by me, but just noting that the rest of the code doesn't do it. > + ret = pread64(vfio_dev_fd, &ioport_bar, sizeof(ioport_bar), > + VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) > + + PCI_BASE_ADDRESS_0 + i*4); > + > + if (ret != sizeof(ioport_bar)) { > + RTE_LOG(ERR, EAL, > + "Cannot read command (%x) from PCI config" > + "space!\n", PCI_BASE_ADDRESS_0 + i*4); Please dont split the line of a log message string in mid sentence. > + return -1; > + } > + > + if (ioport_bar & PCI_BASE_ADDRESS_SPACE_IO) { > + RTE_LOG(INFO, EAL, "\tIgnore mapping since Its a i/o" > + "port bar (%d) addr : %x\n", i, same here > + ioport_bar); > + continue; > + } > +
On Thu, Jan 7, 2016 at 11:46 PM, Stephen Hemminger < stephen@networkplumber.org> wrote: > This looks like the right thing to do. Minor nits. > > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > > index 74f91ba..4077eb6 100644 > > --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > > @@ -760,6 +760,26 @@ pci_vfio_map_resource(struct rte_pci_device *dev) > > return -1; > > } > > > > + /* chk for io port region */ > > + uint32_t ioport_bar; > > In general DPDK has followed the kernel practice of putting declarations > at the start of function/basic block. It is ok by me, but just noting that > the rest of the code doesn't do it. > > My bad, Thanks! > > + ret = pread64(vfio_dev_fd, &ioport_bar, sizeof(ioport_bar), > > + > VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) > > + + PCI_BASE_ADDRESS_0 + i*4); > > + > > + if (ret != sizeof(ioport_bar)) { > > + RTE_LOG(ERR, EAL, > > + "Cannot read command (%x) from PCI config" > > + "space!\n", PCI_BASE_ADDRESS_0 + i*4); > > Please dont split the line of a log message string in mid sentence. > > me to don't like splitting, This was deliberate to keep checkpatch happy, If we are ok with debug message > 80 line warning I guess it will improve code readability. > + return -1; > > + } > > + > > + if (ioport_bar & PCI_BASE_ADDRESS_SPACE_IO) { > > + RTE_LOG(INFO, EAL, "\tIgnore mapping since Its a > i/o" > > + "port bar (%d) addr : %x\n", i, > same here > > Agreed. > > + ioport_bar); > > + continue; > > + } > > + >
On Fri, Jan 08, 2016 at 12:23:15AM +0530, Santosh Shukla wrote: > > > On Thu, Jan 7, 2016 at 11:46 PM, Stephen Hemminger <stephen@networkplumber.org> > wrote: > > > > + ret = pread64(vfio_dev_fd, &ioport_bar, sizeof(ioport_bar), > > + VFIO_GET_REGION_ADDR > (VFIO_PCI_CONFIG_REGION_INDEX) > > + + PCI_BASE_ADDRESS_0 + i*4); > > + > > + if (ret != sizeof(ioport_bar)) { > > + RTE_LOG(ERR, EAL, > > + "Cannot read command (%x) from PCI config" > > + "space!\n", PCI_BASE_ADDRESS_0 + i*4); > > Please dont split the line of a log message string in mid sentence. > First of all, it'd be good if you can fix your email client to reply emails in a way open source world prefer, such as prefixing last email with leading '> ', and do not auto fold lines. > me to don't like splitting, This was deliberate to keep checkpatch happy, If we > are ok with debug message > 80 line warning I guess it will improve code > readability. You may try to shorten your message to "Cannot read cmd %x from config space!" :) > > > > + return -1; > > + } > > + > > + if (ioport_bar & PCI_BASE_ADDRESS_SPACE_IO) { > > + RTE_LOG(INFO, EAL, "\tIgnore mapping since Its a i/ > o" > > + "port bar (%d) addr : %x\n", i, > same here > > > Agreed. Ditto, maybe following is better "Ignore mapping IO port bar %d, addr: %x\n". --yliu
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 74f91ba..4077eb6 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -760,6 +760,26 @@ pci_vfio_map_resource(struct rte_pci_device *dev) return -1; } + /* chk for io port region */ + uint32_t ioport_bar; + ret = pread64(vfio_dev_fd, &ioport_bar, sizeof(ioport_bar), + VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) + + PCI_BASE_ADDRESS_0 + i*4); + + if (ret != sizeof(ioport_bar)) { + RTE_LOG(ERR, EAL, + "Cannot read command (%x) from PCI config" + "space!\n", PCI_BASE_ADDRESS_0 + i*4); + return -1; + } + + if (ioport_bar & PCI_BASE_ADDRESS_SPACE_IO) { + RTE_LOG(INFO, EAL, "\tIgnore mapping since Its a i/o" + "port bar (%d) addr : %x\n", i, + ioport_bar); + continue; + } + /* skip non-mmapable BARs */ if ((reg.flags & VFIO_REGION_INFO_FLAG_MMAP) == 0) continue;