linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] x86/tdx: Use TDVMCALLs directly for earlyprintk
@ 2026-09-10 22:34 Vishal Verma
  2026-09-10 22:34 ` [PATCH 1/2] x86/tdx: Move port I/O definitions to a shared header Vishal Verma
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Vishal Verma @ 2026-09-10 22:34 UTC (permalink / raw)
  To: x86, Dave Hansen, Kiryl Shutsemau, Rick Edgecombe
  Cc: linux-kernel, linux-coco, kvm, Vishal Verma

Background
==========

TDX guests have early_printk support, but it is through a roundabout way
using a #VE exception as a functional mechanism, which is fragile. The
exception handler has to use TDG.VP.VEINFO.GET to find out what faulted,
and then issue the TDVMCALL. This can be simplified into a TDVMCALL from
the guest that does the I/O directly.

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: early_printk.c already reaches the UART through static calls,
so a TDX guest can simply substitute accessors that issue
TDG.VP.VMCALL<Instruction.IO> directly.

Testing
=======

Measured using a TD guest by counting handle_io() calls and snapshotting
the counter at the last earlyprintk write.

  COM1 #VE count: 63160 (before patch) -> 21 (with patch)

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

This is based on v7.3-rc2.

Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
Vishal Verma (2):
      x86/tdx: Move port I/O definitions to a shared header
      x86/early_printk: Avoid #VE emulation for TDX guest serial output

 arch/x86/include/asm/shared/tdx.h |  4 ++++
 arch/x86/boot/compressed/tdx.c    |  4 ++--
 arch/x86/coco/tdx/tdx.c           |  8 ++-----
 arch/x86/kernel/early_printk.c    | 48 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 56 insertions(+), 8 deletions(-)
---
base-commit: df2908090cda368b01ff43709f51890076c56157
change-id: 20260903-b4-tdx_earlyprintk_tdcalls-40d1b21a8ba2

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


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

end of thread, other threads:[~2026-09-11 20:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2026-09-11  1:17 ` [PATCH 0/2] x86/tdx: Use TDVMCALLs directly for earlyprintk Edgecombe, Rick P

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).