[dpdk-dev] [PATCH v4 2/2] eal/vfio: export internal vfio functions

Hemant Agrawal hemant.agrawal at nxp.com
Wed Apr 4 08:47:36 CEST 2018


> Hi Hemant,
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Hemant Agrawal
> > Sent: Tuesday, April 3, 2018 7:10 PM
> > To: dev at dpdk.org
> > Cc: Burakov, Anatoly <anatoly.burakov at intel.com>; thomas at monjalon.net
> > Subject: [dpdk-dev] [PATCH v4 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 at nxp.com>
> > Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
> > ---
> >  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                | 20 +++++++
> >  lib/librte_eal/common/include/rte_vfio.h       | 75
> > +++++++++++++++++++++++++-
> >  lib/librte_eal/linuxapp/eal/eal_vfio.c         | 38 ++++++-------
> >  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, 122 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..ac23db5 100644
> > --- a/lib/librte_eal/bsdapp/eal/eal.c
> > +++ b/lib/librte_eal/bsdapp/eal/eal.c
> > @@ -781,3 +781,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;
> > +}
> 
> No function declarations for the above 3 global API. I guess compile will fail in
> BSD.
> You may include the rte_vfio.h in this file, and remove the dummy prototype.
> My previous patch "eal/vfio: add support for multiple container" does this too.
> 
[Hemant]  Just saw it. Fixing it.

> BRs,
> Xiao



More information about the dev mailing list