[v5,2/2] eal/vfio: export internal vfio functions

Message ID 1522828120-16100-2-git-send-email-hemant.agrawal@nxp.com
State New
Headers show
Series
  • [v5,1/2] doc: add vfio api support
Related show

Commit Message

Hemant April 4, 2018, 7:48 a.m.
This patch moves some of the internal vfio functions from
eal_vfio.h to rte_vfio.h for common uses with "rte_" prefix.

This patch also change the FSLMC bus usages from the internal
VFIO functions to external ones with "rte_" prefix

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

---
v5: fix the bsd compilation

 drivers/bus/fslmc/Makefile                     |  1 -
 drivers/bus/fslmc/fslmc_vfio.c                 |  7 +--
 drivers/bus/fslmc/fslmc_vfio.h                 |  2 -
 drivers/bus/fslmc/meson.build                  |  1 -
 lib/librte_eal/bsdapp/eal/eal.c                | 24 +++++++++
 lib/librte_eal/common/include/rte_vfio.h       | 75 +++++++++++++++++++++++++-
 lib/librte_eal/linuxapp/eal/eal_vfio.c         | 39 +++++++-------
 lib/librte_eal/linuxapp/eal/eal_vfio.h         | 21 --------
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c |  4 +-
 lib/librte_eal/rte_eal_version.map             |  3 ++
 10 files changed, 127 insertions(+), 50 deletions(-)

-- 
2.7.4

Comments

Wang, Xiao W April 5, 2018, 9:03 a.m. | #1
Hi Hemant,

> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal

> Sent: Wednesday, April 4, 2018 3:49 PM

> To: dev@dpdk.org

> Cc: Burakov, Anatoly <anatoly.burakov@intel.com>; thomas@monjalon.net

> Subject: [dpdk-dev] [PATCH v5 2/2] eal/vfio: export internal vfio functions

> 

> This patch moves some of the internal vfio functions from

> eal_vfio.h to rte_vfio.h for common uses with "rte_" prefix.

> 

> This patch also change the FSLMC bus usages from the internal

> VFIO functions to external ones with "rte_" prefix

> 

> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

> ---

> v5: fix the bsd compilation

> 

>  drivers/bus/fslmc/Makefile                     |  1 -

>  drivers/bus/fslmc/fslmc_vfio.c                 |  7 +--

>  drivers/bus/fslmc/fslmc_vfio.h                 |  2 -

>  drivers/bus/fslmc/meson.build                  |  1 -

>  lib/librte_eal/bsdapp/eal/eal.c                | 24 +++++++++

>  lib/librte_eal/common/include/rte_vfio.h       | 75

> +++++++++++++++++++++++++-

>  lib/librte_eal/linuxapp/eal/eal_vfio.c         | 39 +++++++-------

>  lib/librte_eal/linuxapp/eal/eal_vfio.h         | 21 --------

>  lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c |  4 +-

>  lib/librte_eal/rte_eal_version.map             |  3 ++

>  10 files changed, 127 insertions(+), 50 deletions(-)

> 

> diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile

> index 93870ba..3aa34e2 100644

> --- a/drivers/bus/fslmc/Makefile

> +++ b/drivers/bus/fslmc/Makefile

> @@ -16,7 +16,6 @@ CFLAGS += $(WERROR_FLAGS)

>  CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc

>  CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc

>  CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include

> -CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal

>  CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common

>  LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring

>  LDLIBS += -lrte_ethdev

> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c

> index 62499de..f3b2960 100644

> --- a/drivers/bus/fslmc/fslmc_vfio.c

> +++ b/drivers/bus/fslmc/fslmc_vfio.c

> @@ -91,7 +91,8 @@ fslmc_get_container_group(int *groupid)

>  	}

> 

>  	/* get group number */

> -	ret = vfio_get_group_no(SYSFS_FSL_MC_DEVICES, g_container,

> groupid);

> +	ret = rte_vfio_get_group_num(SYSFS_FSL_MC_DEVICES,

> +				     g_container, groupid);

>  	if (ret <= 0) {

>  		DPAA2_BUS_ERR("Unable to find %s IOMMU group",

> g_container);

>  		return -1;

> @@ -124,7 +125,7 @@ vfio_connect_container(void)

>  	}

> 

>  	/* Opens main vfio file descriptor which represents the "container" */

> -	fd = vfio_get_container_fd();

> +	fd = rte_vfio_get_container_fd();

