ArmVirtPkg/ArmVirtQemu: Add RngDxe driver

Add the RngDxe driver to the build, backed by either RNDR or TRNG, one
of which is expected to be available in most cases:
- RNDR is implemented by the 'max' CPU that QEMU implements in TCG mode
- TRNG is implemented by the KVM hypervisor, which backs QEMU's 'host'
  CPU

Other TCG modes (e.g., the 'cortex-a*' CPUs) implement neither, which
should prevent the RngDxe driver from dispatching entirely, resulting
in the same situation as before.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

Committed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 2bc6a29..7044790 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -156,7 +156,9 @@
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf

 !endif

   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf

-  RngLib|MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf

+  RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf

+  ArmTrngLib|ArmPkg/Library/ArmTrngLib/ArmTrngLib.inf

+  ArmMonitorLib|ArmPkg/Library/ArmMonitorLib/ArmMonitorLib.inf

 

   #

   # Secure Boot dependencies

@@ -266,6 +268,7 @@
 

 [LibraryClasses.ARM]

   ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf

+  RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf

 

 [BuildOptions]

   GCC:RELEASE_*_*_CC_FLAGS  = -DMDEPKG_NDEBUG

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index e40ade2..64aa4e9 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -432,6 +432,7 @@
       BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf

   }

   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf

+  SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf

 

   #

   # Status Code Routing

diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index 80d4200..3890600 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -75,6 +75,7 @@
   INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf

   INF OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.inf

   INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf

+  INF SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf

 

   #

   # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs

diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index 6f1b814..2cf96ac 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -341,6 +341,7 @@
       BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf

   }

   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf

+  SecurityPkg/RandomNumberGenerator/RngDxe/RngDxe.inf

 

   #

   # Status Code Routing