From: Michael Qiu <michael.qiu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] BugFix: VFIO never works
Date: Fri, 10 Jul 2015 15:47:19 +0800 [thread overview]
Message-ID: <1436514439-4893-1-git-send-email-michael.qiu@intel.com> (raw)
Commit 35b3313e322b ("pci: merge mapping functions for linux and bsd")
introduced a bug that all vfio will be
blocked.
Root cause is that VFIO_PRESENT is unaccessable in eal
common level.
This patch is to fix this.
Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
lib/librte_eal/common/eal_common_pci.c | 2 --
lib/librte_eal/common/eal_private.h | 3 +++
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 10 ++++++++++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 3805aed..f3dc697 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -146,10 +146,8 @@ pci_map_device(struct rte_pci_device *dev)
/* try mapping the NIC resources using VFIO if it exists */
switch (dev->kdrv) {
case RTE_KDRV_VFIO:
-#ifdef VFIO_PRESENT
if (pci_vfio_is_enabled())
ret = pci_vfio_map_resource(dev);
-#endif
break;
case RTE_KDRV_IGB_UIO:
case RTE_KDRV_UIO_GENERIC:
diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h
index e16bb68..10995c3 100644
--- a/lib/librte_eal/common/eal_private.h
+++ b/lib/librte_eal/common/eal_private.h
@@ -174,6 +174,9 @@ int pci_unbind_kernel_driver(struct rte_pci_device *dev);
*/
int pci_uio_map_resource(struct rte_pci_device *dev);
+int pci_vfio_is_enabled(void);
+
+int pci_vfio_map_resource(struct rte_pci_device *dev);
/**
* Unmap the PCI resource of a PCI device
*
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
index 426953a..3b5da34 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
@@ -909,4 +909,14 @@ pci_vfio_is_enabled(void)
{
return vfio_cfg.vfio_enabled;
}
+#else
+int pci_vfio_is_enabled(void)
+{
+ return 0;
+}
+
+int pci_vfio_map_resource(__rte_unused struct rte_pci_device *dev)
+{
+ return -1;
+}
#endif
--
2.1.0
next reply other threads:[~2015-07-10 7:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 7:47 Michael Qiu [this message]
2015-07-10 8:34 ` Tetsuya Mukawa
2015-07-10 11:25 ` David Marchand
2015-07-10 11:35 ` Tetsuya Mukawa
2015-07-10 11:38 ` Bruce Richardson
2015-07-10 12:12 ` Tetsuya Mukawa
2015-07-10 12:16 ` Thomas Monjalon
2015-07-11 6:32 ` Tetsuya Mukawa
2015-07-11 6:29 ` [dpdk-dev] [PATCH] eal: fix vfio device " Tetsuya Mukawa
2015-07-14 5:03 ` Qiu, Michael
2015-07-14 7:43 ` Tetsuya Mukawa
2015-07-14 8:44 ` 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=1436514439-4893-1-git-send-email-michael.qiu@intel.com \
--to=michael.qiu@intel.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).