>  	if (fd < 0) {

>  		DPAA2_BUS_ERR("Failed to open VFIO container");

>  		return -errno;

> @@ -620,7 +621,7 @@ fslmc_vfio_setup_group(void)

>  	}

> 

>  	/* Get the actual group fd */

> -	ret = vfio_get_group_fd(groupid);

> +	ret = rte_vfio_get_group_fd(groupid);

>  	if (ret < 0)

>  		return ret;

>  	vfio_group.fd = ret;

> diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h

> index e8fb344..9e2c4fe 100644

> --- a/drivers/bus/fslmc/fslmc_vfio.h

> +++ b/drivers/bus/fslmc/fslmc_vfio.h

> @@ -10,8 +10,6 @@

> 

>  #include <rte_vfio.h>

> 

> -#include "eal_vfio.h"

> -

>  #define DPAA2_MC_DPNI_DEVID	7

>  #define DPAA2_MC_DPSECI_DEVID	3

>  #define DPAA2_MC_DPCON_DEVID	5

> diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.build

> index e94340e..78f9d92 100644

> --- a/drivers/bus/fslmc/meson.build

> +++ b/drivers/bus/fslmc/meson.build

> @@ -22,6 +22,5 @@ sources = files('fslmc_bus.c',

> 

>  allow_experimental_apis = true

> 

> -includes += include_directories('../../../lib/librte_eal/linuxapp/eal')

>  includes += include_directories('mc', 'qbman/include', 'portal')

>  cflags += ['-D_GNU_SOURCE']

> diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c

> index 4eafcb5..e2f2df1 100644

> --- a/lib/librte_eal/bsdapp/eal/eal.c

> +++ b/lib/librte_eal/bsdapp/eal/eal.c

> @@ -746,6 +746,10 @@ int rte_vfio_enable(const char *modname);

>  int rte_vfio_is_enabled(const char *modname);

>  int rte_vfio_noiommu_is_enabled(void);

>  int rte_vfio_clear_group(int vfio_group_fd);

> +int rte_vfio_get_group_num(const char *sysfs_base, const char *dev_addr,

> +			   int *iommu_group_num);

> +int rte_vfio_get_container_fd(void);

> +int rte_vfio_get_group_fd(int iommu_group_num);


Considering the "group_no" field defined in eal_vfio.h, will "iommu_group_num" cause inconsistency
In naming?
 
/*
 * we don't need to store device fd's anywhere since they can be obtained from
 * the group fd via an ioctl() call.
 */
struct vfio_group {
        int group_no;
        int fd;
        int devices;
};

BRs,
Xiao
Thomas Monjalon April 5, 2018, 10:22 a.m. | #2
05/04/2018 11:03, Wang, Xiao W:

> > +int rte_vfio_get_group_num(const char *sysfs_base, const char *dev_addr,

> > +			   int *iommu_group_num);

> > +int rte_vfio_get_container_fd(void);

> > +int rte_vfio_get_group_fd(int iommu_group_num);

> 

> Considering the "group_no" field defined in eal_vfio.h, will "iommu_group_num" cause inconsistency

> In naming?


I asked to change the function name to "num" because it is more meaningful.
"group_no" field is private? Can it be renamed?
Wang, Xiao W April 5, 2018, 10:35 a.m. | #3
Yes, it's private. We could do that if really needed.

BRs,
Xiao
> -----Original Message-----

> From: Thomas Monjalon [mailto:thomas@monjalon.net]

> Sent: Thursday, April 5, 2018 6:23 PM

> To: Wang, Xiao W <xiao.w.wang@intel.com>

> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; dev@dpdk.org; Burakov,

> Anatoly <anatoly.burakov@intel.com>

> Subject: Re: [dpdk-dev] [PATCH v5 2/2] eal/vfio: export internal vfio functions

> 

> 05/04/2018 11:03, Wang, Xiao W:

> 

> > > +int rte_vfio_get_group_num(const char *sysfs_base, const char

> *dev_addr,

> > > +			   int *iommu_group_num);

> > > +int rte_vfio_get_container_fd(void);

> > > +int rte_vfio_get_group_fd(int iommu_group_num);

> >

> > Considering the "group_no" field defined in eal_vfio.h, will

> "iommu_group_num" cause inconsistency

> > In naming?

> 

> I asked to change the function name to "num" because it is more meaningful.

> "group_no" field is private? Can it be renamed?

>
Thomas Monjalon April 11, 2018, 9:25 p.m. | #4
04/04/2018 09:48, Hemant Agrawal:
> This patch moves some of the internal vfio functions from

> eal_vfio.h to rte_vfio.h for common uses with "rte_" prefix.

> 

> This patch also change the FSLMC bus usages from the internal

> VFIO functions to external ones with "rte_" prefix

> 

> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

> ---

> v5: fix the bsd compilation

> 

>  drivers/bus/fslmc/Makefile                     |  1 -

>  drivers/bus/fslmc/fslmc_vfio.c                 |  7 +--

>  drivers/bus/fslmc/fslmc_vfio.h                 |  2 -

>  drivers/bus/fslmc/meson.build                  |  1 -

>  lib/librte_eal/bsdapp/eal/eal.c                | 24 +++++++++

>  lib/librte_eal/common/include/rte_vfio.h       | 75 +++++++++++++++++++++++++-

>  lib/librte_eal/linuxapp/eal/eal_vfio.c         | 39 +++++++-------

>  lib/librte_eal/linuxapp/eal/eal_vfio.h         | 21 --------

>  lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c |  4 +-

>  lib/librte_eal/rte_eal_version.map             |  3 ++

>  10 files changed, 127 insertions(+), 50 deletions(-)


Please, could you rebase on HEAD (on top of Anatoly's patches)?
Hemant April 12, 2018, 6:26 a.m. | #5
> Please, could you rebase on HEAD (on top of Anatoly's patches)?

> 

done
> 

>

Patch

diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile
index 93870ba..3aa34e2 100644
--- a/drivers/bus/fslmc/Makefile
+++ b/drivers/bus/fslmc/Makefile
@@ -16,7 +16,6 @@  CFLAGS += $(WERROR_FLAGS)
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc
 CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include
-CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal
 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
 LDLIBS += -lrte_ethdev
diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 62499de..f3b2960 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -91,7 +91,8 @@  fslmc_get_container_group(int *groupid)
 	}
 
 	/* get group number */
-	ret = vfio_get_group_no(SYSFS_FSL_MC_DEVICES, g_container, groupid);
+	ret = rte_vfio_get_group_num(SYSFS_FSL_MC_DEVICES,
+				     g_container, groupid);
 	if (ret <= 0) {
 		DPAA2_BUS_ERR("Unable to find %s IOMMU group", g_container);
 		return -1;
@@ -124,7 +125,7 @@  vfio_connect_container(void)
 	}
 
 	/* Opens main vfio file descriptor which represents the "container" */
-	fd = vfio_get_container_fd();
+	fd = rte_vfio_get_container_fd();
 	if (fd < 0) {
 		DPAA2_BUS_ERR("Failed to open VFIO container");
 		return -errno;
@@ -620,7 +621,7 @@  fslmc_vfio_setup_group(void)
 	}
 
 	/* Get the actual group fd */
-	ret = vfio_get_group_fd(groupid);
+	ret = rte_vfio_get_group_fd(groupid);
 	if (ret < 0)
 		return ret;
 	vfio_group.fd = ret;
diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h
index e8fb344..9e2c4fe 100644
--- a/drivers/bus/fslmc/fslmc_vfio.h
+++ b/drivers/bus/fslmc/fslmc_vfio.h
@@ -10,8 +10,6 @@ 
 
 #include <rte_vfio.h>
 
-#include "eal_vfio.h"
-
 #define DPAA2_MC_DPNI_DEVID	7
 #define DPAA2_MC_DPSECI_DEVID	3
 #define DPAA2_MC_DPCON_DEVID	5
diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.build
index e94340e..78f9d92 100644
--- a/drivers/bus/fslmc/meson.build
+++ b/drivers/bus/fslmc/meson.build
@@ -22,6 +22,5 @@  sources = files('fslmc_bus.c',
 
 allow_experimental_apis = true
 
-includes += include_directories('../../../lib/librte_eal/linuxapp/eal')
 includes += include_directories('mc', 'qbman/include', 'portal')
 cflags += ['-D_GNU_SOURCE']
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 4eafcb5..e2f2df1 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -746,6 +746,10 @@  int rte_vfio_enable(const char *modname);
 int rte_vfio_is_enabled(const char *modname);
 int rte_vfio_noiommu_is_enabled(void);
 int rte_vfio_clear_group(int vfio_group_fd);
+int rte_vfio_get_group_num(const char *sysfs_base, const char *dev_addr,
+			   int *iommu_group_num);
+int rte_vfio_get_container_fd(void);
+int rte_vfio_get_group_fd(int iommu_group_num);
 
 int rte_vfio_setup_device(__rte_unused const char *sysfs_base,
 		      __rte_unused const char *dev_addr,
@@ -781,3 +785,23 @@  int rte_vfio_clear_group(__rte_unused int vfio_group_fd)
 {
 	return 0;
 }
+
+int __rte_experimental
+rte_vfio_get_group_num(__rte_unused const char *sysfs_base,
+		       __rte_unused const char *dev_addr,
+		       __rte_unused int *iommu_group_num)
+{
+	return -1;
+}
+
+int  __rte_experimental
+rte_vfio_get_container_fd(void)
+{
+	return -1;
+}
+
+int  __rte_experimental
+rte_vfio_get_group_fd(__rte_unused int iommu_group_num)
+{
+	return -1;
+}
diff --git a/lib/librte_eal/common/include/rte_vfio.h b/lib/librte_eal/common/include/rte_vfio.h
index 9b7b983..9369b42 100644
--- a/lib/librte_eal/common/include/rte_vfio.h
+++ b/lib/librte_eal/common/include/rte_vfio.h
@@ -37,6 +37,13 @@ 
 extern "C" {
 #endif
 
+/* NOIOMMU is defined from kernel version 4.5 onwards */
+#ifdef VFIO_NOIOMMU_IOMMU
+#define RTE_VFIO_NOIOMMU VFIO_NOIOMMU_IOMMU
+#else
+#define RTE_VFIO_NOIOMMU 8
+#endif
+
 /**
  * Setup vfio_cfg for the device identified by its address.
  * It discovers the configured I/O MMU groups or sets a new one for the device.
@@ -128,10 +135,76 @@  int rte_vfio_is_enabled(const char *modname);
  */
 int rte_vfio_noiommu_is_enabled(void);
 
-/* remove group fd from internal VFIO group fd array */
+/**
+ * Remove group fd from internal VFIO group fd array/
+ *
+ * This function is only relevant to linux and will return
+ * an error on BSD.
+ *
+ * @param vfio_group_fd
+ *   VFIO Grouup FD.
+ *
+ * @return
+ *   0 on success.
+ *   <0 on failure.
+ */
 int
 rte_vfio_clear_group(int vfio_group_fd);
 
+/**
+ * Parse IOMMU group number for a device
+ *
+ * This function is only relevant to linux and will return
+ * an error on BSD.
+ *
+ * @param sysfs_base
+ *   sysfs path prefix.
+ *
+ * @param dev_addr
+ *   device location.
+ *
+ * @param iommu_group_num
+ *   iommu group number
+ *
+ * @return
+ *  >0 on success
+ *   0 for non-existent group or VFIO
+ *  <0 for errors
+ */
+int __rte_experimental
+rte_vfio_get_group_num(const char *sysfs_base,
+		       const char *dev_addr,
+		       int *iommu_group_num);
+
+/**
+ * Open VFIO container fd or get an existing one
+ *
+ * This function is only relevant to linux and will return
+ * an error on BSD.
+ *
+ * @return
+ *  > 0 container fd
+ *  < 0 for errors
+ */
+int __rte_experimental
+rte_vfio_get_container_fd(void);
+
+/**
+ * Open VFIO group fd or get an existing one
+ *
+ * This function is only relevant to linux and will return
+ * an error on BSD.
+ *
+ * @param iommu_group_num
+ *   iommu group number
+ *
+ * @return
+ *  > 0 group fd
+ *  < 0 for errors
+ */
+int __rte_experimental
+rte_vfio_get_group_fd(int iommu_group_num);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index e44ae4d..6021872 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -36,7 +36,7 @@  static const struct vfio_iommu_type iommu_types[] = {
 };
 
 int
-vfio_get_group_fd(int iommu_group_no)
+rte_vfio_get_group_fd(int iommu_group_num)
 {
 	int i;
 	int vfio_group_fd;
@@ -45,7 +45,7 @@  vfio_get_group_fd(int iommu_group_no)
 
 	/* check if we already have the group descriptor open */
 	for (i = 0; i < VFIO_MAX_GROUPS; i++)
-		if (vfio_cfg.vfio_groups[i].group_no == iommu_group_no)
+		if (vfio_cfg.vfio_groups[i].group_no == iommu_group_num)
 			return vfio_cfg.vfio_groups[i].fd;
 
 	/* Lets see first if there is room for a new group */
@@ -70,7 +70,7 @@  vfio_get_group_fd(int iommu_group_no)
 	if (internal_config.process_type == RTE_PROC_PRIMARY) {
 		/* try regular group format */
 		snprintf(filename, sizeof(filename),
-				 VFIO_GROUP_FMT, iommu_group_no);
+				 VFIO_GROUP_FMT, iommu_group_num);
 		vfio_group_fd = open(filename, O_RDWR);
 		if (vfio_group_fd < 0) {
 			/* if file not found, it's not an error */
@@ -82,7 +82,8 @@  vfio_get_group_fd(int iommu_group_no)
 
 			/* special case: try no-IOMMU path as well */
 			snprintf(filename, sizeof(filename),
-					VFIO_NOIOMMU_GROUP_FMT, iommu_group_no);
+					VFIO_NOIOMMU_GROUP_FMT,
+					iommu_group_num);
 			vfio_group_fd = open(filename, O_RDWR);
 			if (vfio_group_fd < 0) {
 				if (errno != ENOENT) {
@@ -95,7 +96,7 @@  vfio_get_group_fd(int iommu_group_no)
 			/* noiommu group found */
 		}
 
-		cur_grp->group_no = iommu_group_no;
+		cur_grp->group_no = iommu_group_num;
 		cur_grp->fd = vfio_group_fd;
 		vfio_cfg.vfio_active_groups++;
 		return vfio_group_fd;
@@ -117,7 +118,7 @@  vfio_get_group_fd(int iommu_group_no)
 			close(socket_fd);
 			return -1;
 		}
-		if (vfio_mp_sync_send_request(socket_fd, iommu_group_no) < 0) {
+		if (vfio_mp_sync_send_request(socket_fd, iommu_group_num) < 0) {
 			RTE_LOG(ERR, EAL, "  cannot send group number!\n");
 			close(socket_fd);
 			return -1;
@@ -132,7 +133,7 @@  vfio_get_group_fd(int iommu_group_no)
 			/* if we got the fd, store it and return it */
 			if (vfio_group_fd > 0) {
 				close(socket_fd);
-				cur_grp->group_no = iommu_group_no;
+				cur_grp->group_no = iommu_group_num;
 				cur_grp->fd = vfio_group_fd;
 				vfio_cfg.vfio_active_groups++;
 				return vfio_group_fd;
@@ -262,11 +263,11 @@  rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 			.argsz = sizeof(group_status)
 	};
 	int vfio_group_fd;
-	int iommu_group_no;
+	int iommu_group_num;
 	int ret;
 
 	/* get group number */
-	ret = vfio_get_group_no(sysfs_base, dev_addr, &iommu_group_no);
+	ret = rte_vfio_get_group_num(sysfs_base, dev_addr, &iommu_group_num);
 	if (ret == 0) {
 		RTE_LOG(WARNING, EAL, "  %s not managed by VFIO driver, skipping\n",
 			dev_addr);
@@ -278,7 +279,7 @@  rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		return -1;
 
 	/* get the actual group fd */
-	vfio_group_fd = vfio_get_group_fd(iommu_group_no);
+	vfio_group_fd = rte_vfio_get_group_fd(iommu_group_num);
 	if (vfio_group_fd < 0)
 		return -1;
 
@@ -394,11 +395,11 @@  rte_vfio_release_device(const char *sysfs_base, const char *dev_addr,
 			.argsz = sizeof(group_status)
 	};
 	int vfio_group_fd;
-	int iommu_group_no;
+	int iommu_group_num;
 	int ret;
 
 	/* get group number */
-	ret = vfio_get_group_no(sysfs_base, dev_addr, &iommu_group_no);
+	ret = rte_vfio_get_group_num(sysfs_base, dev_addr, &iommu_group_num);
 	if (ret <= 0) {
 		RTE_LOG(WARNING, EAL, "  %s not managed by VFIO driver\n",
 			dev_addr);
@@ -407,9 +408,9 @@  rte_vfio_release_device(const char *sysfs_base, const char *dev_addr,
 	}
 
 	/* get the actual group fd */
-	vfio_group_fd = vfio_get_group_fd(iommu_group_no);
+	vfio_group_fd = rte_vfio_get_group_fd(iommu_group_num);
 	if (vfio_group_fd <= 0) {
-		RTE_LOG(INFO, EAL, "vfio_get_group_fd failed for %s\n",
+		RTE_LOG(INFO, EAL, "rte_vfio_get_group_fd failed for %s\n",
 				   dev_addr);
 		return -1;
 	}
@@ -480,7 +481,7 @@  rte_vfio_enable(const char *modname)
 		return 0;
 	}
 
-	vfio_cfg.vfio_container_fd = vfio_get_container_fd();
+	vfio_cfg.vfio_container_fd = rte_vfio_get_container_fd();
 
 	/* check if we have VFIO driver enabled */
 	if (vfio_cfg.vfio_container_fd != -1) {
@@ -558,7 +559,7 @@  vfio_has_supported_extensions(int vfio_container_fd)
 }
 
 int
-vfio_get_container_fd(void)
+rte_vfio_get_container_fd(void)
 {
 	int ret, vfio_container_fd;
 
@@ -622,8 +623,8 @@  vfio_get_container_fd(void)
 }
 
 int
-vfio_get_group_no(const char *sysfs_base,
-		const char *dev_addr, int *iommu_group_no)
+rte_vfio_get_group_num(const char *sysfs_base,
+		const char *dev_addr, int *iommu_group_num)
 {
 	char linkname[PATH_MAX];
 	char filename[PATH_MAX];
@@ -655,7 +656,7 @@  vfio_get_group_no(const char *sysfs_base,
 	errno = 0;
 	group_tok = tok[ret - 1];
 	end = group_tok;
-	*iommu_group_no = strtol(group_tok, &end, 10);
+	*iommu_group_num = strtol(group_tok, &end, 10);
 	if ((end != group_tok && *end != '\0') || errno != 0) {
 		RTE_LOG(ERR, EAL, "  %s error parsing IOMMU number!\n", dev_addr);
 		return -1;
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxapp/eal/eal_vfio.h
index 8059577..c72b76c 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.h
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h
@@ -79,12 +79,6 @@  struct vfio_iommu_spapr_tce_info {
 #define RTE_VFIO_SPAPR VFIO_SPAPR_TCE_v2_IOMMU
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
-#define RTE_VFIO_NOIOMMU 8
-#else
-#define RTE_VFIO_NOIOMMU VFIO_NOIOMMU_IOMMU
-#endif
-
 #define VFIO_MAX_GROUPS RTE_MAX_VFIO_GROUPS
 
 /*
@@ -133,21 +127,6 @@  vfio_set_iommu_type(int vfio_container_fd);
 int
 vfio_has_supported_extensions(int vfio_container_fd);
 
-/* open container fd or get an existing one */
-int
-vfio_get_container_fd(void);
-
-/* parse IOMMU group number for a device
- * returns 1 on success, -1 for errors, 0 for non-existent group
- */
-int
-vfio_get_group_no(const char *sysfs_base,
-		const char *dev_addr, int *iommu_group_no);
-
-/* open group fd or get an existing one */
-int
-vfio_get_group_fd(int iommu_group_no);
-
 int vfio_mp_sync_setup(void);
 
 #define SOCKET_REQ_CONTAINER 0x100
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
index 7cc3c15..e19b571 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
@@ -267,7 +267,7 @@  vfio_mp_sync_thread(void __rte_unused * arg)
 
 		switch (ret) {
 		case SOCKET_REQ_CONTAINER:
-			fd = vfio_get_container_fd();
+			fd = rte_vfio_get_container_fd();
 			if (fd < 0)
 				vfio_mp_sync_send_request(conn_sock, SOCKET_ERR);
 			else
@@ -283,7 +283,7 @@  vfio_mp_sync_thread(void __rte_unused * arg)
 				continue;
 			}
 
-			fd = vfio_get_group_fd(vfio_data);
+			fd = rte_vfio_get_group_fd(vfio_data);
 
 			if (fd < 0)
 				vfio_mp_sync_send_request(conn_sock, SOCKET_ERR);
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index f331f54..60871cc 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -255,5 +255,8 @@  EXPERIMENTAL {
 	rte_service_set_runstate_mapped_check;
 	rte_service_set_stats_enable;
 	rte_service_start_with_defaults;
+	rte_vfio_get_container_fd;
+	rte_vfio_get_group_fd;
+	rte_vfio_get_group_num;
 
 } DPDK_18.02;