render / rpms / edk2

Forked from rpms/edk2 3 months ago
Clone

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

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