From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yskoh@mellanox.com>
Received: from EUR04-HE1-obe.outbound.protection.outlook.com
 (mail-eopbgr70058.outbound.protection.outlook.com [40.107.7.58])
 by dpdk.org (Postfix) with ESMTP id 78CFA4F90;
 Fri,  3 May 2019 19:50:48 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=NJmhF9xYoxoCbwAksc+mS1qdY+UeugFiYaXKSH4snJk=;
 b=R2AdTOt62Q1+10uPP45UII3OEKVlg7/mSSmdxiaFHJ2wGgFbiUW6LJs9zE/Ps61J7k8qGTUAH7MCGxSLoMzev8CSa5AflTusg4uUhGD3hDf/L0fk0N8cwAIkm5CqUTE5UloMkfMs07kAo62wzeHdLY7oxH99g0KKORml3OOhExs=
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by
 DB3PR0502MB4042.eurprd05.prod.outlook.com (52.134.68.145) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1856.10; Fri, 3 May 2019 17:50:45 +0000
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::e8d5:4aff:902d:6e98]) by DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::e8d5:4aff:902d:6e98%5]) with mapi id 15.20.1856.008; Fri, 3 May 2019
 17:50:45 +0000
From: Yongseok Koh <yskoh@mellanox.com>
To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
CC: "jerinj@marvell.com" <jerinj@marvell.com>, Thomas Monjalon
 <thomas@monjalon.net>, "dev@dpdk.org" <dev@dpdk.org>,
 "bruce.richardson@intel.com" <bruce.richardson@intel.com>,
 "pbhagavatula@marvell.com" <pbhagavatula@marvell.com>, Shahaf Shuler
 <shahafs@mellanox.com>, "Gavin Hu (Arm Technology China)" <Gavin.Hu@arm.com>, 
 "stable@dpdk.org" <stable@dpdk.org>, Luca Boccassi <bluca@debian.org>, nd
 <nd@arm.com>
Thread-Topic: [PATCH v2] build: disable armv8 crypto extension
Thread-Index: AQHVAcE0QrExR6+Ct0Sr/Kunjrx6RqZZkgaAgAAb4oA=
Date: Fri, 3 May 2019 17:50:45 +0000
Message-ID: <20190503175034.GD2510@mtidpdk.mti.labs.mlnx>
References: <20190502015806.41497-1-yskoh@mellanox.com>
 <20190503122813.8938-1-yskoh@mellanox.com>
 <VE1PR08MB514918D7F468D21B2050D50398350@VE1PR08MB5149.eurprd08.prod.outlook.com>
 <VE1PR08MB514991D9EAB7C1DD7D58768298350@VE1PR08MB5149.eurprd08.prod.outlook.com>
In-Reply-To: <VE1PR08MB514991D9EAB7C1DD7D58768298350@VE1PR08MB5149.eurprd08.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: BYAPR03CA0031.namprd03.prod.outlook.com
 (2603:10b6:a02:a8::44) To DB3PR0502MB3980.eurprd05.prod.outlook.com
 (2603:10a6:8:10::27)
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=yskoh@mellanox.com; 
x-ms-exchange-messagesentrepresentingtype: 1
x-originating-ip: [209.116.155.178]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: b0f84ba7-f2ad-45e0-4d39-08d6cfefddee
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);
 SRVR:DB3PR0502MB4042; 
x-ms-traffictypediagnostic: DB3PR0502MB4042:
x-ms-exchange-purlcount: 1
x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr
x-microsoft-antispam-prvs: <DB3PR0502MB40424D45052EE3412D8A5DC9C3350@DB3PR0502MB4042.eurprd05.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-forefront-prvs: 0026334A56
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(39860400002)(136003)(366004)(346002)(376002)(396003)(13464003)(199004)(189003)(8936002)(478600001)(446003)(11346002)(6436002)(476003)(76176011)(6486002)(486006)(229853002)(66476007)(33656002)(6916009)(81156014)(99286004)(8676002)(316002)(5660300002)(81166006)(305945005)(7416002)(45080400002)(14444005)(7736002)(256004)(71200400001)(71190400001)(66066001)(86362001)(1076003)(966005)(14454004)(68736007)(54906003)(66556008)(66946007)(73956011)(64756008)(52116002)(66446008)(53546011)(6116002)(386003)(6506007)(2906002)(3846002)(4326008)(9686003)(102836004)(186003)(6512007)(26005)(25786009)(6306002)(6246003)(53936002);
 DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4042;
 H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; A:1; MX:1; 
