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

1d2c45
From 9adcdf493ebbd11efb74e2905ab5f6c8996e096d Mon Sep 17 00:00:00 2001
1d2c45
From: Laszlo Ersek <lersek@redhat.com>
1d2c45
Date: Wed, 24 Jun 2020 11:31:36 +0200
1d2c45
Subject: [PATCH 1/3] OvmfPkg/QemuKernelLoaderFsDxe: suppress error on no
1d2c45
 "-kernel" in silent aa64 build (RH)
1d2c45
MIME-Version: 1.0
1d2c45
Content-Type: text/plain; charset=UTF-8
1d2c45
Content-Transfer-Encoding: 8bit
1d2c45
1d2c45
RH-Author: Laszlo Ersek <lersek@redhat.com>
1d2c45
Message-id: <20200615080105.11859-2-lersek@redhat.com>
1d2c45
Patchwork-id: 97532
1d2c45
O-Subject: [RHEL-8.3.0 edk2 PATCH 1/3] OvmfPkg/QemuKernelLoaderFsDxe: suppress error on no "-kernel" in silent aa64 build (RH)
1d2c45
Bugzilla: 1844682
1d2c45
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
1d2c45
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
1d2c45
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
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>
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
1d2c45
index b09ff6a359..ec0244d61b 100644
1d2c45
--- a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c
1d2c45
+++ b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c
1d2c45
@@ -18,6 +18,7 @@
1d2c45
 #include <Library/BaseLib.h>
1d2c45
 #include <Library/BaseMemoryLib.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>
1d2c45
@@ -1039,6 +1040,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