mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Vishal Verma <vishal.l.verma@intel.com>,
	x86@kernel.org, Dave Hansen <dave.hansen@linux.intel.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-coco@lists.linux.dev,
	kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] x86/early_printk: Avoid #VE emulation for TDX guest serial output
Date: Fri, 11 Sep 2026 13:25:43 -0700	[thread overview]
Message-ID: <0aee9055-9cfb-4047-8fdf-024964d123d1@intel.com> (raw)
In-Reply-To: <20260910-b4-tdx_earlyprintk_tdcalls-v1-2-4b2b1bf9001b@intel.com>

On 9/10/26 15:34, Vishal Verma wrote:
> +/* Substitute the hypercall accessors, but only in an actual TDX guest */
> +static __init void early_serial_tdx_init(void)
> +{
> +	if (!cpu_feature_enabled(X86_FEATURE_TDX_GUEST))
> +		return;
> +
> +	static_call_update(serial_in, tdx_serial_in);
> +	static_call_update(serial_out, tdx_serial_out);
> +}
> +#else
> +static inline void early_serial_tdx_init(void) { }
> +#endif /* CONFIG_INTEL_TDX_GUEST */
> +
>  static int early_serial_putc(unsigned char ch)
>  {
>  	unsigned timeout = 0xffff;
> @@ -160,6 +204,9 @@ static __init void early_serial_init(char *s)
>  	unsigned long baud = DEFAULT_BAUD;
>  	char *e;
>  
> +	/* Must be before early_serial_hw_init(), which does port I/O */
> +	early_serial_tdx_init();

I really don't like the idea of putting any code in here. How about just
adding a case to setup_early_printk(). Perhaps:

#ifdef CONFIG_TDX_GUEST
	if (!strncmp(buf, "tdx", 3)) {
		early_serial_tdx_init();
		early_serial_init(buf + 3);
		early_console_register(&early_serial_console, keep);
	}
#endif

Then folks can just use earlyprintk=tdx.

  parent reply	other threads:[~2026-09-11 20:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 22:34 [PATCH 0/2] x86/tdx: Use TDVMCALLs directly for earlyprintk Vishal Verma
2026-09-10 22:34 ` [PATCH 1/2] x86/tdx: Move port I/O definitions to a shared header Vishal Verma
2026-09-11 10:40   ` Kiryl Shutsemau
2026-09-10 22:34 ` [PATCH 2/2] x86/early_printk: Avoid #VE emulation for TDX guest serial output Vishal Verma
     [not found]   ` <20260910224829.C1F191F000FF@smtp.kernel.org>
2026-09-10 23:44     ` Verma, Vishal L
2026-09-11 10:49   ` Kiryl Shutsemau
2026-09-11 20:25   ` Dave Hansen [this message]
2026-09-11  1:17 ` [PATCH 0/2] x86/tdx: Use TDVMCALLs directly for earlyprintk Edgecombe, Rick P

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=0aee9055-9cfb-4047-8fdf-024964d123d1@intel.com \
    --to=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=kas@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=vishal.l.verma@intel.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®