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 C0FF57803D8 for ; Wed, 8 Nov 2023 15:03:24 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=NQMpkMMwC/lpnhjNJ2UJACwZEwNCDok6rypf9Z8yidg=; 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:Content-Transfer-Encoding; s=20140610; t=1699455803; v=1; b=dhNoYxUVfkLhwJGr+fFqfKtN5/TFBg1mG/AAlJSmed6KSztknFOQcYE2m29X/yc1Vvzc+lMj VtmK9mh1UYuOG/FT3+lkfWjdh/9BmMV/LgUyRFRyO7hcfRFpzuSrm5uuAOkSMqbaS8gYrRtFOvv Oj7gLWUA9tNI246bal3Gpt6g= X-Received: by 127.0.0.2 with SMTP id riI3YY7687511x1Yog1Ifj73; Wed, 08 Nov 2023 07:03:23 -0800 X-Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by mx.groups.io with SMTP id smtpd.web10.15992.1699455802229934814 for ; Wed, 08 Nov 2023 07:03:22 -0800 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 8F3FCCE0A3A for ; Wed, 8 Nov 2023 15:03:18 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2140C433CB for ; Wed, 8 Nov 2023 15:03:16 +0000 (UTC) X-Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-507a5f2193bso1014595e87.1 for ; Wed, 08 Nov 2023 07:03:16 -0800 (PST) X-Gm-Message-State: 9O0Ho3mYyxhvgCAQUjhogWu8x7686176AA= X-Google-Smtp-Source: AGHT+IF4WviZB9dQwSojTLvFszYZ42CLCjvLTbsTxP7mVl8btGVZjFnZ8FrzMzXlhEMU/EQNT82tx1o08ZMMVme9tbU= X-Received: by 2002:a19:6d01:0:b0:501:ba04:f352 with SMTP id i1-20020a196d01000000b00501ba04f352mr2382175lfc.1.1699455794695; Wed, 08 Nov 2023 07:03:14 -0800 (PST) MIME-Version: 1.0 References: <20231102135417.336334-1-pierre.gondois@arm.com> <28adea97-b7ae-4f2e-96bb-a115806966d5@arm.com> In-Reply-To: <28adea97-b7ae-4f2e-96bb-a115806966d5@arm.com> From: "Ard Biesheuvel" Date: Wed, 8 Nov 2023 16:03:03 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v1 0/7] CryptoPkg: Enable Openssl native instruction support for AARCH64 To: Pierre Gondois Cc: "Li, Yi1" , "devel@edk2.groups.io" , "Yao, Jiewen" , "Lu, Xiaoyu1" , "Jiang, Guomin" , 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" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=dhNoYxUV; 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 Hello Pierre, Thanks for working on this. On Wed, 8 Nov 2023 at 15:39, Pierre Gondois wrote: > > Hello Yi, > > 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=3Dfalse, ~1000 iterations when safe=3Dtrue. > > 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_SHA256 > and misses: > - ARMV8_PMULL Why was this omitted? Juno implements the underlying instruction so we should be able to use this code too. > - ARMV8_SHA512 > > [1] CryptoPkg/Library/OpensslLib/openssl/crypto/bn/bn_prime.c:BN_generate= _prime_ex2() > [2] CryptoPkg/Library/OpensslLib/openssl/crypto/arm_arch.h > > | TestName | NoAccel (ns) | NoAccel std | Accel (ns) | = Accel std | Improvement | > |:--------------------|---------------:|--------------:|-------------:|--= ----------:|--------------:| > | mPkcs7EkuTest | 14883462 | 16175 | 14777782 | = 28099 | -0.71005 | > | mAeadAesGcmTest | 137082 | 1937 | 116010 | = 722 | -15.3718 | > | mBlockCipherTest | 7390 | 85 | 7192 | = 189 | -2.6793 | > | mAuthenticodeTest | 71440889 | 3150754 | 64153427 | = 1525259 | -10.2007 | > | mBnTest | 755820 | 55968 | 730951 | = 65075 | -3.29033 | > | mDhTest | 3625850738 | 3194665276 | 2585215827 | = 2394541660 | -28.7004 | > | mEcTest | 24661474 | 187448 | 23480124 | = 174758 | -4.79027 | > | mHkdfTest | 1013338 | 4648 | 903299 | = 7193 | -10.8591 | > | mHmacTest | 250284 | 35322 | 213063 | = 36323 | -14.8715 | > | mImageTimestampTest | 14674681 | 87409 | 11877127 | = 20965 | -19.0638 | > | mOaepTest | 25750532 | 100301 | 18066871 | = 40274 | -29.8388 | > | mPkcs5Test | 174126 | 1537 | 151554 | = 2287 | -12.963 | > | mPkcs7Test | 28141988 | 62781 | 25136968 | = 59675 | -10.6781 | > | mPrngTest | 750055 | 3376 | 451404 | = 4437 | -39.8172 | > | mRsaCertTest | 38935884 | 90999 | 36458419 | = 97471 | -6.36294 | > | mRsaTest | 22441717 | 61863 | 16673925 | = 58522 | -25.7012 | > | mRsaPssTest | 142031418 | 131585 | 98656708 | = 110644 | -30.5388 | > | mHashTest | 22383 | 6507 | 17628 | = 7553 | -21.2438 | > | mX509Test | 53441738 | 90749 | 51609184 | = 184683 | -3.42907 | > > Regards, > Pierre > > On 11/7/23 03:38, Li, Yi1 wrote: > > Hi Pierre, > > > > Could you share what tests you did and the test results? > > > > Regards, > > Yi > > > > -----Original Message----- > > From: Pierre Gondois > > Sent: Thursday, November 2, 2023 9:54 PM > > To: devel@edk2.groups.io > > Cc: Yao, Jiewen ; Li, Yi1 ; Lu,= Xiaoyu1 ; Jiang, Guomin ; Le= if Lindholm ; Ard Biesheuvel ; Sami Mujawar ; Gerd Hoffmann > > Subject: [PATCH v1 0/7] CryptoPkg: Enable Openssl native instruction su= pport for AARCH64 > > > > Various OpensslLib implementations are available in edk2. The OpensslLi= bAccel.inf and OpensslLibFullAccel.inf ones use architecture specific instr= uctions, 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 ad= ded). > > > > Pierre Gondois (7): > > MdePkg/BaseLib: AARCH64: Add ArmReadCntPctReg() > > MdePkg/BaseLib: AARCH64: Add ArmReadIdAA64Isar0Reg() > > MdePkg/BaseRngLib: Prefer ArmReadIdAA64Isar0Reg() over > > ArmReadIdIsar0() > > 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 > > > > 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 | 642 +- > > .../OpensslLib/OpensslLibFullAccel.inf | 691 +- > > .../OpensslLib/OpensslStub/AArch64Cap.c | 107 + > > CryptoPkg/Library/OpensslLib/UefiAsm.conf | 6 + > > CryptoPkg/Library/OpensslLib/configure.py | 5 +- > > CryptoPkg/Readme.md | 14 +- > > MdePkg/Include/Library/BaseLib.h | 86 + > > .../BaseLib/AArch64/ArmReadCntPctReg.S | 30 + > > .../BaseLib/AArch64/ArmReadCntPctReg.asm | 30 + > > .../AArch64/ArmReadIdAA64Isar0Reg.S} | 10 +- > > .../AArch64/ArmReadIdAA64Isar0Reg.asm} | 10 +- > > MdePkg/Library/BaseLib/BaseLib.inf | 6 +- > > MdePkg/Library/BaseRngLib/AArch64/ArmRng.h | 12 - > > MdePkg/Library/BaseRngLib/AArch64/Rndr.c | 14 +- > > MdePkg/Library/BaseRngLib/BaseRngLib.inf | 2 - > > 27 files changed, 25320 insertions(+), 57 deletions(-) create mode 1= 00644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GCC/crypto/aes/aesv8-= armx.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/aes/vpaes-armv8.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/arm64cpuid.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/bn/armv8-mont.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/ec/ecp_nistz256-armv8.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/modes/aes-gcm-armv8_64.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/modes/ghashv8-armx.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/sha/keccak1600-armv8.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/sha/sha1-armv8.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/sha/sha256-armv8.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslGen/AARCH64-GC= C/crypto/sha/sha512-armv8.S > > create mode 100644 CryptoPkg/Library/OpensslLib/OpensslStub/AArch64Ca= p.c > > create mode 100644 MdePkg/Library/BaseLib/AArch64/ArmReadCntPctReg.S > > create mode 100644 MdePkg/Library/BaseLib/AArch64/ArmReadCntPctReg.as= m > > rename MdePkg/Library/{BaseRngLib/AArch64/ArmReadIdIsar0.S =3D> BaseL= ib/AArch64/ArmReadIdAA64Isar0Reg.S} (70%) rename MdePkg/Library/{BaseRngLi= b/AArch64/ArmReadIdIsar0.asm =3D> BaseLib/AArch64/ArmReadIdAA64Isar0Reg.asm= } (72%) > > > > -- > > 2.25.1 > > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110917): https://edk2.groups.io/g/devel/message/110917 Mute This Topic: https://groups.io/mt/102342394/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-