[lkml]   [2022]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 10/26] x86/tdx: Support TDX guest port I/O at decompression time
On Thu, Jan 13, 2022 at 02:51:54PM +0100, Borislav Petkov wrote:
> On Tue, Dec 14, 2021 at 06:02:48PM +0300, Kirill A. Shutemov wrote:
> > From: Kuppuswamy Sathyanarayanan <>
> >
> > Port IO triggers a #VE exception in TDX guests. During normal runtime,
> > the kernel will handle those exceptions for any port IO.
> >
> > But for the early code in the decompressor, #VE cannot be used because
> > the IDT needed for handling the exception is not set up.
> ... yet.
> Well, we're setting up and IDT twice in
> arch/x86/boot/compressed/idt_64.c
> as early as startup_64 for SEV. And the second stage one
> do_boot_stage2_vc() handles port IO too.
> Can't you hook in your VE handler there too?

We certainly can. But do we want to?

IIUC, SEV has to handle #VC very early to deal with CPUID and covering
port I/O in addition via the exception is a logical step.

We had some back and forth on #VE vs direct hypercalls for port I/O in
decompresser and we settled on direct hypercalls.

Adding all the plumbing for #VE just to deal with port I/O was considered
overkill. And I expect debugging exception infrastructure is harder than
direct hypercalls.

Do you see it differently? Do you want to switch to #VE here?

> > Replace IN/OUT instructions with TDX IO hypercalls by defining helper
> > macros __in/__out and by re-defining them in the decompressor code.
> > Also, since TDX IO hypercall requires an IO size parameter, allow
> > __in/__out macros to accept size as an input parameter.
> Please end function/macro names with parentheses. I think in this
> particular case you wanna say
> "__in*()/__out*() macros"
> When a function is mentioned in the changelog, either the text body or the
> subject line, please use the format 'function_name()'. Omitting the
> brackets after the function name can be ambiguous::
> Subject: subsys/component: Make reservation_count static
> reservation_count is only used in reservation_stats. Make it static.
> The variant with brackets is more precise::
> Subject: subsys/component: Make reservation_count() static
> reservation_count() is only called from reservation_stats(). Make it
> static.

Okay, got it.

Kirill A. Shutemov

 \ /
  Last update: 2022-01-15 02:04    [W:0.089 / U:0.484 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site