From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <anatoly.burakov@intel.com>
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id 537807D0B
 for <dev@dpdk.org>; Mon,  4 Sep 2017 16:53:43 +0200 (CEST)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by fmsmga105.fm.intel.com with ESMTP; 04 Sep 2017 07:53:42 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.41,475,1498546800"; d="scan'208";a="1168992031"
Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28])
 by orsmga001.jf.intel.com with ESMTP; 04 Sep 2017 07:53:39 -0700
Received: from irsmsx109.ger.corp.intel.com ([169.254.13.28]) by
 irsmsx105.ger.corp.intel.com ([169.254.7.75]) with mapi id 14.03.0319.002;
 Mon, 4 Sep 2017 15:53:39 +0100
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Santosh Shukla <santosh.shukla@caviumnetworks.com>, "dev@dpdk.org"
 <dev@dpdk.org>
CC: "thomas@monjalon.net" <thomas@monjalon.net>,
 "jerin.jacob@caviumnetworks.com" <jerin.jacob@caviumnetworks.com>,
 "hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>, "olivier.matz@6wind.com"
 <olivier.matz@6wind.com>, "maxime.coquelin@redhat.com"
 <maxime.coquelin@redhat.com>, "Gonzalez Monroy, Sergio"
 <sergio.gonzalez.monroy@intel.com>, "Richardson, Bruce"
 <bruce.richardson@intel.com>, "shreyansh.jain@nxp.com"
 <shreyansh.jain@nxp.com>, "gaetan.rivet@6wind.com" <gaetan.rivet@6wind.com>,
 "stephen@networkplumber.org" <stephen@networkplumber.org>,
 "aconole@redhat.com" <aconole@redhat.com>
Thread-Topic: [PATCH v7 2/9] eal/pci: get iommu class
Thread-Index: AQHTIglLvyp8iRdJ1k6mrZXwfC/toqKk1hvQ
Date: Mon, 4 Sep 2017 14:53:38 +0000
Message-ID: <C6ECDF3AB251BE4894318F4E4512369782293973@IRSMSX109.ger.corp.intel.com>
References: <20170814161059.6684-1-santosh.shukla@caviumnetworks.com>
 <20170831032618.7120-1-santosh.shukla@caviumnetworks.com>
 <20170831032618.7120-3-santosh.shukla@caviumnetworks.com>
In-Reply-To: <20170831032618.7120-3-santosh.shukla@caviumnetworks.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ctpclassification: CTP_PUBLIC
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDRiNjU1OTItNTA3Yi00ODQxLWFmMjAtZTI1MWU3OWM0ZjcyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNi41LjkuMyIsIlRydXN0ZWRMYWJlbEhhc2giOiJMMHJ5eXI2elY0NHF5YWwxcWI4NXR3Q0FjV2QybUVydCtzd2crTTk5emNrPSJ9
dlp-product: dlpe-windows
dlp-version: 11.0.0.116
dlp-reaction: no-action
x-originating-ip: [163.33.239.181]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v7 2/9] eal/pci: get iommu class
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://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: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 04 Sep 2017 14:53:43 -0000

> From: Santosh Shukla [mailto:santosh.shukla@caviumnetworks.com]
> Sent: Thursday, August 31, 2017 4:26 AM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; jerin.jacob@caviumnetworks.com;
> hemant.agrawal@nxp.com; olivier.matz@6wind.com;
> maxime.coquelin@redhat.com; Gonzalez Monroy, Sergio
> <sergio.gonzalez.monroy@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; shreyansh.jain@nxp.com;
> gaetan.rivet@6wind.com; Burakov, Anatoly <anatoly.burakov@intel.com>;
> stephen@networkplumber.org; aconole@redhat.com; Santosh Shukla
> <santosh.shukla@caviumnetworks.com>
> Subject: [PATCH v7 2/9] eal/pci: get iommu class
>=20
> Introducing rte_pci_get_iommu_class API which helps to get iommu class of
> PCI device on the bus and returns preferred iova mapping mode for PCI bus=
.
>=20
> Patch also add rte_pci_get_iommu_class definition for bsdapp, in bsdapp
> case - api returns default iova mode.
>=20
> Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
> v6 --> v7:
> - squashed v6 series patch [02/12] & [03/12] (Aaron comment).
>=20
>  lib/librte_eal/bsdapp/eal/eal_pci.c           | 10 ++++++++++
>  lib/librte_eal/bsdapp/eal/rte_eal_version.map |  1 +
>  lib/librte_eal/common/include/rte_bus.h       | 10 ++++++++++
>  lib/librte_eal/common/include/rte_pci.h       | 11 +++++++++++
>  4 files changed, 32 insertions(+)
>=20
> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c
> b/lib/librte_eal/bsdapp/eal/eal_pci.c
> index 04eacdcc7..e2c252320 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
> @@ -403,6 +403,16 @@ rte_pci_scan(void)
>  	return -1;
>  }
>=20
> +/*
> + * Get iommu class of pci devices on the bus.
> + */
> +enum rte_iova_mode
> +rte_pci_get_iommu_class(void)
> +{
> +	/* Supports only RTE_KDRV_NIC_UIO */
> +	return RTE_IOVA_PA;
> +}
> +
>  int
>  pci_update_device(const struct rte_pci_addr *addr)  { diff --git
> a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> index c819e3084..1fdcfb460 100644
> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> @@ -242,5 +242,6 @@ DPDK_17.11 {
>  	global:
>=20
>  	rte_pci_match;
> +	rte_pci_get_iommu_class;
>=20
>  } DPDK_17.08;
> diff --git a/lib/librte_eal/common/include/rte_bus.h
> b/lib/librte_eal/common/include/rte_bus.h
> index c79368d3c..9e40687e5 100644
> --- a/lib/librte_eal/common/include/rte_bus.h
> +++ b/lib/librte_eal/common/include/rte_bus.h
> @@ -55,6 +55,16 @@ extern "C" {
>  /** Double linked list of buses */
>  TAILQ_HEAD(rte_bus_list, rte_bus);
>=20
> +
> +/**
> + * IOVA mapping mode.
> + */
> +enum rte_iova_mode {
> +	RTE_IOVA_DC =3D 0,	/* Don't care mode */
> +	RTE_IOVA_PA =3D (1 << 0),
> +	RTE_IOVA_VA =3D (1 << 1)

Hi Santosh,

No need to set values explicitly, standard C will take care of it.

I wonder the purpose of "don't care" mode. It's not used for anything but c=
ases when no driver is bound. All the libraries (e.g. rte_malloc) will only=
 check for IOVA_VA mode. Can't we just used PA in all cases where IOVA_DC w=
ould be applicable?

Thanks,
Anatoly