received-spf: None (protection.outlook.com: mellanox.com does not designate
 permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: DifnNyeEXB1Pio3dvOtGXStwToiKPW0c9HEZqZ4rTK8WpuAecvJQ0rC+JeX9JUcz9XcAQ5l8NzyG5M/zedOoql6kuR4GUOQY6u/BAS8rtr1Si/ndHf8XKGXROBz46FAaV9pCT4HE3ww8+AStaN678EkwnUNTmTYxUy3oX0idJuNOJThd2zVM0kT9RUYDfeEUTj1/r1WPUU/1MV9nXmzJ8IRKoaTyMjCurs9Hld3v0V4GKrMWXXyetGOfvOnQVo7Bpxf8Dc+NA6YA38OFGlUdSjZ7LiThVbiZJH0N8OwfLSLQK3IXgGpgSEUN388HlVj+xtRd2YWJTCitGN7UtFpDk5JbJSKXPJLgn+B/2oVGD7Ye3sy3npWpk8n5VF9rf0JQB0keJzusHcmO1tGYYzMAxPKqMjm+6wBUcUs8u6wo1FY=
Content-Type: text/plain; charset="us-ascii"
Content-ID: <8360F4B024FFD24C98B2A0CD29E3699B@eurprd05.prod.outlook.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: Mellanox.com
X-MS-Exchange-CrossTenant-Network-Message-Id: b0f84ba7-f2ad-45e0-4d39-08d6cfefddee
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 May 2019 17:50:45.3433 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4042
Subject: Re: [dpdk-dev] [PATCH v2] build: disable armv8 crypto extension
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://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 03 May 2019 17:50:48 -0000

On Fri, May 03, 2019 at 04:10:47PM +0000, Honnappa Nagarahalli wrote:
> >=20
> > Hi Yongseok,
> > 	We need to enable 'CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO'
> > (which would require a documentation change in [1]).
> I enabled this and compiled, the compilation fails. Ideally (as discussed=
 in
> other threads), the PMD code itself does not make use of the crypto
> instructions, so we should be able to compile the PMDs. Crypto functional=
ity
> should not be available only if crypto is not available from the CPU or t=
he
> crypto library is not present. Otherwise, there is no way to use crypto i=
n
> distro package without recompiling. We can take this up separately.=20

Like you mentioned, the failure isn't due to lack of '+crypto' flag but the
external library.

CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO is disabled by default because it needs =
the
external library. In order to enable the config, ARMV8_CRYPTO_LIB_PATH must=
 be
specified. Makefile mandates it.

	ifneq ($(MAKECMDGOALS),clean)
	ifneq ($(MAKECMDGOALS),config)
	ifeq ($(ARMV8_CRYPTO_LIB_PATH),)
	$(error "Please define ARMV8_CRYPTO_LIB_PATH environment variable")
	endif
	endif
	endif

armv8 crypto pmd has nothing to do with '+crypto' cpuflag but the external
library (compiled with '+crypto' flag) has to be linked. Without the extern=
al
library, it is meaningless to compile the armv8 crypto PMD because we don't=
 have
any fallback.

In runtime, in order to guarantee the final binary runs w/o crash, it check=
s
cpuflag of the target host with rte_cpu_get_flag_enabled().

>  I think this change might have an impact on the existing users. Does thi=
s
>  change need to be documented somewhere (at least in the release notes)?

Practically, there would be no impact. Even if user's app makes use of cryp=
to
instructions, the build config of the app should have the flag.

> >=20
> > [1] https://eur03.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2=
Fdoc.dpdk.org%2Fguides-19.02%2Fcryptodevs%2Farmv8.html&amp;data=3D02%7C01%7=
Cyskoh%40mellanox.com%7C4d6fc9819e4e4a5b1ba508d6cfe1e91d%7Ca652971c7d2e4d9b=
a6a4d149256f461b%7C0%7C0%7C636924966530971290&amp;sdata=3Dr3VFKjX44T1g4ORli=
bYCuCpCDQl1BPQyhzfEe%2BGz%2Fy8%3D&amp;reserved=3D0
> >=20
> > > -----Original Message-----
> > > From: Yongseok Koh <yskoh@mellanox.com>
> > > Sent: Friday, May 3, 2019 7:28 AM
> > > To: jerinj@marvell.com; thomas@monjalon.net
> > > Cc: dev@dpdk.org; bruce.richardson@intel.com;
> > > pbhagavatula@marvell.com; shahafs@mellanox.com; Gavin Hu (Arm
> > > Technology China) <Gavin.Hu@arm.com>; Honnappa Nagarahalli
> > > <Honnappa.Nagarahalli@arm.com>; stable@dpdk.org
> > > Subject: [PATCH v2] build: disable armv8 crypto extension
> > >
> > > Per armv8 crypto extension support, make build always enable it by
> > > default as long as compiler supports the feature while meson build
> > > only enables it for 'default' machine of generic armv8 architecture.
> > >
> > > It is known that not all the armv8 platforms have the crypto
> > > extension. For example, Mellanox BlueField has a variant which doesn'=
t
> > > have it. If crypto enabled binary runs on such a platform, rte_eal_in=
it() fails.
> > >
> > > '+crypto' flag currently implies only '+aes' and '+sha2' and enabling
> > > it will generate the crypto instructions only when crypto intrinsics =
are used.
> > > For the devices supporting 8.2 crypto or newer, compiler could
> > > generate such instructions beyond intrinsics or asm code. For example=
,
> > > compiler can generate 3-way exclusive OR instructions if sha3 is
> > > supported. However, it has to be enabled by adding '+sha3' as of toda=
y.
> > >
> > > In DPDK, armv8 cryptodev is the only one which requires the crypto su=
pport.
> > > As it even uses external library of Marvell which is compiled out of
> > > DPDK with crypto support and there's run-time check for required
> > > cpuflags, crypto support can be disabled in DPDK.
> > >
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> > > ---
> > >
> > > v2:
> > > * disable crypto support instead of having a build config
> > >
> > >  config/arm/meson.build        | 2 +-
> > >  mk/machine/armv8a/rte.vars.mk | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/config/arm/meson.build b/config/arm/meson.build index
> > > 7fa6ed3105..abc8cf346c 100644
> > > --- a/config/arm/meson.build
> > > +++ b/config/arm/meson.build
> > > @@ -74,7 +74,7 @@ flags_octeontx2_extra =3D [
> > >  	['RTE_USE_C11_MEM_MODEL', true]]
> > >
> > >  machine_args_generic =3D [
> > > -	['default', ['-march=3Darmv8-a+crc+crypto']],
> > > +	['default', ['-march=3Darmv8-a+crc']],
> > IIRC, this would impact distro packaging as well. Adding Luca.
> >=20
> > >  	['native', ['-march=3Dnative']],
> > >  	['0xd03', ['-mcpu=3Dcortex-a53']],
> > >  	['0xd04', ['-mcpu=3Dcortex-a35']],
> > > diff --git a/mk/machine/armv8a/rte.vars.mk
> > > b/mk/machine/armv8a/rte.vars.mk index 8252efbb7b..5e3ffc3adf 100644
> > > --- a/mk/machine/armv8a/rte.vars.mk
> > > +++ b/mk/machine/armv8a/rte.vars.mk
> > > @@ -28,4 +28,4 @@
> > >  # CPU_LDFLAGS =3D
> > >  # CPU_ASFLAGS =3D
> > >
> > > -MACHINE_CFLAGS +=3D -march=3Darmv8-a+crc+crypto
> > > +MACHINE_CFLAGS +=3D -march=3Darmv8-a+crc
> > > --
> > > 2.11.0
>=20

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id F25D4A0AC5
	for <public@inbox.dpdk.org>; Fri,  3 May 2019 19:50:50 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id C157C1B101;
	Fri,  3 May 2019 19:50:49 +0200 (CEST)
Received: from EUR04-HE1-obe.outbound.protection.outlook.com
 (mail-eopbgr70058.outbound.protection.outlook.com [40.107.7.58])
 by dpdk.org (Postfix) with ESMTP id 78CFA4F90;
 Fri,  3 May 2019 19:50:48 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com;
 s=selector2;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=NJmhF9xYoxoCbwAksc+mS1qdY+UeugFiYaXKSH4snJk=;
 b=R2AdTOt62Q1+10uPP45UII3OEKVlg7/mSSmdxiaFHJ2wGgFbiUW6LJs9zE/Ps61J7k8qGTUAH7MCGxSLoMzev8CSa5AflTusg4uUhGD3hDf/L0fk0N8cwAIkm5CqUTE5UloMkfMs07kAo62wzeHdLY7oxH99g0KKORml3OOhExs=
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by
 DB3PR0502MB4042.eurprd05.prod.outlook.com (52.134.68.145) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.1856.10; Fri, 3 May 2019 17:50:45 +0000
Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::e8d5:4aff:902d:6e98]) by DB3PR0502MB3980.eurprd05.prod.outlook.com
 ([fe80::e8d5:4aff:902d:6e98%5]) with mapi id 15.20.1856.008; Fri, 3 May 2019
 17:50:45 +0000
