From 61c1174521d20fe34630a73f85b28b4028b9feee Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Tue, 13 Jan 2026 05:28:10 -0500 Subject: [PATCH 1/5] OvmfPkg/AmdSev: add memory debug log support RH-Author: Luigi Leonardi RH-MergeRequest: 104: ArmVirtPkg, AmdSev: fix memory debug logging RH-Jira: RHEL-139470 RH-Acked-by: Gerd Hoffmann RH-Commit: [1/5] 5925e432750361be369cf42d0f1f5d29cdb91d74 (luigileonardi/edk2) Enable memory-based debug logging support when `DEBUG_TO_MEM` build flag is set. Signed-off-by: Luigi Leonardi --- OvmfPkg/AmdSev/AmdSevX64.dsc | 23 +++++++++++++++++++++++ OvmfPkg/AmdSev/AmdSevX64.fdf | 3 +++ 2 files changed, 26 insertions(+) diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc index 717956cfc9c..34715237b4b 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -209,7 +209,11 @@ TdxLib|MdePkg/Library/TdxLib/TdxLib.inf TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLibNull.inf TdxHelperLib|OvmfPkg/IntelTdx/TdxHelperLib/TdxHelperLibNull.inf +!if $(DEBUG_TO_MEM) + MemDebugLogLib|OvmfPkg/Library/MemDebugLogLib/MemDebugLogDxeLib.inf +!else MemDebugLogLib|OvmfPkg/Library/MemDebugLogLib/MemDebugLogLibNull.inf +!endif [LibraryClasses.common.SEC] TimerLib|OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf @@ -218,6 +222,9 @@ DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf +!endif +!if $(DEBUG_TO_MEM) + MemDebugLogLib|OvmfPkg/Library/MemDebugLogLib/MemDebugLogSecLib.inf !endif ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf @@ -246,6 +253,9 @@ DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf +!endif +!if $(DEBUG_TO_MEM) + MemDebugLogLib|OvmfPkg/Library/MemDebugLogLib/MemDebugLogPeiCoreLib.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf CcProbeLib|OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf @@ -263,6 +273,9 @@ DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf +!endif +!if $(DEBUG_TO_MEM) + MemDebugLogLib|OvmfPkg/Library/MemDebugLogLib/MemDebugLogPeiLib.inf !endif PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf ResourcePublicationLib|MdePkg/Library/PeiResourcePublicationLib/PeiResourcePublicationLib.inf @@ -310,6 +323,9 @@ DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf !else DebugLib|OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf +!endif +!if $(DEBUG_TO_MEM) + MemDebugLogLib|OvmfPkg/Library/MemDebugLogLib/MemDebugLogRtLib.inf !endif UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf @@ -567,6 +583,9 @@ # PEI Phase modules # MdeModulePkg/Core/Pei/PeiMain.inf +!if $(DEBUG_TO_MEM) + OvmfPkg/MemDebugLogPei/MemDebugLogPei.inf +!endif MdeModulePkg/Universal/PCD/Pei/Pcd.inf { PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf @@ -603,6 +622,7 @@ MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + MemDebugLogLib|OvmfPkg/Library/MemDebugLogLib/MemDebugLogLibNull.inf } MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf @@ -665,6 +685,9 @@ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf +!if $(DEBUG_TO_MEM) + MemDebugLogLib|OvmfPkg/Library/MemDebugLogLib/MemDebugLogLibNull.inf +!endif } MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf b/OvmfPkg/AmdSev/AmdSevX64.fdf index 069dc40e97e..accbece8d08 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.fdf +++ b/OvmfPkg/AmdSev/AmdSevX64.fdf @@ -96,6 +96,9 @@ APRIORI PEI { # # PEI Phase modules # +!if $(DEBUG_TO_MEM) +INF OvmfPkg/MemDebugLogPei/MemDebugLogPei.inf +!endif INF MdeModulePkg/Core/Pei/PeiMain.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf -- 2.47.3