回复: [edk2-devel] [PATCH v3 16/20] MdePkg/BaseRngLib AARCH64: Remove overzealous ASSERT()

2024-05-23 Thread gaoliming via groups.io
Reviewed-by: Liming Gao 

> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Doug Flick via
> groups.io
> 发送时间: 2024年5月24日 13:45
> 收件人: devel@edk2.groups.io
> 抄送: Michael D Kinney ; Liming Gao
> ; Zhiguang Liu 
> 主题: [edk2-devel] [PATCH v3 16/20] MdePkg/BaseRngLib AARCH64: Remove
> overzealous ASSERT()
> 
> From: Ard Biesheuvel 
> 
> BaseRngLib on AARCH64 will discover whether or not RNDR instructions are
> supported, by inspecting the ISAR0 identification register, and setting
> a global boolean accordingly. This boolean is used in subsequent
> execution to decide whether or not to issue the instruction.
> 
> The same discovery code also ASSERT()s that RNDR instructions are
> implemented, which is unnecessary, and breaks execution on systems that
> incorporate the library but don't implement the instruction (or fail to
> expose it to the exception level that the firmware executes at).
> 
> So drop the ASSERT().
> 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> 
> Committed-by: Ard Biesheuvel 
> Signed-off-by: Doug Flick [MSFT] 
> ---
>  MdePkg/Library/BaseRngLib/AArch64/Rndr.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
> b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
> index d39db62153..3a556a2e3f 100644
> --- a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
> +++ b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
> @@ -50,7 +50,6 @@ BaseRngLibConstructor (
>// MSR. A non-zero value indicates that the processor supports the RNDR
> instruction.
> 
>//
> 
>Isar0 = ArmReadIdIsar0 ();
> 
> -  ASSERT ((Isar0 & RNDR_MASK) != 0);
> 
> 
> 
>mRndrSupported = ((Isar0 & RNDR_MASK) != 0);
> 
> 
> 
> --
> 2.34.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#119243): https://edk2.groups.io/g/devel/message/119243
> Mute This Topic: https://groups.io/mt/106276868/4905953
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaolim...@byosoft.com.cn]
> -=-=-=-=-=-=
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119247): https://edk2.groups.io/g/devel/message/119247
Mute This Topic: https://groups.io/mt/106277273/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 16/20] MdePkg/BaseRngLib AARCH64: Remove overzealous ASSERT()

2024-05-23 Thread Doug Flick via groups.io
From: Ard Biesheuvel 

BaseRngLib on AARCH64 will discover whether or not RNDR instructions are
supported, by inspecting the ISAR0 identification register, and setting
a global boolean accordingly. This boolean is used in subsequent
execution to decide whether or not to issue the instruction.

The same discovery code also ASSERT()s that RNDR instructions are
implemented, which is unnecessary, and breaks execution on systems that
incorporate the library but don't implement the instruction (or fail to
expose it to the exception level that the firmware executes at).

So drop the ASSERT().

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 

Committed-by: Ard Biesheuvel 
Signed-off-by: Doug Flick [MSFT] 
---
 MdePkg/Library/BaseRngLib/AArch64/Rndr.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c 
b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
index d39db62153..3a556a2e3f 100644
--- a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
+++ b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
@@ -50,7 +50,6 @@ BaseRngLibConstructor (
   // MSR. A non-zero value indicates that the processor supports the RNDR 
instruction.
   //
   Isar0 = ArmReadIdIsar0 ();
-  ASSERT ((Isar0 & RNDR_MASK) != 0);
 
   mRndrSupported = ((Isar0 & RNDR_MASK) != 0);
 
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119243): https://edk2.groups.io/g/devel/message/119243
Mute This Topic: https://groups.io/mt/106276868/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v3 16/20] MdePkg/BaseRngLib AARCH64: Remove overzealous ASSERT()

2024-05-23 Thread Doug Flick via groups.io
From: Ard Biesheuvel 

BaseRngLib on AARCH64 will discover whether or not RNDR instructions are
supported, by inspecting the ISAR0 identification register, and setting
a global boolean accordingly. This boolean is used in subsequent
execution to decide whether or not to issue the instruction.

The same discovery code also ASSERT()s that RNDR instructions are
implemented, which is unnecessary, and breaks execution on systems that
incorporate the library but don't implement the instruction (or fail to
expose it to the exception level that the firmware executes at).

So drop the ASSERT().

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 

Committed-by: Ard Biesheuvel 
Signed-off-by: Doug Flick [MSFT] 
---
 MdePkg/Library/BaseRngLib/AArch64/Rndr.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c 
b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
index d39db62153..3a556a2e3f 100644
--- a/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
+++ b/MdePkg/Library/BaseRngLib/AArch64/Rndr.c
@@ -50,7 +50,6 @@ BaseRngLibConstructor (
   // MSR. A non-zero value indicates that the processor supports the RNDR 
instruction.
   //
   Isar0 = ArmReadIdIsar0 ();
-  ASSERT ((Isar0 & RNDR_MASK) != 0);
 
   mRndrSupported = ((Isar0 & RNDR_MASK) != 0);
 
-- 
2.34.1