Blame SOURCES/0022-OvmfPkg-QemuRamfbDxe-Do-not-report-DXE-failure-on-Aa.patch

c49882
From b3147a5ce92a149532ef1ec47cdf14082a56654d Mon Sep 17 00:00:00 2001
6009e6
From: Philippe Mathieu-Daude <philmd@redhat.com>
6009e6
Date: Thu, 1 Aug 2019 20:43:48 +0200
6009e6
Subject: OvmfPkg: QemuRamfbDxe: Do not report DXE failure on Aarch64 silent
6009e6
 builds (RH only)
6009e6
94daa4
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
94daa4
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
94daa4
94daa4
- no change
94daa4
3e2dc0
Notes about the RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] ->
3e2dc0
RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] rebase:
3e2dc0
3e2dc0
- no change
3e2dc0
6009e6
Notes about the RHEL-8.1/20190308-89910a39dcfd [edk2-stable201903] ->
6009e6
RHEL-8.2/20190904-37eef91017ad [edk2-stable201908] rebase:
6009e6
6009e6
- We have to carry this downstream-only patch -- committed originally as
6009e6
  aaaedc1e2cfd -- indefinitely.
6009e6
6009e6
- To avoid confusion, remove the tags from the commit message that had
6009e6
  been added by the downstream maintainer scripts, such as: Message-id,
6009e6
  Patchwork-id, O-Subject, Acked-by. These remain available on the
6009e6
  original downstream commit. The Bugzilla line is preserved, as it
6009e6
  doesn't relate to a specific posting, but to the problem.
6009e6
6009e6
Bugzilla: 1714446
6009e6
6009e6
To suppress an error message on the silent build when ramfb is
6009e6
not configured, change QemuRamfbDxe to return EFI_SUCCESS even
6009e6
when it fails.
6009e6
Some memory is wasted (driver stays resident without
6009e6
any good use), but it is mostly harmless, as the memory
6009e6
is released by the OS after ExitBootServices().
6009e6
6009e6
Suggested-by: Laszlo Ersek <lersek@redhat.com>
6009e6
Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
6009e6
(cherry picked from commit aaaedc1e2cfd55ef003fb1b5a37c73a196b26dc7)
6009e6
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
3e2dc0
(cherry picked from commit aa2b66b18a62d652bdbefae7b5732297294306ca)
94daa4
(cherry picked from commit deb3451034326b75fd760aba47a5171493ff055e)
6009e6
---
6009e6
 OvmfPkg/QemuRamfbDxe/QemuRamfb.c      | 14 ++++++++++++++
6009e6
 OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf |  1 +
6009e6
 2 files changed, 15 insertions(+)
6009e6
6009e6
diff --git a/OvmfPkg/QemuRamfbDxe/QemuRamfb.c b/OvmfPkg/QemuRamfbDxe/QemuRamfb.c
6009e6
index 0d49d8bbab..dbf9bcbe16 100644
6009e6
--- a/OvmfPkg/QemuRamfbDxe/QemuRamfb.c
6009e6
+++ b/OvmfPkg/QemuRamfbDxe/QemuRamfb.c
6009e6
@@ -13,6 +13,7 @@
6009e6
 #include <Library/BaseLib.h>
6009e6
 #include <Library/BaseMemoryLib.h>
6009e6
 #include <Library/DebugLib.h>
6009e6
+#include <Library/DebugPrintErrorLevelLib.h>
6009e6
 #include <Library/DevicePathLib.h>
6009e6
 #include <Library/FrameBufferBltLib.h>
6009e6
 #include <Library/MemoryAllocationLib.h>
6009e6
@@ -242,6 +243,19 @@ InitializeQemuRamfb (
6009e6
 
6009e6
   Status = QemuFwCfgFindFile ("etc/ramfb", &mRamfbFwCfgItem, &FwCfgSize);
6009e6
   if (EFI_ERROR (Status)) {
6009e6
+#if defined (MDE_CPU_AARCH64)
6009e6
+    //
6009e6
+    // RHBZ#1714446
6009e6
+    // If no ramfb device was configured, this platform DXE driver should
6009e6
+    // returns EFI_NOT_FOUND, so the DXE Core can unload it. However, even
6009e6
+    // using a silent build, an error message is issued to the guest console.
6009e6
+    // Since this confuse users, return success and stay resident. The wasted
6009e6
+    // guest RAM still gets freed later after ExitBootServices().
6009e6
+    //
6009e6
+    if (GetDebugPrintErrorLevel () == DEBUG_ERROR) {
6009e6
+      return EFI_SUCCESS;
6009e6
+    }
6009e6
+#endif
6009e6
     return EFI_NOT_FOUND;
6009e6
   }
6009e6
   if (FwCfgSize != sizeof (RAMFB_CONFIG)) {
6009e6
diff --git a/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf b/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
6009e6
index e3890b8c20..6ffee5acb2 100644
6009e6
--- a/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
6009e6
+++ b/OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
6009e6
@@ -29,6 +29,7 @@
6009e6
   BaseLib
6009e6
   BaseMemoryLib
6009e6
   DebugLib
6009e6
+  DebugPrintErrorLevelLib
6009e6
   DevicePathLib
6009e6
   FrameBufferBltLib
6009e6
   MemoryAllocationLib
6009e6
-- 
94daa4
2.27.0
6009e6