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

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