Commit graph

8 commits

Author SHA1 Message Date
Luigi Leonardi
e59458b658 OvmfPkg/MemDebugLogLib: Add MemDebugLogInit/Copy stubs to Null instance
The Null instance of MemDebugLogLib only provides MemDebugLogWrite(),
MemDebugLogPages(), and MemDebugLogEnabled(). Any module that
references MemDebugLogInit() or MemDebugLogCopy() cannot link against
the Null instance, forcing the feature to be gated at the build-system
level rather than at runtime.

Add no-op stubs for MemDebugLogInit() and MemDebugLogCopy().

This will be used by the following commit to add memory debug log
support in TDX.

Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
2026-07-22 09:00:42 +00:00
Gerd Hoffmann
37857f41c6 OvmfPkg/MemDebugLogPeiCoreLib: enable for PEIMs
Allow PEIMs use the MemDebugLogPeiCoreLib lib.

The difference between MemDebugLogPeiCoreLib and MemDebugLogPeiLib is
that the latter does additionally provide the MemDebugLogPages()
function, and pulls in QemuFwCfg* libraries as dependency.

Most PEIMs do not need MemDebugLogPages() though, only the ones which
handle the setup of the memory logging buffer do.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-01-30 15:17:50 +00:00
Gerd Hoffmann
7916a6ccb7 OvmfPkg/MemDebugLogPeiLib: drop duplicate MemDebugLogWrite function
The MemDebugLogWrite() function is identical in MemDebugLogPei.c and
MemDebugLogPeiCore.c  So drop it from MemDebugLogPei.c and simply add
MemDebugLogPeiCore.c to MemDebugLogPeiLib.inf instead.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-01-30 15:17:50 +00:00
Gerd Hoffmann
4ff51f3780 OvmfPkg/MemDebugLogLib: use AcquireSpinLockOrFail
Drop log lines if we can't get the spin lock.  Not nice, but better than
risking a deadlock.

Some background:  Most of edk2 runs single-threaded on the BSP, so if
something holds the lock it is rather unlikely that waiting is going to
help.  Specifically I think a deadlock can happen if (a) a timer
interrupt arrives while the lock is held, and (b) some higher-TPL timer
handler tries to print something to the debug log.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-12-04 12:36:28 +00:00
Luigi Leonardi
41c48d2a7c OvmfPkg/MemDebugLogLib: move QemuFwCfgSimpleParserLib to LibraryClasses
There is no good reason to keep QemuFwCfgSimpleParserLib arch-specific.
Move it to the LibraryClasses section.

Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
2025-08-28 09:56:09 +00:00
Luigi Leonardi
839e79f62b OvmfPkg/MemDebugLogLib: unoptimize PEIM and PEI_CORE
In AARCH64, the PEI phase runs from the flash memory, therefore global
variables are not allowed.

Remove this optimization so that this library can be used for this
architecture.

Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
2025-08-28 09:56:09 +00:00
Kun Qin
aba8a76a64 OvmfPkg: MemDebugLogLibNull: Support Standalone MM core and drivers
This change extends the supported types to Standalone MM and Standalone
MM Core module types to support potential MM usage.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-19 06:17:18 +00:00
Aaron Young
ba05ea83b7 OvmfPkg: Add OVMF Memory Debug Logging MemDebugLogLib library
Add the Memory Debug Logging feature MemDebugLogLib library
which provides the key MemDebugLogWrite() function.

Several versions (i.e. SEC, PEIM, DXE, runtime) of
the function are included to provide the proper
method to write the debug messages to the memory
debug log buffer.

The library also provides the core functions to maintain
the circular memory debug log buffer.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Aaron Young <aaron.young@oracle.com>
2025-06-13 22:19:39 +00:00