Re: [RFC v2-fix-v2 1/3] x86/tdx: Handle port I/O in decompression code

From: Dan Williams
Date: Tue Jun 08 2021 - 19:13:32 EST


On Tue, Jun 8, 2021 at 8:40 AM Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx> wrote:
>
> Add support to replace in/out instructions in
> decompression code with TDX IO hypercalls.
>
> TDX cannot do port IO directly. The TDX module triggers
> a #VE exception to let the guest kernel to emulate port
> I/O, by converting them into TDX hypercalls to call the
> host.
>
> But for the really early code in the decompressor, #VE
> cannot be used because the IDT needed for handling the
> exception is not set-up, and some other infrastructure
> needed by the handler is missing. So to support port IO
> in decompressor code, directly replace in/out instructions
> with TDX IO hypercalls. This can beeasily achieved by
> modifying __in/__out macros.
>
> Also, since TDX IO hypercall requires an IO size parameter,
> modify __in/__out macros to accept size as input parameter.

Looks good to me:

Reviewed-by: Dan Williams <dan.j.williams@xxxxxxxxx>