From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 4DE2AAC116E for ; Tue, 21 Nov 2023 16:22:51 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=8O7JgAgwaDFKK7QxXH+2jwG16ntj2VxpxN/moNoQoxc=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1700583769; v=1; b=viRtSVDAr0tHWZtC+MYXBsowX6z3gUlLdZEL4xoXt1KD5ZutwL2o72qkf9et+38PkWkuOPmV pGfGEGJvb7rVcRxZUNjWCnyXhNppWHHEaRp7oRQQ9UecDECyKVyQGiFPs6QgBn5MBG9dAfRbS2c 0gQiA0ZqbD62sCgIi+wk+vzA= X-Received: by 127.0.0.2 with SMTP id eTOVYY7687511xvZU3496bO4; Tue, 21 Nov 2023 08:22:49 -0800 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.45709.1700583769273215550 for ; Tue, 21 Nov 2023 08:22:49 -0800 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id BFF6161A88 for ; Tue, 21 Nov 2023 16:22:48 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 719DFC433CC for ; Tue, 21 Nov 2023 16:22:48 +0000 (UTC) X-Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2c871890c12so48146691fa.2 for ; Tue, 21 Nov 2023 08:22:48 -0800 (PST) X-Gm-Message-State: gyTxLL0xKoQ3cisuLxKwv8Jdx7686176AA= X-Google-Smtp-Source: AGHT+IFxkxQ34N8V6B5wMnbHp7r5VAJkNtFRe1I8wWZ6O7Up8sRxUAC7NX3x1+YJsOtKrQj3uCGLv+dRNBS1i8jR0sM= X-Received: by 2002:a2e:8005:0:b0:2c8:878e:9d40 with SMTP id j5-20020a2e8005000000b002c8878e9d40mr3312800ljg.13.1700583766628; Tue, 21 Nov 2023 08:22:46 -0800 (PST) MIME-Version: 1.0 References: <20231121084715.1393672-1-pierre.gondois@arm.com> In-Reply-To: <20231121084715.1393672-1-pierre.gondois@arm.com> From: "Ard Biesheuvel" Date: Tue, 21 Nov 2023 11:22:35 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v5 0/6] CryptoPkg: Enable Openssl native instruction support for AARCH64 To: Pierre Gondois Cc: devel@edk2.groups.io, Jiewen Yao , Yi Li , Xiaoyu Lu , Guomin Jiang , Leif Lindholm , Ard Biesheuvel , Sami Mujawar , Gerd Hoffmann Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=viRtSVDA; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On Tue, 21 Nov 2023 at 03:48, Pierre Gondois wrote: > > v5: > - [PATCH v5 1/6] ArmPkg/ArmLib: Add macros/helper functions around AA64Isar0 register > - Remove unused ArmReadIdAA64Isar0() declaration > - [PATCH v4 5/6] CryptoPkg/OpensslLib: Add AArch64Cap for arch specific hooks > - Removed unused GET_BITFIELD() macro > - Indentation > Thanks again for working on this. The series looks good to me, Reviewed-by: Ard Biesheuvel (but the MdePkg <-> ArmPkg discussion needs to conclude before this can go in) > v4: > - Added Acked-by from Gerd > - Created bugzilla at: > https://bugzilla.tianocore.org/show_bug.cgi?id=4601 > - Replaced: > - [PATCH v3 1/6] ArmPkg/ArmLib: Move ArmReadIdAA64Isar0() to ArmLib > by: > - [PATCH v4 1/6] ArmPkg/ArmLib: Add macros/helper functions around AA64Isar0 register > and: > - Moved ARM_ID_AA64ISAR0_EL1_* macros to ArmPkg/Include/Chipset/AArch64.h > - Added macros to get capabilities described in AA64ISAR0 > > v3: > - Use ArmPkg's function to access register: > - Dropped: > - [PATCH v2 1/7] MdePkg/BaseLib: AARCH64: Add ArmReadCntPctReg() > - [PATCH v2 2/7] MdePkg/BaseLib: AARCH64: Add ArmReadIdAA64Isar0Reg() > - [PATCH v2 3/7] MdePkg/BaseRngLib: Prefer ArmReadIdAA64Isar0Reg() over ArmReadIdIsar0() > - Added: > - [PATCH v3 1/6] ArmPkg/ArmLib: Move ArmReadIdAA64Isar0() to ArmLib > - Allow dependency of CryptoPkg over ArmPkg in CI: > - Added: > - [PATCH v3 2/6] CryptoPkg/CryptoPkg.ci.yaml: Allow dependency upon > > v2: > - [PATCH v2 2/7] MdePkg/BaseLib: AARCH64: Add ArmReadIdAA64Isar0Reg() > - Correct bad mask values in MdePkg/Include/Library/BaseLib.h > - [PATCH v2 4/7] CryptoPkg/OpensslLib: Add native instruction support: > - Add armcap.c to configure.py:sources_filter_fn() instead of > manually commenting the file in .inf files > > Various OpensslLib implementations are available in edk2. The > OpensslLibAccel.inf and OpensslLibFullAccel.inf ones use > architecture specific instructions, e.g. AESE, PMULL, SHA256H, ..., > allowing to improve speed. > > Enable support for Aarch64's native instructions: > - Add ArmReadCntPctReg() and ArmReadIdAA64Isar0Reg() to > Aarch64's BaseLib. > - Generate Aarch64's specific Openssl functions. > - Add a OpensslStub/AArch64Cap.c file to allow Openssl > to probe Aarch64 native instruction support. > > This patch-set only enable support for GCC for now (MSFT support > not added). > > ---- Testing ---- > > The tests run are based on the TestBaseCryptLibShell module. > Each test is run 100 times, then the first 5 values > (considered as warmup) are removed. > > The NoAccel column relies on the OpensslLibFull implementation, > the Accel column relies on the OpensslLibFullAccel implementation. > The 'Improvement' column is computed as: > 100 * ('Accel (ns)' - 'NoAccel (ns)') / 'NoAccel (ns)' > > The std deviation of the TestVerifyDhGenerateKey is big. > It is due to [1] being called with the 'safe' parameter set, leading > to the prime number taking more time to generate. It requires ~10 > iterations when safe=false, ~1000 iterations when safe=true. > > The test was run on a Juno-r2. The native Openssl implementation makes > use of the following features (cf. [2]): > - ARMV7_NEON > - ARMV8_AES > - ARMV8_SHA1 > - ARMV8_PMULL > - ARMV8_SHA256 > and misses: > - ARMV8_SHA512 > > | TestName | NoAccel (ns) | NoAccel std | Accel (ns) | Accel std | Improvement | > |:---------------------------------|---------------:|--------------:|-------------:|------------:|--------------:| > | mPkcs7EkuTest | 14757511 | 14370 | 14947276 | 35677 | 1.28589 | > | mAeadAesGcmTest | 129667 | 2012 | 113897 | 1366 | -12.1619 | > | mBlockCipherTest | 7325 | 102 | 6487 | 81 | -11.4403 | > | mAuthenticodeTest | 72852444 | 3097832 | 67593102 | 3123627 | -7.21917 | > | mBnTest | 771921 | 57966 | 737656 | 61354 | -4.43893 | > | mDhTest | 4082083501 | 3340300622 | 3502629757 | 3444890110 | -14.195 | > | mEcTest | 24666075 | 191971 | 23250301 | 178985 | -5.73976 | > | mHkdfTest | 848440 | 4295 | 797966 | 4320 | -5.94904 | > | mHmacTest | 235527 | 36284 | 204823 | 37936 | -13.0363 | > | mImageTimestampTest | 12801070 | 18327 | 12190046 | 23138 | -4.77323 | > | mOaepTest | 20032245 | 46525 | 18671388 | 36399 | -6.79333 | > | mPkcs5Test | 178624 | 1962 | 114852 | 1376 | -35.7018 | > | mPkcs7Test | 28464572 | 70683 | 25282753 | 82616 | -11.1782 | > | mPrngTest | 727013 | 3637 | 460076 | 2668 | -36.717 | > | mRsaCertTest | 39109865 | 90380 | 36452412 | 220712 | -6.79484 | > | mRsaTest | 22451367 | 60643 | 16672060 | 53643 | -25.7414 | > | mRsaPssTest | 142051533 | 122172 | 98638975 | 99131 | -30.5611 | > | mHashTest | 22033 | 6308 | 17650 | 6622 | -19.8929 | > | mX509Test | 53796289 | 123676 | 51280121 | 187588 | -4.67721 | > > Pierre Gondois (6): > ArmPkg/ArmLib: Add macros/helper functions around AA64Isar0 register > CryptoPkg/CryptoPkg.ci.yaml: Allow dependency upon ArmPkg > CryptoPkg/OpensslLib: Add native instruction support for AARCH64 > CryptoPkg/OpensslLib: Generate files for AARCH64 native support > CryptoPkg/OpensslLib: Add AArch64Cap for arch specific hooks > CryptoPkg: Enable Openssl Accel builds for AARCH64 > > ArmPkg/Include/Chipset/AArch64.h | 60 +- > ArmPkg/Include/Library/ArmLib.h | 218 +- > ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 367 + > CryptoPkg/CryptoPkg.ci.yaml | 1 + > CryptoPkg/CryptoPkg.dsc | 23 +- > .../AARCH64-GCC/crypto/aes/aesv8-armx.S | 3180 ++++++++ > .../AARCH64-GCC/crypto/aes/vpaes-armv8.S | 1196 +++ > .../AARCH64-GCC/crypto/arm64cpuid.S | 129 + > .../AARCH64-GCC/crypto/bn/armv8-mont.S | 2124 ++++++ > .../crypto/ec/ecp_nistz256-armv8.S | 4242 +++++++++++ > .../crypto/modes/aes-gcm-armv8_64.S | 6389 +++++++++++++++++ > .../AARCH64-GCC/crypto/modes/ghashv8-armx.S | 552 ++ > .../AARCH64-GCC/crypto/sha/keccak1600-armv8.S | 1009 +++ > .../AARCH64-GCC/crypto/sha/sha1-armv8.S | 1211 ++++ > .../AARCH64-GCC/crypto/sha/sha256-armv8.S | 2051 ++++++ > .../AARCH64-GCC/crypto/sha/sha512-armv8.S | 1606 +++++ > .../Library/OpensslLib/OpensslLibAccel.inf | 647 +- > .../OpensslLib/OpensslLibFullAccel.inf | 696 +- > .../OpensslLib/OpensslStub/AArch64Cap.c | 66 + > CryptoPkg/Library/OpensslLib/UefiAsm.conf | 6 + > CryptoPkg/Library/OpensslLib/configure.py | 6 +- > CryptoPkg/Readme.md | 14 +- > 22 files changed, 25770 insertions(+), 23 deletions(-) > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/aes/aesv8-armx.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/aes/vpaes-armv8.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/arm64cpuid.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/bn/armv8-mont.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/ec/ecp_nistz256-armv8.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/modes/aes-gcm-armv8_64.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/modes/ghashv8-armx.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/sha/keccak1600-armv8.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/sha/sha1-armv8.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/sha/sha256-armv8.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/sha/sha512-armv8.S > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslStub/AArch64Cap.c > > -- > 2.25.1 > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111561): https://edk2.groups.io/g/devel/message/111561 Mute This Topic: https://groups.io/mt/102725176/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-