From: Yongseok Koh <yskoh@mellanox.com>
To: Honnappa Nagarahalli <Honnappa.Nagarahalli@arm.com>
CC: "jerinj@marvell.com" <jerinj@marvell.com>, Thomas Monjalon
 <thomas@monjalon.net>, "dev@dpdk.org" <dev@dpdk.org>,
 "bruce.richardson@intel.com" <bruce.richardson@intel.com>,
 "pbhagavatula@marvell.com" <pbhagavatula@marvell.com>, Shahaf Shuler
 <shahafs@mellanox.com>, "Gavin Hu (Arm Technology China)" <Gavin.Hu@arm.com>, 
 "stable@dpdk.org" <stable@dpdk.org>, Luca Boccassi <bluca@debian.org>, nd
 <nd@arm.com>
Thread-Topic: [PATCH v2] build: disable armv8 crypto extension
Thread-Index: AQHVAcE0QrExR6+Ct0Sr/Kunjrx6RqZZkgaAgAAb4oA=
Date: Fri, 3 May 2019 17:50:45 +0000
Message-ID: <20190503175034.GD2510@mtidpdk.mti.labs.mlnx>
References: <20190502015806.41497-1-yskoh@mellanox.com>
 <20190503122813.8938-1-yskoh@mellanox.com>
 <VE1PR08MB514918D7F468D21B2050D50398350@VE1PR08MB5149.eurprd08.prod.outlook.com>
 <VE1PR08MB514991D9EAB7C1DD7D58768298350@VE1PR08MB5149.eurprd08.prod.outlook.com>
