Blame SOURCES/0025-OvmfPkg-QemuKernelLoaderFsDxe-suppress-error-on-no-k.patch

c49882
From d9416e3015cadb3214d5ca409e57fd2352ae1961 Mon Sep 17 00:00:00 2001
3e2dc0
From: Laszlo Ersek <lersek@redhat.com>
3e2dc0
Date: Wed, 24 Jun 2020 11:31:36 +0200
94daa4
Subject: OvmfPkg/QemuKernelLoaderFsDxe: suppress error on no "-kernel" in
94daa4
 silent aa64 build (RH)
94daa4
94daa4
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
94daa4
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
94daa4
94daa4
- Remove obsolete commit message tags related to downstream patch
94daa4
  management: Message-id, Patchwork-id, O-Subject, Acked-by, From,
94daa4
  RH-Acked-by, RH-Author (RHBZ#1846481).
3e2dc0
3e2dc0
Bugzilla: 1844682
3e2dc0
3e2dc0
If the "-kernel" QEMU option is not used, then QemuKernelLoaderFsDxe
3e2dc0
should return EFI_NOT_FOUND, so that the DXE Core can unload it. However,
3e2dc0
the associated error message, logged by the DXE Core to the serial
3e2dc0
console, is not desired in the silent edk2-aarch64 build, given that the
3e2dc0
absence of "-kernel" is nothing out of the ordinary. Therefore, return
3e2dc0
success and stay resident. The wasted guest RAM still gets freed after
3e2dc0
ExitBootServices().
3e2dc0
3e2dc0
(Inspired by RHEL-8.1.0 commit aaaedc1e2cfd.)
3e2dc0
3e2dc0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
3e2dc0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
94daa4
(cherry picked from commit 9adcdf493ebbd11efb74e2905ab5f6c8996e096d)
3e2dc0
---
3e2dc0
 .../QemuKernelLoaderFsDxe.c                     | 17 +++++++++++++++++
3e2dc0
 .../QemuKernelLoaderFsDxe.inf                   |  1 +
3e2dc0
 2 files changed, 18 insertions(+)
3e2dc0
3e2dc0
diff --git a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c
c49882
index 6832d563bc..08ed67f5ff 100644
3e2dc0
--- a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c
3e2dc0
+++ b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c
c49882
@@ -19,6 +19,7 @@
3e2dc0
 #include <Library/BaseMemoryLib.h>
c49882
 #include <Library/BlobVerifierLib.h>
3e2dc0
 #include <Library/DebugLib.h>
3e2dc0
+#include <Library/DebugPrintErrorLevelLib.h>
3e2dc0
 #include <Library/DevicePathLib.h>
3e2dc0
 #include <Library/MemoryAllocationLib.h>
3e2dc0
 #include <Library/QemuFwCfgLib.h>
c49882
@@ -1054,6 +1055,22 @@ QemuKernelLoaderFsDxeEntrypoint (
3e2dc0
 
3e2dc0
   if (KernelBlob->Data == NULL) {
3e2dc0
     Status = EFI_NOT_FOUND;
3e2dc0
+#if defined (MDE_CPU_AARCH64)
3e2dc0
+    //
3e2dc0
+    // RHBZ#1844682
3e2dc0
+    //
3e2dc0
+    // If the "-kernel" QEMU option is not being used, this platform DXE driver
3e2dc0
+    // should return EFI_NOT_FOUND, so that the DXE Core can unload it.
3e2dc0
+    // However, the associated error message, logged by the DXE Core to the
3e2dc0
+    // serial console, is not desired in the silent edk2-aarch64 build, given
3e2dc0
+    // that the absence of "-kernel" is nothing out of the ordinary. Therefore,
3e2dc0
+    // return success and stay resident. The wasted guest RAM still gets freed
3e2dc0
+    // after ExitBootServices().
3e2dc0
+    //
3e2dc0
+    if (GetDebugPrintErrorLevel () == DEBUG_ERROR) {
3e2dc0
+      Status = EFI_SUCCESS;
3e2dc0
+    }
3e2dc0
+#endif
3e2dc0
     goto FreeBlobs;
3e2dc0
   }
3e2dc0
 
3e2dc0
diff --git a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
3e2dc0
index 7b35adb8e0..e0331c6e2c 100644
3e2dc0
--- a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
3e2dc0
+++ b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
3e2dc0
@@ -28,6 +28,7 @@
3e2dc0
   BaseLib
3e2dc0
   BaseMemoryLib
3e2dc0
   DebugLib
3e2dc0
+  DebugPrintErrorLevelLib
3e2dc0
   DevicePathLib
3e2dc0
   MemoryAllocationLib
3e2dc0
   QemuFwCfgLib
3e2dc0
-- 
3e2dc0
2.27.0
3e2dc0