From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <hemant.agrawal@nxp.com>
Received: from EUR01-DB5-obe.outbound.protection.outlook.com
 (mail-db5eur01on0071.outbound.protection.outlook.com [104.47.2.71])
 by dpdk.org (Postfix) with ESMTP id 145561BB81
 for <dev@dpdk.org>; Wed,  4 Apr 2018 08:47:37 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; 
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version;
 bh=7f8c9haODmuaclqbbkp0kw2XsBCSJPWNF4u1h/EBl1s=;
 b=XLWxfxGp5LjrcXEOkdFUqi69cZNmhFN0yhajm9zzkZ4Oo+tx4dNfGTkCNOSsKHx3Ieqv3gS0jjva+G+iHtkyDY1xcdtCLHfjgJ2BuXdYRaK5B25e02JH2hXS4D0tlsmpvzgLacFCSLOUEItRM4y5NXxZhB7X1z141Vm6oV3BZyU=
Received: from AM2PR04MB0753.eurprd04.prod.outlook.com (10.160.56.141) by
 AM2PR04MB0785.eurprd04.prod.outlook.com (10.160.53.153) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.631.10; Wed, 4 Apr 2018 06:47:36 +0000
Received: from AM2PR04MB0753.eurprd04.prod.outlook.com
 ([fe80::39b9:124d:74b2:5d6]) by AM2PR04MB0753.eurprd04.prod.outlook.com
 ([fe80::39b9:124d:74b2:5d6%6]) with mapi id 15.20.0609.012; Wed, 4 Apr 2018
 06:47:36 +0000
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: "Wang, Xiao W" <xiao.w.wang@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Burakov, Anatoly" <anatoly.burakov@intel.com>, "thomas@monjalon.net"
 <thomas@monjalon.net>
Thread-Topic: [dpdk-dev] [PATCH v4 2/2] eal/vfio: export internal vfio
 functions
Thread-Index: AQHTyzymKxl4OlKfaE2Vx6NT+N7qtKPvKQEAgAECFdA=
Date: Wed, 4 Apr 2018 06:47:36 +0000
Message-ID: <AM2PR04MB0753B0104B0A1E399071048889A40@AM2PR04MB0753.eurprd04.prod.outlook.com>
References: <1522744086-31507-1-git-send-email-hemant.agrawal@nxp.com>
 <1522753815-28718-1-git-send-email-hemant.agrawal@nxp.com>
 <1522753815-28718-2-git-send-email-hemant.agrawal@nxp.com>
 <B7F2E978279D1D49A3034B7786DACF406F85CF1E@SHSMSX101.ccr.corp.intel.com>
In-Reply-To: <B7F2E978279D1D49A3034B7786DACF406F85CF1E@SHSMSX101.ccr.corp.intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=hemant.agrawal@nxp.com; 
x-originating-ip: [14.142.187.166]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; AM2PR04MB0785;
 7:wTujnbpxrpxtZgdWqVfm+sdRh19cK1t/mFeVylz8qpKor7k/D16jecrTYXY81O1NFLBNLG1KAdICPAmaP2+3hF4tb6lLreGizbE3yBJIfZG2VE3aWSdECtcfBMti736rekoy7bVe6qVv1N6Z9hFIlfDEqHEBtqKZdXwptoS449rznSSSx2I3FkQ0k3LyNxFKLwiRhpC0KPkBEvHviZu7TEIDZATGtzSXpgEJs2guol/3E+BYx8NQfdSPMDLOXVOY
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-ht: Tenant
x-ms-office365-filtering-correlation-id: af37e74e-3af6-49dc-e3ae-08d599f7f38a
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
 RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);
 SRVR:AM2PR04MB0785; 
x-ms-traffictypediagnostic: AM2PR04MB0785:
x-microsoft-antispam-prvs: <AM2PR04MB0785761F8E501964AE042BAB89A40@AM2PR04MB0785.eurprd04.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(185117386973197)(275809806118684)(228905959029699); 
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
 RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041310)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(6072148)(201708071742011);
 SRVR:AM2PR04MB0785; BCL:0; PCL:0; RULEID:; SRVR:AM2PR04MB0785; 
x-forefront-prvs: 0632519F33
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(346002)(366004)(396003)(376002)(39380400002)(39860400002)(189003)(199004)(13464003)(6246003)(55016002)(14454004)(53936002)(6436002)(105586002)(7736002)(106356001)(74316002)(5660300001)(9686003)(76176011)(7696005)(54906003)(93886005)(99286004)(6506007)(3280700002)(53546011)(305945005)(55236004)(102836004)(86362001)(66066001)(110136005)(316002)(3660700001)(8676002)(4326008)(33656002)(476003)(11346002)(81166006)(81156014)(5250100002)(6116002)(478600001)(3846002)(229853002)(2900100001)(2906002)(68736007)(8936002)(26005)(186003)(2501003)(97736004)(486006)(446003)(25786009);
 DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0785;
 H:AM2PR04MB0753.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; MX:1; A:1; 
received-spf: None (protection.outlook.com: nxp.com does not designate
 permitted sender hosts)
x-microsoft-antispam-message-info: rzKLkvNePKFk4LfXkeYcdCDlpWfKtBj0+rAJhHkWMJF/8whFwuDvkwnCVLNtFTFa3UoMmH8A+lyWhMw0UBkrCewJWRnYahtufgr8uvs0nBKP2xqqS2SqxA4rxhjEQ0x7qds2KDMWhQUUFXIieInj5n3t9oqRiDzrOhJ5NJScmHuYXBzusYFL258wezw4qA9s62mGwn1RB763FyWAUXeBKs91G5T39IZFTxHcfkZ4H6hbJU/ddcT2Y+a6UAW0EMQ3lZRDMh9/lKs1x/l82b9Sb8wvjybLlojqlDpkqcTsKv5nEOoYqcN7lzZTo7BgJ+M7s53Yplt7MEvM23H+QcHTd8LU/AkXHQ+5GgWGPoeVm2/2mAcQeIYj+hpzAEBrz/8dImRnLyFRiqhTOvBhfyphiIZsEhwL2emROueAg1+KHdo=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: nxp.com
X-MS-Exchange-CrossTenant-Network-Message-Id: af37e74e-3af6-49dc-e3ae-08d599f7f38a
X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2018 06:47:36.3750 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0785
Subject: Re: [dpdk-dev] [PATCH v4 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 <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 04 Apr 2018 06:47:38 -0000

> Hi Hemant,
>=20
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Hemant Agrawal
> > Sent: Tuesday, April 3, 2018 7:10 PM
> > To: dev@dpdk.org
> > Cc: Burakov, Anatoly <anatoly.burakov@intel.com>; thomas@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@nxp.com>
> > Acked-by: Anatoly Burakov <anatoly.burakov@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 +=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_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 =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)
> >  	}
> >
> >  	/* 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)
> >  	}
> >
> >  	/* 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_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 =3D files('fslmc_bus.c',
> >
> >  allow_experimental_apis =3D true
> >
> > -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..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;
> > +}
>=20
> 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 prototy=
pe.
> My previous patch "eal/vfio: add support for multiple container" does thi=
s too.
>=20
[Hemant]  Just saw it. Fixing it.

> BRs,
> Xiao