In-Reply-To: <VE1PR08MB514991D9EAB7C1DD7D58768298350@VE1PR08MB5149.eurprd08.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: BYAPR03CA0031.namprd03.prod.outlook.com
 (2603:10b6:a02:a8::44) To DB3PR0502MB3980.eurprd05.prod.outlook.com
 (2603:10a6:8:10::27)
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=yskoh@mellanox.com; 
x-ms-exchange-messagesentrepresentingtype: 1
x-originating-ip: [209.116.155.178]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: b0f84ba7-f2ad-45e0-4d39-08d6cfefddee
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020);
 SRVR:DB3PR0502MB4042; 
x-ms-traffictypediagnostic: DB3PR0502MB4042:
x-ms-exchange-purlcount: 1
x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr
x-microsoft-antispam-prvs: <DB3PR0502MB40424D45052EE3412D8A5DC9C3350@DB3PR0502MB4042.eurprd05.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-forefront-prvs: 0026334A56
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(39860400002)(136003)(366004)(346002)(376002)(396003)(13464003)(199004)(189003)(8936002)(478600001)(446003)(11346002)(6436002)(476003)(76176011)(6486002)(486006)(229853002)(66476007)(33656002)(6916009)(81156014)(99286004)(8676002)(316002)(5660300002)(81166006)(305945005)(7416002)(45080400002)(14444005)(7736002)(256004)(71200400001)(71190400001)(66066001)(86362001)(1076003)(966005)(14454004)(68736007)(54906003)(66556008)(66946007)(73956011)(64756008)(52116002)(66446008)(53546011)(6116002)(386003)(6506007)(2906002)(3846002)(4326008)(9686003)(102836004)(186003)(6512007)(26005)(25786009)(6306002)(6246003)(53936002);
 DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4042;
 H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; A:1; MX:1; 
