From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 970351C7CF for ; Thu, 5 Apr 2018 11:11:18 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Apr 2018 02:11:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,410,1517904000"; d="scan'208";a="217839571" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga005.fm.intel.com with ESMTP; 05 Apr 2018 02:11:17 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 5 Apr 2018 02:11:17 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 5 Apr 2018 02:11:16 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.88]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.92]) with mapi id 14.03.0319.002; Thu, 5 Apr 2018 17:11:14 +0800 From: "Wang, Xiao W" To: Hemant Agrawal , "dev@dpdk.org" CC: "Burakov, Anatoly" , "thomas@monjalon.net" Thread-Topic: [dpdk-dev] [PATCH v5 2/2] eal/vfio: export internal vfio functions Thread-Index: AQHTy+m1du0aCy0OeUazv5p2S4/2fqPx19iw Date: Thu, 5 Apr 2018 09:03:39 +0000 Message-ID: References: <1522753815-28718-1-git-send-email-hemant.agrawal@nxp.com> <1522828120-16100-1-git-send-email-hemant.agrawal@nxp.com> <1522828120-16100-2-git-send-email-hemant.agrawal@nxp.com> In-Reply-To: <1522828120-16100-2-git-send-email-hemant.agrawal@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzBkN2MzZDctZmYyMS00OTgzLTg1NjAtYTkwNmY1M2JhOWUxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJkT3RKR2lGN3R4MmNRVGE3K0FJQU9BOXhQN2grUWUzTWkrSjFyK3JTTFlnU0hlQU5odFdcL2FaU092RE1IYldyRCJ9 dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v5 2/2] eal/vfio: export internal vfio functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Apr 2018 09:11:19 -0000 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 ; thomas@monjalon.net > Subject: [dpdk-dev] [PATCH v5 2/2] eal/vfio: export internal vfio functio= ns >=20 > This patch moves some of the internal vfio functions from > eal_vfio.h to rte_vfio.h for common uses with "rte_" prefix. >=20 > This patch also change the FSLMC bus usages from the internal > VFIO functions to external ones with "rte_" prefix >=20 > Signed-off-by: Hemant Agrawal > Acked-by: Anatoly Burakov > --- > v5: fix the bsd compilation >=20 > 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(-) >=20 > 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 +=3D $(WERROR_FLAGS) > CFLAGS +=3D -I$(RTE_SDK)/drivers/bus/fslmc > CFLAGS +=3D -I$(RTE_SDK)/drivers/bus/fslmc/mc > CFLAGS +=3D -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include > -CFLAGS +=3D -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal > CFLAGS +=3D -I$(RTE_SDK)/lib/librte_eal/common > LDLIBS +=3D -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring > LDLIBS +=3D -lrte_ethdev > diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfi= o.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) > } >=20 > /* get group number */ > - ret =3D vfio_get_group_no(SYSFS_FSL_MC_DEVICES, g_container, > groupid); > + ret =3D rte_vfio_get_group_num(SYSFS_FSL_MC_DEVICES, > + g_container, groupid); > if (ret <=3D 0) { > DPAA2_BUS_ERR("Unable to find %s IOMMU group", > g_container); > return -1; > @@ -124,7 +125,7 @@ vfio_connect_container(void) > } >=20 > /* Opens main vfio file descriptor which represents the "container" */ > - fd =3D vfio_get_container_fd(); > + fd =3D 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) > } >=20 > /* Get the actual group fd */ > - ret =3D vfio_get_group_fd(groupid); > + ret =3D rte_vfio_get_group_fd(groupid); > if (ret < 0) > return ret; > vfio_group.fd =3D ret; > diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfi= o.h > index e8fb344..9e2c4fe 100644 > --- a/drivers/bus/fslmc/fslmc_vfio.h > +++ b/drivers/bus/fslmc/fslmc_vfio.h > @@ -10,8 +10,6 @@ >=20 > #include >=20 > -#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.buil= d > index e94340e..78f9d92 100644 > --- a/drivers/bus/fslmc/meson.build > +++ b/drivers/bus/fslmc/meson.build > @@ -22,6 +22,5 @@ sources =3D files('fslmc_bus.c', >=20 > allow_experimental_apis =3D true >=20 > -includes +=3D include_directories('../../../lib/librte_eal/linuxapp/eal'= ) > includes +=3D include_directories('mc', 'qbman/include', 'portal') > cflags +=3D ['-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_n= um" cause inconsistency In naming? =20 /* * we don't need to store device fd's anywhere since they can be obtained f= rom * the group fd via an ioctl() call. */ struct vfio_group { int group_no; int fd; int devices; }; BRs, Xiao