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 9C4ACC5A0 for ; Sun, 21 Feb 2016 15:18:26 +0100 (CET) Received: by mail-pf0-f172.google.com with SMTP id q63so77891967pfb.0 for ; Sun, 21 Feb 2016 06:18:26 -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=vtxTfdiUieT9Yl8nVXCXf8DnQce1KV6Zeb4NWX9PkZw=; b=gW2s/yon185Jy6S5DWYzlnJxwgybdhk9kF4c9YKUVKlxELEubgqD2GrFSVUWU9bpON 49Ww1veHNUwOlEOsuhY/bBiB/D/16ckcx6EkaUPsWK/aawVdDOdnyvF2/XxJ7azgymSM cPLOSJDr8SPAaHwslL9dbxMSebxIZEJ5PjsOJdzGmp5WbJPlNFW9sdihFqvbpJ8OS+Z5 WtZ8hq4a4NQroegK5RlfbHZRYIErCRyov26xe/BuW6q+vtg81/H7aEwsTspHMwHjPa4D xP1ZNE2umWWvPwKsOpaIStNN27qhBRNO5tIuynF6g28ZlwsdN0lXIYaEDDgmycJjGxSZ vZug== 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=vtxTfdiUieT9Yl8nVXCXf8DnQce1KV6Zeb4NWX9PkZw=; b=RzLSDn7tYD7pYwikV/gUyqjsuqUuTdWRhJ5C85hIk8dGleVEnibOwqPrXXhb0x6VEF FL0z7a0w4zMIMNAxIIoTSNrMRhamfCOU/Hd5JSSfRnrBlukxia83Ef2pRfWBb/FVIN19 nvSrJKBcvu67hKje0mhxbKZ8WrZHYJtc/NLn5dCOoB+sjwHvdWMh/0DA7sL0AJN3pgSQ BxgLwRvqskxVJncVNuC99/ojl5VMJbyD1H7RlXoCHh2VYgD7p+FkzFF/iODKBleouaVf l64VCrtymK5KctqKdhlexTzvNMwMTH1qmvDRajCdlK+PchDVn7ep9FdMoVBcOuO3C/Ix 4DkA== X-Gm-Message-State: AG10YORjbbG+GSPGYa7eS10Vw9lIMsogEsk3oQL0g08Fnn6IdeGIP2RYNdVqtHr6vf0dyi3w X-Received: by 10.98.89.139 with SMTP id k11mr31665417pfj.56.1456064306088; Sun, 21 Feb 2016 06:18:26 -0800 (PST) Received: from localhost.localdomain ([106.216.140.39]) by smtp.gmail.com with ESMTPSA id 3sm30255392pfn.59.2016.02.21.06.18.22 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 21 Feb 2016 06:18:24 -0800 (PST) From: Santosh Shukla To: dev@dpdk.org Date: Sun, 21 Feb 2016 19:48:00 +0530 Message-Id: <1456064281-4606-3-git-send-email-sshukla@mvista.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1456064281-4606-1-git-send-email-sshukla@mvista.com> References: <1454853068-14621-1-git-send-email-sshukla@mvista.com> <1456064281-4606-1-git-send-email-sshukla@mvista.com> Subject: [dpdk-dev] [PATCH v9 2/3] eal/linux: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2016 14:18:26 -0000 vfio_pci_mmap() try to map all pci bars. ioport region are not mapped in vfio/kernel so ignore mmaping for ioport. Signed-off-by: Santosh Shukla Acked-by: Anatoly Burakov --- v9: included anatoly acked-by lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index ffa2dd0..4832313 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -659,6 +659,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev) struct pci_map *maps; uint32_t msix_table_offset = 0; uint32_t msix_table_size = 0; + uint32_t ioport_bar; dev->intr_handle.fd = -1; dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; @@ -853,6 +854,25 @@ pci_vfio_map_resource(struct rte_pci_device *dev) return -1; } + /* chk for io port region */ + 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 config space!\n", + PCI_BASE_ADDRESS_0 + i*4); + return -1; + } + + if (ioport_bar & PCI_BASE_ADDRESS_SPACE_IO) { + RTE_LOG(INFO, EAL, + "Ignore mapping IO port bar(%d) addr: %x\n", + i, ioport_bar); + continue; + } + /* skip non-mmapable BARs */ if ((reg.flags & VFIO_REGION_INFO_FLAG_MMAP) == 0) continue; -- 1.7.9.5