DPDK patches and discussions
 help / color / mirror / Atom feed
From: Santosh Shukla <sshukla@mvista.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v9 2/3] eal/linux: vfio: ignore mapping for ioport region
Date: Sun, 21 Feb 2016 19:48:00 +0530	[thread overview]
Message-ID: <1456064281-4606-3-git-send-email-sshukla@mvista.com> (raw)
In-Reply-To: <1456064281-4606-1-git-send-email-sshukla@mvista.com>

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 <sshukla@mvista.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
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

  parent reply	other threads:[~2016-02-21 14:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-07 13:51 [dpdk-dev] [PATCH v7 0/4] Add virtio support for arm/arm64 Santosh Shukla
2016-02-07 13:51 ` [dpdk-dev] [PATCH v7 1/4] eal/linux: never check iopl for arm Santosh Shukla
2016-02-18  5:26   ` Santosh Shukla
2016-02-07 13:51 ` [dpdk-dev] [PATCH v7 2/4] virtio: Introduce config RTE_VIRTIO_INC_VECTOR Santosh Shukla
2016-02-07 21:25   ` Thomas Monjalon
2016-02-08  5:45     ` Santosh Shukla
     [not found]       ` <CAAyOgsZO+6+kFZZZM203fPR3AmVYB0v7j3-f+DawZOCuR-AVvQ@mail.gmail.com>
     [not found]         ` <20160215105743.GB21426@yliu-dev.sh.intel.com>
     [not found]           ` <CAAyOgsaT5TcsPfum8x6yzAJAz=5N+c5QebEn7KCyJn7oK=VMsw@mail.gmail.com>
2016-02-16  3:05             ` Yuanhan Liu
2016-02-19  4:46               ` Santosh Shukla
2016-02-19  6:42                 ` Yuanhan Liu
2016-02-22  2:03                   ` Xie, Huawei
2016-02-22  4:14                     ` Santosh Shukla
2016-02-22 10:22                       ` Thomas Monjalon
2016-02-07 13:51 ` [dpdk-dev] [PATCH v7 3/4] eal/linux: vfio: ignore mapping for ioport region Santosh Shukla
2016-02-08  9:15   ` Burakov, Anatoly
2016-02-18  5:26     ` Santosh Shukla
2016-02-07 13:51 ` [dpdk-dev] [PATCH v7 4/4] eal/linux: vfio: add pci ioport support Santosh Shukla
2016-02-08  8:51   ` David Marchand
2016-02-08  9:40     ` Santosh Shukla
2016-02-21 14:17 ` [dpdk-dev] [PATCH v9 0/3] Add virtio support for arm/arm64 Santosh Shukla
2016-02-21 14:17   ` [dpdk-dev] [PATCH v9 1/3] eal/linux: never check iopl for arm Santosh Shukla
2016-02-21 14:18   ` Santosh Shukla [this message]
2016-02-21 14:18   ` [dpdk-dev] [PATCH v9 3/3] eal/linux: vfio: add pci ioport support Santosh Shukla
2016-02-22  5:41   ` [dpdk-dev] [PATCH v9 0/3] Add virtio support for arm/arm64 Yuanhan Liu
2016-02-23  6:11     ` Santosh Shukla
2016-02-24 10:45     ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456064281-4606-3-git-send-email-sshukla@mvista.com \
    --to=sshukla@mvista.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).