received-spf: None (protection.outlook.com: mellanox.com does not designate
 permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: DifnNyeEXB1Pio3dvOtGXStwToiKPW0c9HEZqZ4rTK8WpuAecvJQ0rC+JeX9JUcz9XcAQ5l8NzyG5M/zedOoql6kuR4GUOQY6u/BAS8rtr1Si/ndHf8XKGXROBz46FAaV9pCT4HE3ww8+AStaN678EkwnUNTmTYxUy3oX0idJuNOJThd2zVM0kT9RUYDfeEUTj1/r1WPUU/1MV9nXmzJ8IRKoaTyMjCurs9Hld3v0V4GKrMWXXyetGOfvOnQVo7Bpxf8Dc+NA6YA38OFGlUdSjZ7LiThVbiZJH0N8OwfLSLQK3IXgGpgSEUN388HlVj+xtRd2YWJTCitGN7UtFpDk5JbJSKXPJLgn+B/2oVGD7Ye3sy3npWpk8n5VF9rf0JQB0keJzusHcmO1tGYYzMAxPKqMjm+6wBUcUs8u6wo1FY=
Content-Type: text/plain; charset="UTF-8"
Content-ID: <8360F4B024FFD24C98B2A0CD29E3699B@eurprd05.prod.outlook.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: Mellanox.com
X-MS-Exchange-CrossTenant-Network-Message-Id: b0f84ba7-f2ad-45e0-4d39-08d6cfefddee
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 May 2019 17:50:45.3433 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4042
Subject: Re: [dpdk-dev] [PATCH v2] build: disable armv8 crypto extension
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://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190503175045.oJGtsljbo0aiK2Vhxgyv34ugivlS7rFG3MUQztsj8PM@z>

On Fri, May 03, 2019 at 04:10:47PM +0000, Honnappa Nagarahalli wrote:
> >=20
> > Hi Yongseok,
> > 	We need to enable 'CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO'
> > (which would require a documentation change in [1]).
> I enabled this and compiled, the compilation fails. Ideally (as discussed=
 in
> other threads), the PMD code itself does not make use of the crypto
> instructions, so we should be able to compile the PMDs. Crypto functional=
ity
> should not be available only if crypto is not available from the CPU or t=
he
> crypto library is not present. Otherwise, there is no way to use crypto i=
n
> distro package without recompiling. We can take this up separately.=20

Like you mentioned, the failure isn't due to lack of '+crypto' flag but the
external library.

CONFIG_RTE_LIBRTE_PMD_ARMV8_CRYPTO is disabled by default because it needs =
the
external library. In order to enable the config, ARMV8_CRYPTO_LIB_PATH must=
 be
specified. Makefile mandates it.

	ifneq ($(MAKECMDGOALS),clean)
	ifneq ($(MAKECMDGOALS),config)
	ifeq ($(ARMV8_CRYPTO_LIB_PATH),)
	$(error "Please define ARMV8_CRYPTO_LIB_PATH environment variable")
	endif
	endif
	endif

armv8 crypto pmd has nothing to do with '+crypto' cpuflag but the external
library (compiled with '+crypto' flag) has to be linked. Without the extern=
al
library, it is meaningless to compile the armv8 crypto PMD because we don't=
 have
any fallback.

In runtime, in order to guarantee the final binary runs w/o crash, it check=
s
cpuflag of the target host with rte_cpu_get_flag_enabled().

>  I think this change might have an impact on the existing users. Does thi=
s
>  change need to be documented somewhere (at least in the release notes)?

Practically, there would be no impact. Even if user's app makes use of cryp=
to
instructions, the build config of the app should have the flag.

> >=20
> > [1] https://eur03.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2=
Fdoc.dpdk.org%2Fguides-19.02%2Fcryptodevs%2Farmv8.html&amp;data=3D02%7C01%7=
Cyskoh%40mellanox.com%7C4d6fc9819e4e4a5b1ba508d6cfe1e91d%7Ca652971c7d2e4d9b=
a6a4d149256f461b%7C0%7C0%7C636924966530971290&amp;sdata=3Dr3VFKjX44T1g4ORli=
bYCuCpCDQl1BPQyhzfEe%2BGz%2Fy8%3D&amp;reserved=3D0
> >=20
> > > -----Original Message-----
> > > From: Yongseok Koh <yskoh@mellanox.com>
> > > Sent: Friday, May 3, 2019 7:28 AM
> > > To: jerinj@marvell.com; thomas@monjalon.net
> > > Cc: dev@dpdk.org; bruce.richardson@intel.com;
> > > pbhagavatula@marvell.com; shahafs@mellanox.com; Gavin Hu (Arm
> > > Technology China) <Gavin.Hu@arm.com>; Honnappa Nagarahalli
> > > <Honnappa.Nagarahalli@arm.com>; stable@dpdk.org
> > > Subject: [PATCH v2] build: disable armv8 crypto extension
> > >
> > > Per armv8 crypto extension support, make build always enable it by
> > > default as long as compiler supports the feature while meson build
> > > only enables it for 'default' machine of generic armv8 architecture.
> > >
> > > It is known that not all the armv8 platforms have the crypto
> > > extension. For example, Mellanox BlueField has a variant which doesn'=
t
> > > have it. If crypto enabled binary runs on such a platform, rte_eal_in=
it() fails.
> > >
> > > '+crypto' flag currently implies only '+aes' and '+sha2' and enabling
> > > it will generate the crypto instructions only when crypto intrinsics =
are used.
> > > For the devices supporting 8.2 crypto or newer, compiler could
> > > generate such instructions beyond intrinsics or asm code. For example=
,
> > > compiler can generate 3-way exclusive OR instructions if sha3 is
> > > supported. However, it has to be enabled by adding '+sha3' as of toda=
y.
> > >
> > > In DPDK, armv8 cryptodev is the only one which requires the crypto su=
pport.
> > > As it even uses external library of Marvell which is compiled out of
> > > DPDK with crypto support and there's run-time check for required
> > > cpuflags, crypto support can be disabled in DPDK.
> > >
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> > > ---
> > >
> > > v2:
> > > * disable crypto support instead of having a build config
> > >
> > >  config/arm/meson.build        | 2 +-
> > >  mk/machine/armv8a/rte.vars.mk | 2 +-
> > >  2 files changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/config/arm/meson.build b/config/arm/meson.build index
> > > 7fa6ed3105..abc8cf346c 100644
> > > --- a/config/arm/meson.build
> > > +++ b/config/arm/meson.build
> > > @@ -74,7 +74,7 @@ flags_octeontx2_extra =3D [
> > >  	['RTE_USE_C11_MEM_MODEL', true]]
> > >
> > >  machine_args_generic =3D [
> > > -	['default', ['-march=3Darmv8-a+crc+crypto']],
> > > +	['default', ['-march=3Darmv8-a+crc']],
> > IIRC, this would impact distro packaging as well. Adding Luca.
> >=20
> > >  	['native', ['-march=3Dnative']],
> > >  	['0xd03', ['-mcpu=3Dcortex-a53']],
> > >  	['0xd04', ['-mcpu=3Dcortex-a35']],
> > > diff --git a/mk/machine/armv8a/rte.vars.mk
> > > b/mk/machine/armv8a/rte.vars.mk index 8252efbb7b..5e3ffc3adf 100644
> > > --- a/mk/machine/armv8a/rte.vars.mk
> > > +++ b/mk/machine/armv8a/rte.vars.mk
> > > @@ -28,4 +28,4 @@
> > >  # CPU_LDFLAGS =3D
> > >  # CPU_ASFLAGS =3D
> > >
> > > -MACHINE_CFLAGS +=3D -march=3Darmv8-a+crc+crypto
> > > +MACHINE_CFLAGS +=3D -march=3Darmv8-a+crc
> > > --
> > > 2.11.0
>=20