From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by dpdk.org (Postfix) with ESMTP id BB1077EEF for ; Sun, 7 Feb 2016 14:51:31 +0100 (CET) Received: by mail-pa0-f47.google.com with SMTP id uo6so60797819pac.1 for ; Sun, 07 Feb 2016 05:51:31 -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=hT9OOkm/l1sOPa2fXNYYyGv1AtmsjLifVIsR/MD4H0s=; b=WbpDm+tLxVsCgQ1tTAHhGC/MCQxoFp3vX4HKBLC4HY3CJvRJdjaN4XV2OZ4b21k05C b39/+/fApsTTo99SOsHGXNpYyPgRSB8etE2v3CcXlnPGqNsaq3r6Ayn229gVAN6XLl9k iVS/BpXgrPc2mzTtwJumwihchLB0KjOJQl5L0IbM2Z4+hZUk+aWEH4v5R1h9MB+GsR1C Ksi7BpOsAL7ZYtfpWOWo7NQzGCjLCs6A7ftNFyhigft6gtzVumLn+PodiskrF5vT1BQj 5N0768EvpJZ5+9131SiQQYKhg6RIy5nCcmTNd996aiKhwFWSXfI7PLRSLmCoyKGufj0U 6zwQ== 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=hT9OOkm/l1sOPa2fXNYYyGv1AtmsjLifVIsR/MD4H0s=; b=KkhN83bQo9Uu3vjTzUTerhzOFB3wrsY51akefBjMIVOVh9g57o6PK9fYZRn01Mqn/T /Z667YAHJXXYwFZ6WozxxHqRQNfOTYLtMJEqcl7yMia2dpXOB3fHevZI2dFVBmSu9AZs qOwRMa57Ds4+v+VLXXLPc7vcF/5d8iityOBLVwGQEu+kbjq8XSp2a4ncpFLidz1MWR7r npE0Qn9DnwhfLEyB6OxsGEDTx8ZrJwBuVCb9a5iZ+oOgUi6rcvb+joYAwi5u36qwLJ4L KH0S7lUcdyNxs3RE8LXyrElJKtU7rmm+rowIiOdfvH9lOzcatSl6W4JxxKyvK0XG/tqK 4AvA== X-Gm-Message-State: AG10YOQwXMv/srcWTY85yDr5yFIJvtyVaRwp4qVVpOwBpkIonBki3ih6WzmnMo1kvEwBrjwu X-Received: by 10.66.100.163 with SMTP id ez3mr35042289pab.5.1454853091165; Sun, 07 Feb 2016 05:51:31 -0800 (PST) Received: from santosh-Latitude-E5530-non-vPro.mvista.com ([106.216.141.181]) by smtp.gmail.com with ESMTPSA id r87sm36763174pfa.61.2016.02.07.05.51.27 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 07 Feb 2016 05:51:30 -0800 (PST) From: Santosh Shukla To: dev@dpdk.org Date: Sun, 7 Feb 2016 19:21:07 +0530 Message-Id: <1454853068-14621-4-git-send-email-sshukla@mvista.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1454853068-14621-1-git-send-email-sshukla@mvista.com> References: <1454853068-14621-1-git-send-email-sshukla@mvista.com> Subject: [dpdk-dev] [PATCH v7 3/4] 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, 07 Feb 2016 13:51:32 -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 --- 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