mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "rdunlap@infradead.org" <rdunlap@infradead.org>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"Hansen, Dave" <dave.hansen@intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"kas@kernel.org" <kas@kernel.org>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"Edgecombe, Rick P" <rick.p.edgecombe@intel.com>,
	"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-coco@lists.linux.dev" <linux-coco@lists.linux.dev>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] x86/early_printk: Add earlyprintk=tdx to drive the UART with TDVMCALLs
Date: Tue, 22 Sep 2026 18:18:23 +0000	[thread overview]
Message-ID: <94ea99fc4ba332a07530ced72284c2193aaedecd.camel@intel.com> (raw)
In-Reply-To: <58df7c2c57f2e00b0322216ec56196781023ce62.camel@intel.com>

On Mon, 2026-09-21 at 20:11 +0000, Verma, Vishal L wrote:
> On Mon, 2026-09-21 at 12:58 -0700, Dave Hansen wrote:
> > On 9/21/26 12:52, Vishal Verma wrote:
> > > +			earlyprintk=tdx[,ttySn[,baudrate]]
> > 
> > Isn't keeping support for ttySn and baudrate kinda silly? It costs a few
> > lines of code at least.
> 
> I kept it because ultimately we call early_serial_init() to set the
> 'serial port' up - mainly select which address we want to use. The baud
> rate parsing tags along because that's just how the helper is set up.
> 
> I think ttySN parsing can still be useful? The guest could be set up
> with multiple serial devices and someone could choose to redirect
> earlyprintk output to say ttyS1, and that would work.

Hi Dave,

As a thought exercise, I changed this to just use ttyS0 which is the
defined default, and that changes the setup hunks to look like below
(not thoroughly tested or anything yet). Would you prefer this instead?

---

@@ -196,6 +215,24 @@ static __init void early_serial_init(char *s)
        early_serial_hw_init(divisor);
 }
 
+#ifdef CONFIG_INTEL_TDX_GUEST
+/*
+ * "earlyprintk=tdx" takes no options. A TDX guest has no firmware tables to
+ * discover a UART from and the VMM presents COM1, so there is nothing for a
+ * port or a baud rate argument to usefully select. Leave early_serial_base at
+ * its default and use the same rate "earlyprintk=serial" would pick.
+ */
+static __init void early_serial_tdx_init(void)
+{
+       if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) {
+               static_call_update(serial_in, tdx_serial_in);
+               static_call_update(serial_out, tdx_serial_out);
+       }
+
+       early_serial_hw_init(BASE_BAUD / DEFAULT_BAUD);
+}
+#endif /* CONFIG_INTEL_TDX_GUEST */
+
 static __noendbr void mem32_serial_out(unsigned long addr, int offset, int value)
 {
        u32 __iomem *vaddr = (u32 __iomem *)addr;
@@ -414,6 +451,13 @@ static int __init setup_early_printk(char *buf)
                        early_serial_init(buf + 4);
                        early_console_register(&early_serial_console, keep);
                }
+#ifdef CONFIG_INTEL_TDX_GUEST
+               if (!strncmp(buf, "tdx", 3)) {
+                       early_serial_tdx_init();
+                       early_console_register(&early_serial_console, keep);
+                       break;
+               }
+#endif
 #ifdef CONFIG_PCI
                if (!strncmp(buf, "pciserial", 9)) {
                        buf += 9; /* Keep from match the above "pciserial" */

  reply	other threads:[~2026-09-22 18:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 19:52 [PATCH v2 0/2] x86/tdx: Use TDVMCALLs directly for earlyprintk Vishal Verma
2026-09-21 19:52 ` [PATCH v2 1/2] x86/tdx: Move port I/O definitions to a shared header Vishal Verma
2026-09-21 19:52 ` [PATCH v2 2/2] x86/early_printk: Add earlyprintk=tdx to drive the UART with TDVMCALLs Vishal Verma
2026-09-21 19:58   ` Dave Hansen
2026-09-21 20:11     ` Verma, Vishal L
2026-09-22 18:18       ` Verma, Vishal L [this message]
2026-09-22 18:24         ` Dave Hansen

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=94ea99fc4ba332a07530ced72284c2193aaedecd.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=corbet@lwn.net \
    --cc=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-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=skhan@linuxfoundation.org \
    --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®