From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by dpdk.org (Postfix) with ESMTP id DCBA3C760 for ; Fri, 29 Jan 2016 19:22:50 +0100 (CET) Received: by mail-pa0-f43.google.com with SMTP id yy13so45045689pab.3 for ; Fri, 29 Jan 2016 10:22:50 -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=/wuFzUlcYJD5ME69dARx9XvPlknVVnbUWz9EBtnqsIY=; b=n6DFc3h19ke3T/0gWKU1N52E0slsilbd9/YDxKf8fAZhm4gTNwSCwKLHTjjzwLs7Rd OBdVBJp/Vok0rTDJqVoqzR69NjiKyv0d8PoSQAxqEUkIw1vyJTDuOrguBT6oHiTRO9k3 Jr8bLMXE/PXH594NEcLAN1qCfxE5qyD6LshQ8sQUNS/a2lo5ECTLI4W89aDOaKU0t6BZ hlk5J5TwbhTg9sukrVFYgdBm+vQ190uFRCYnAVVaFVbotiYCcNR2Up0n9DCX53dxQzzh hXTQI7Ocb7g4iQJRdFiGH0c1r2ZaM/6Y7zZH7heNiVfJ94GUW2xLgSt8GI77WaHnNfQC kV8g== 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=/wuFzUlcYJD5ME69dARx9XvPlknVVnbUWz9EBtnqsIY=; b=X0ReYgGy+KLdrg5WcGAJciCc8FoFo20Pm72VobQHciEzUk3kxRsIBDg0+5+Jh4J7kg q8cbLmC8+mZdpXhwPe73OWLugksrGmgiAYh0SsXtm9IUrzRYgXZbweu5zOnryqYPj6hZ Jxdxru2L1AyjO4iyM2J3+ZoVSIdtD9KBMBpkFn4P3g8ijoojXrUgn0+TsbrSLPXsbZLL p082XnRMfa192BiE3xjB0aBAO5Q9vBOkIejN2XQEDbx1Vf5QzHfJVUkjdQYZ9psrC/xj 4l26Ov+U6MKX4JyQ7U/ThVliHVhbs3H8IEsx/EwyXtjjpZo+QmQiSI0xiiCbXPPdE9wt ySyQ== X-Gm-Message-State: AG10YOQ9tmCe3WssFpV7v0ZFGyWcLVLsbxuhBKXPxRENO2NzyW0Hsb5RmqAZLe9pXKeQwUSm X-Received: by 10.66.150.202 with SMTP id uk10mr15240201pab.73.1454091770312; Fri, 29 Jan 2016 10:22:50 -0800 (PST) Received: from santosh-Latitude-E5530-non-vPro.mvista.com ([106.51.29.23]) by smtp.gmail.com with ESMTPSA id 85sm11161750pfl.18.2016.01.29.10.22.39 (version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jan 2016 10:22:49 -0800 (PST) From: Santosh Shukla To: dev@dpdk.org Date: Fri, 29 Jan 2016 23:51:51 +0530 Message-Id: <1454091717-32251-2-git-send-email-sshukla@mvista.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1454091717-32251-1-git-send-email-sshukla@mvista.com> References: <0000-cover-letter.patch> <1454091717-32251-1-git-send-email-sshukla@mvista.com> Subject: [dpdk-dev] [PATCH v6 2/8] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2016 18:22:51 -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 34c4558..b704ffd 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -687,6 +687,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; @@ -881,6 +882,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