DPDK patches and discussions
 help / color / mirror / Atom feed
From: Miao Li <miao.li@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Anatoly Burakov <anatoly.burakov@intel.com>,
	Jonas Pfefferle <jpf@zurich.ibm.com>
Subject: [PATCH v2 2/2] bus/pci: add IO port region check before region map
Date: Thu, 29 Jun 2023 02:26:53 +0000	[thread overview]
Message-ID: <20230629022653.263046-2-miao.li@intel.com> (raw)
In-Reply-To: <20230629022653.263046-1-miao.li@intel.com>

This patch adds IO port region check to skip region map
when doing IO port map for legacy device in secondary process.

Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping")
Cc: stable@dpdk.org

Signed-off-by: Miao Li <miao.li@intel.com>
---
 drivers/bus/pci/linux/pci_vfio.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index e634de8322..dd4ca46120 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -1099,6 +1099,15 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)
 	maps = vfio_res->maps;
 
 	for (i = 0; i < vfio_res->nb_maps; i++) {
+		/* chk for io port region */
+		ret = pci_vfio_is_ioport_bar(dev, vfio_dev_fd, i);
+		if (ret < 0) {
+			goto err_vfio_dev_fd;
+		} else if (ret) {
+			RTE_LOG(INFO, EAL, "Ignore mapping IO port bar(%d)\n", i);
+			continue;
+		}
+
 		if (maps[i].nr_areas > 0) {
 			ret = pci_vfio_sparse_mmap_bar(vfio_dev_fd, vfio_res, i, MAP_FIXED);
 			if (ret < 0) {
-- 
2.25.1


  reply	other threads:[~2023-06-29  2:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28  6:36 [PATCH 1/2] net/virtio: fix legacy device IO port map in secondary process Miao Li
2023-06-28  6:36 ` [PATCH 2/2] bus/pci: add IO port region check before region map Miao Li
2023-06-29  2:26 ` [PATCH v2 1/2] net/virtio: fix legacy device IO port map in secondary process Miao Li
2023-06-29  2:26   ` Miao Li [this message]
2023-07-03  1:19   ` Ling, WeiX
2023-07-03  7:47   ` David Marchand
2023-07-03  8:54     ` Li, Miao
2023-07-03  8:57       ` David Marchand
2023-07-03  9:31         ` Xia, Chenbo
2023-07-07 17:03           ` Gupta, Nipun
2023-07-06  8:58     ` Xia, Chenbo

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=20230629022653.263046-2-miao.li@intel.com \
    --to=miao.li@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=jpf@zurich.ibm.com \
    --cc=stable@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).