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

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