mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] x86/tdx: Use TDVMCALLs directly for earlyprintk
@ 2026-09-21 19:52 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
  0 siblings, 2 replies; 7+ messages in thread
From: Vishal Verma @ 2026-09-21 19:52 UTC (permalink / raw)
  To: x86, Dave Hansen, Kiryl Shutsemau, Rick Edgecombe,
	Jonathan Corbet, Shuah Khan, Randy Dunlap
  Cc: linux-kernel, linux-coco, kvm, linux-doc, Vishal Verma

Background
==========

TDX guests have early_printk support, but it is through a roundabout way
using a #VE exception as a functional mechanism. The exception handler
has to use TDG.VP.VEINFO.GET to find out what faulted, and then issue
the TDVMCALL. Simplify this by using a TDVMCALL from the guest which can
directly perform the port I/O.

Patch details
=============

Patch 1 is a prep patch that moves the port I/O direction constants to
arch/x86/include/asm/shared/tdx.h.

Patch 2: Add a new earlyprintk=tdx option (with sub-options to select
the serial port - same as earlyprintk=serial - tdx[,ttySN[,baud]]).
This calls new tdx_inb() / tdx_outb() helpers, which perform the port
I/O directly using TDVMCALLs.

The serial earlyprintk path is left as is - TD guests using this will
still take a #VE exception, and the exception handler will perform the
I/O.

Testing
=======

Added a counter for the number of COM1 port I/O #VEs handled:

  no earlyprintk     -  ~63000
  earlyprintk=ttyS0  -  ~61000
  earlyprintk=tdx    -  ~35000

The new tdx option nearly halves the number of #VEs handled.

Additionally, ran the usual suite of CI testing, which covers KVM self
tests, KVM unit tests, and Avocado KVM tests without any regressions.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
Changes in v2:
- Rebase to v7.3-rc4
- Move the TDX hypercall helpers into coco/tdx/tdx.c (Kiryl)
- Add a new earlyprintk=tdx option that implements the direct TDVMCALL
  path (Dave Hansen)
- Link to v1: https://patch.msgid.link/20260910-b4-tdx_earlyprintk_tdcalls-v1-0-4b2b1bf9001b@intel.com

---
Vishal Verma (2):
      x86/tdx: Move port I/O definitions to a shared header
      x86/early_printk: Add earlyprintk=tdx to drive the UART with TDVMCALLs

 Documentation/admin-guide/kernel-parameters.txt |  9 +++++
 arch/x86/include/asm/shared/tdx.h               |  6 ++++
 arch/x86/include/asm/tdx.h                      |  3 ++
 arch/x86/boot/compressed/tdx.c                  |  4 +--
 arch/x86/coco/tdx/tdx.c                         | 47 +++++++++++++++++++++----
 arch/x86/kernel/early_printk.c                  | 37 +++++++++++++++++++
 6 files changed, 98 insertions(+), 8 deletions(-)
---
base-commit: 93f51579e7df248780214094418f205253383cc5
change-id: 20260903-b4-tdx_earlyprintk_tdcalls-40d1b21a8ba2

Best regards,
--  
Vishal Verma <vishal.l.verma@intel.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-09-22 18:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2026-09-22 18:24         ` Dave Hansen

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®