From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.10494.1642497852221433464 for ; Tue, 18 Jan 2022 01:24:12 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pierre.gondois@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 07F491FB; Tue, 18 Jan 2022 01:24:11 -0800 (PST) Received: from [192.168.1.10] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 279883F774; Tue, 18 Jan 2022 01:24:08 -0800 (PST) Subject: Re: [edk2-devel] [PATCH v3 0/2] MdePkg,SecurityPkg: Add support to RngDxe and BaseRngLib for AARCH64 RNDR To: devel@edk2.groups.io, Jiewen Yao , Jian J Wang , Michael D Kinney , Liming Gao , Zhiguang Liu , Ard Biesheuvel , Sami Mujawar , Rebecca Cran References: <20210510215308.28745-1-rebecca@nuviainc.com> From: "PierreGondois" Message-ID: Date: Tue, 18 Jan 2022 10:24:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210510215308.28745-1-rebecca@nuviainc.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Hello all, I have a question about the this patch, and more generically the organiza= tion of the MdePkg. The current organization, for the BaseRngLib, is as: =C2=A0- the BaseRngLib implements the library functions of =C2=A0=C2=A0 MdePkg/Include/Library/RngLib.h =C2=A0- the BaseRngLib contains Ia32, X64 and AARCH64 implementations This means the BaseRngLib contains arch specific functions. It comes that= I would like to re-use one of these arch specific functions. My question is then, shouldn't the BaseRngLib contains an arch agnostic implementation, and the arch specific implementation be placed in arch specific folders (ArmPkg for arm, I am not sure for other architectures) ? Another possibility for me is to me is to move the function that I want to use to the ArmPkg, but this means the MdePkg would be dependent on the ArmPkg. Would this be a viable option ? Regards, Pierre On 5/10/21 11:53 PM, Rebecca Cran via groups.io wrote: > Update MdePkg BaseRngLib and SecurityPkg RngDxe to add support for > the AARCH64 RNDR instruction. > > Changes from v2 to v3: > > o Fixed the default value of gEfiSecurityPkgTokenSpaceGuid.PcdCpuRngSup= portedAlgorithm > to be an empty GUID. > o Removed RNDRRS since it wasn't being used. > o Fixed the commit message to remove mention of BaseLib. > > Rebecca Cran (2): > MdePkg/BaseRngLib: Add support for ARMv8.5 RNG instructions > SecurityPkg: Add support for RngDxe on AARCH64 > > MdePkg/MdePkg.dec | 9 +- > SecurityPkg/SecurityPkg.dec | 2 + > MdePkg/MdePkg.dsc | 4 +- > SecurityPkg/SecurityPkg.dsc | 11 +- > MdePkg/Library/BaseRngLib/BaseRngLib.inf | 23 ++= - > SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf | 24 ++= - > MdePkg/Library/BaseRngLib/AArch64/ArmRng.h | 43 ++= +++ > MdePkg/Library/BaseRngLib/BaseRngLibInternals.h | 78 ++= +++++++ > SecurityPkg/RandomNumberGenerator/RngDxe/{ =3D> Rand}/AesCore.h | 0 > SecurityPkg/RandomNumberGenerator/RngDxe/{ =3D> Rand}/RdRand.h | 17 = -- > SecurityPkg/RandomNumberGenerator/RngDxe/RngDxeInternals.h | 117 ++= ++++++++++++ > MdePkg/Library/BaseRngLib/AArch64/Rndr.c | 139 ++= ++++++++++++++ > MdePkg/Library/BaseRngLib/BaseRng.c | 87 ++= +++----- > MdePkg/Library/BaseRngLib/Rand/RdRand.c | 131 ++= +++++++++++++ > SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/RngDxe.c | 127 ++= +++++++++++++ > SecurityPkg/RandomNumberGenerator/RngDxe/{ =3D> Rand}/AesCore.c | 0 > SecurityPkg/RandomNumberGenerator/RngDxe/{ =3D> Rand}/RdRand.c | 45 = +----- > SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDxe.c | 146 ++= +++++++++++++++ > SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.c | 170 ++= ++++++------------ > MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.S | 31 ++= ++ > MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.asm | 30 ++= ++ > MdePkg/Library/BaseRngLib/AArch64/ArmRng.S | 37 ++= +++ > MdePkg/Library/BaseRngLib/AArch64/ArmRng.asm | 39 ++= +++ > MdePkg/Library/BaseRngLib/BaseRngLib.uni | 6 +- > 24 files changed, 1086 insertions(+), 230 deletions(-) > create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmRng.h > create mode 100644 MdePkg/Library/BaseRngLib/BaseRngLibInternals.h > rename SecurityPkg/RandomNumberGenerator/RngDxe/{ =3D> Rand}/AesCore.h= (100%) > rename SecurityPkg/RandomNumberGenerator/RngDxe/{ =3D> Rand}/RdRand.h = (72%) > create mode 100644 SecurityPkg/RandomNumberGenerator/RngDxe/RngDxeInte= rnals.h > create mode 100644 MdePkg/Library/BaseRngLib/AArch64/Rndr.c > create mode 100644 MdePkg/Library/BaseRngLib/Rand/RdRand.c > create mode 100644 SecurityPkg/RandomNumberGenerator/RngDxe/AArch64/Rn= gDxe.c > rename SecurityPkg/RandomNumberGenerator/RngDxe/{ =3D> Rand}/AesCore.c= (100%) > rename SecurityPkg/RandomNumberGenerator/RngDxe/{ =3D> Rand}/RdRand.c = (71%) > create mode 100644 SecurityPkg/RandomNumberGenerator/RngDxe/Rand/RngDx= e.c > create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.S > create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmReadIdIsar0.as= m > create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmRng.S > create mode 100644 MdePkg/Library/BaseRngLib/AArch64/ArmRng.asm >