Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vishal Verma" <vishal.l.verma@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v5 2/2] x86/early_printk: Add earlyprintk=tdx to drive the UART with TDVMCALLs
Date: Mon, 02 Nov 2026 22:59:44 +0000	[thread overview]
Message-ID: <sashiko-outbox-194310@kernel.org> (raw)
In-Reply-To: <20261102-b4-tdx_earlyprintk_tdcalls-v5-2-b01bc95d44ff@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] x86/boot: missing earlyprintk=tdx support in parse_earlyprintk()
--

commit f1945c05c983a94ab54fe2daf5b1ddd281e8d948
Author: Vishal Verma <vishal.l.verma@intel.com>

x86/early_printk: Add earlyprintk=tdx to drive the UART with TDVMCALLs

This patch adds an earlyprintk=tdx option along with tdx_serial_in() and
tdx_serial_out() accessors so that a TDX guest can drive the early serial
console directly with TDVMCALLs rather than triggering #VE exceptions on
port I/O instructions.

> diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
> index cba75306e5b62..04dadcd73b857 100644
> --- a/arch/x86/kernel/early_printk.c
> +++ b/arch/x86/kernel/early_printk.c
[ ... ]
> @@ -414,6 +429,11 @@ static int __init setup_early_printk(char *buf)
>  			early_serial_init(buf + 4);
>  			early_console_register(&early_serial_console, keep);
>  		}
> +		if (!strncmp(buf, "tdx", 3)) {
> +			early_serial_tdx_init();
> +			early_console_register(&early_serial_console, keep);
> +			break;
> +		}

[Severity: Medium]
As reported by Sashiko on v4 [1], when booting with earlyprintk=tdx, this
adds support in setup_early_printk(), but parse_earlyprintk() in the boot
and decompression code only checks for "serial" and "ttyS":

arch/x86/boot/early_serial_console.c:parse_earlyprintk() {
	if (cmdline_find_option("earlyprintk", arg, sizeof(arg)) > 0) {
		char *e;

		if (!strncmp(arg, "serial", 6)) {
			port = DEFAULT_SERIAL_PORT;
			pos += 6;
		}
		...
	}

	if (port)
		early_serial_init(port, baud);
}

In extract_kernel() -> console_init() -> early_serial_console_init() ->
parse_earlyprintk(), early_tdx_detect() has already wired up the port I/O
operations to use TDVMCALLs in a TDX guest. However, because
parse_earlyprintk() does not recognize "tdx", port remains 0 and
early_serial_init() is skipped, leaving early_serial_base unset during
kernel decompression.

Should parse_earlyprintk() in arch/x86/boot/early_serial_console.c also
handle "tdx" so that decompressor serial console output is not lost when
switching from earlyprintk=serial to earlyprintk=tdx?

[1] https://lore.kernel.org/r/20261005-b4-tdx_earlyprintk_tdcalls-v4-2-3f7c56dd568a@intel.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261102-b4-tdx_earlyprintk_tdcalls-v5-0-b01bc95d44ff@intel.com?part=2

      reply	other threads:[~2026-11-02 22:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 22:51 [PATCH v5 0/2] x86/tdx: Use TDVMCALLs directly for earlyprintk Vishal Verma
2026-11-02 22:51 ` [PATCH v5 1/2] x86/tdx: Move port I/O definitions to a shared header Vishal Verma
2026-11-02 22:51 ` [PATCH v5 2/2] x86/early_printk: Add earlyprintk=tdx to drive the UART with TDVMCALLs Vishal Verma
2026-11-02 22:59   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-194310@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox