2023-05-24 07:27:31 +00:00
|
|
|
From 583e3a67563e3f177a0e61dc41077e7413f100ef Mon Sep 17 00:00:00 2001
|
2021-07-15 17:34:57 +00:00
|
|
|
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
|
Date: Wed, 24 Jun 2020 11:40:09 +0200
|
2023-03-02 12:01:18 +00:00
|
|
|
Subject: [PATCH 13/14] SecurityPkg/Tcg2Dxe: suppress error on no swtpm in
|
2022-03-23 08:15:34 +00:00
|
|
|
silent aa64 build (RH)
|
2021-07-15 17:34:57 +00:00
|
|
|
|
|
|
|
Notes about the RHEL-8.3/20200603-ca407c7246bf [edk2-stable202005] ->
|
|
|
|
RHEL-8.5/20210520-e1999b264f1f [edk2-stable202105] rebase:
|
|
|
|
|
|
|
|
- Remove obsolete commit message tags related to downstream patch
|
|
|
|
management: Message-id, Patchwork-id, O-Subject, Acked-by, From,
|
|
|
|
RH-Acked-by, RH-Author (RHBZ#1846481).
|
|
|
|
|
|
|
|
Bugzilla: 1844682
|
|
|
|
|
|
|
|
If swtpm / vTPM2 is not being used, Tcg2Dxe should return EFI_UNSUPPORTED,
|
|
|
|
so that the DXE Core can unload it. However, the associated error message,
|
|
|
|
logged by the DXE Core to the serial console, is not desired in the silent
|
|
|
|
edk2-aarch64 build, given that the absence of swtpm / vTPM2 is nothing out
|
|
|
|
of the ordinary. Therefore, return success and stay resident. The wasted
|
|
|
|
guest RAM still gets freed after ExitBootServices().
|
|
|
|
|
|
|
|
(Inspired by RHEL-8.1.0 commit aaaedc1e2cfd.)
|
|
|
|
|
|
|
|
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
|
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
|
(cherry picked from commit cbce29f7749477e271f9764fed82de94724af5df)
|
|
|
|
---
|
|
|
|
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf | 1 +
|
2022-03-23 08:15:34 +00:00
|
|
|
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 17 +++++++++++++++++
|
2021-07-15 17:34:57 +00:00
|
|
|
2 files changed, 18 insertions(+)
|
|
|
|
|
2022-03-23 08:15:34 +00:00
|
|
|
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
|
|
|
|
index 7dc7a2683d71..3bc88339311e 100644
|
|
|
|
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
|
|
|
|
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
|
|
|
|
@@ -55,6 +55,7 @@ [LibraryClasses]
|
|
|
|
UefiRuntimeServicesTableLib
|
|
|
|
BaseMemoryLib
|
|
|
|
DebugLib
|
|
|
|
+ DebugPrintErrorLevelLib
|
|
|
|
Tpm2CommandLib
|
|
|
|
PrintLib
|
|
|
|
UefiLib
|
2021-07-15 17:34:57 +00:00
|
|
|
diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
|
2022-03-23 08:15:34 +00:00
|
|
|
index f6ea8b2bbf18..681eb7e08b98 100644
|
2021-07-15 17:34:57 +00:00
|
|
|
--- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
|
|
|
|
+++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
|
|
|
|
@@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
#include <Protocol/ResetNotification.h>
|
|
|
|
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
+#include <Library/DebugPrintErrorLevelLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
|
|
|
#include <Library/UefiDriverEntryPoint.h>
|
2022-03-23 08:15:34 +00:00
|
|
|
@@ -2691,6 +2692,22 @@ DriverEntry (
|
|
|
|
CompareGuid (PcdGetPtr (PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm12Guid))
|
|
|
|
{
|
2021-07-15 17:34:57 +00:00
|
|
|
DEBUG ((DEBUG_INFO, "No TPM2 instance required!\n"));
|
|
|
|
+#if defined (MDE_CPU_AARCH64)
|
|
|
|
+ //
|
|
|
|
+ // RHBZ#1844682
|
|
|
|
+ //
|
|
|
|
+ // If swtpm / vTPM2 is not being used, this driver should return
|
|
|
|
+ // EFI_UNSUPPORTED, so that the DXE Core can unload it. However, the
|
|
|
|
+ // associated error message, logged by the DXE Core to the serial console,
|
|
|
|
+ // is not desired in the silent edk2-aarch64 build, given that the absence
|
|
|
|
+ // of swtpm / vTPM2 is nothing out of the ordinary. Therefore, return
|
|
|
|
+ // success and stay resident. The wasted guest RAM still gets freed after
|
|
|
|
+ // ExitBootServices().
|
|
|
|
+ //
|
|
|
|
+ if (GetDebugPrintErrorLevel () == DEBUG_ERROR) {
|
|
|
|
+ return EFI_SUCCESS;
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
return EFI_UNSUPPORTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
2023-05-24 07:27:31 +00:00
|
|
|
2.40.1
|
2021-07-15 17:34:57 +00:00
|
|
|
|