Skip to content

feat(migtd): route warn/error/fatal logs to COM1 serial port#838

Draft
MichalTarnacki wants to merge 1 commit into
intel:mainfrom
MichalTarnacki:issue430
Draft

feat(migtd): route warn/error/fatal logs to COM1 serial port#838
MichalTarnacki wants to merge 1 commit into
intel:mainfrom
MichalTarnacki:issue430

Conversation

@MichalTarnacki
Copy link
Copy Markdown
Contributor

MigTD debugging has historically required ad-hoc TDVMCALL.IO writes inserted by hand, because failure paths often did not call any of the log::* macros and there was no guarantee that fatal exits reached the host console.

td-logger is already initialised with LevelFilter::Trace and, with the tdx feature, writes each byte to COM1 (0x3F8) via TDVMCALL.IO, which QEMU forwards through -serial mon:stdio. This change makes that serial path the canonical debugging channel:

  • Add release_max_level_info to the log dependency so release builds compile out debug!/trace! while keeping info!, warn! and error! on the serial line. No VMM changes, no shared buffer and no extra TDVMCALL are required.
  • Emit log::error! from panic_with_guest_crash_reg_report with the error code, message and caller file:line so every fatal exit is visible on the serial port even when the surrounding code forgot to log.

Fixes #430

MigTD debugging has historically required ad-hoc TDVMCALL.IO writes
inserted by hand, because failure paths often did not call any of
the `log::*` macros and there was no guarantee that fatal exits
reached the host console.

td-logger is already initialised with `LevelFilter::Trace` and, with
the `tdx` feature, writes each byte to COM1 (0x3F8) via TDVMCALL.IO,
which QEMU forwards through `-serial mon:stdio`. This change makes
that serial path the canonical debugging channel:

  * Add `release_max_level_info` to the `log` dependency so release
    builds compile out `debug!`/`trace!` while keeping `info!`,
    `warn!` and `error!` on the serial line. No VMM changes, no
    shared buffer and no extra TDVMCALL are required.
  * Emit `log::error!` from `panic_with_guest_crash_reg_report` with
    the error code, message and caller `file:line` so every fatal
    exit is visible on the serial port even when the surrounding
    code forgot to log.

Signed-off-by: Michal Tarnacki <michal.tarnacki@intel.com>
Co-authored-by: GitHub Copilot <noreply@github.com>
@MichalTarnacki MichalTarnacki marked this pull request as draft May 20, 2026 10:34
Comment on lines +30 to +36
log::error!(
"MigTD fatal (code=0x{:x}): {} at {}:{}\n",
errorcode,
panic_message,
file,
line
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MigTD can use serial console to print log messages including warn/errors/fatal

2 participants