Blame 0015-OvmfPkg-QemuRamfbDxe-Do-not-report-DXE-failure-on-Aa.patch

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