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

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