From f9cd283aa1102eef6f1f88c875cc06cdffac2115 Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Tue, 13 Jan 2026 07:06:08 -0500 Subject: [PATCH] OvmfPkg/Microvm: add memory debug log support Enable memory-based debug logging support when `DEBUG_TO_MEM` build flag is set. Signed-off-by: Luigi Leonardi --- OvmfPkg/Microvm/MicrovmX64.dsc | 23 +++++++++++++++++++++++ OvmfPkg/Microvm/MicrovmX64.fdf | 3 +++ 2 files changed, 26 insertions(+) diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 884d5a9432..0186456170 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -249,7 +249,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] QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf @@ -257,6 +261,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 @@ -285,6 +292,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 PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf @@ -303,6 +313,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 @@ -348,6 +361,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 @@ -667,6 +683,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 @@ -700,6 +719,7 @@ MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + MemDebugLogLib|OvmfPkg/Library/MemDebugLogLib/MemDebugLogLibNull.inf } MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf @@ -767,6 +787,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/Microvm/MicrovmX64.fdf b/OvmfPkg/Microvm/MicrovmX64.fdf index 3986a8af19..043e793e84 100644 --- a/OvmfPkg/Microvm/MicrovmX64.fdf +++ b/OvmfPkg/Microvm/MicrovmX64.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