Re: [PATCH 03/20] x86/tdx: Convert port I/O handling to use new TDVMCALL macros

From: Dave Hansen
Date: Fri May 17 2024 - 11:28:41 EST


On 5/17/24 07:19, Kirill A. Shutemov wrote:
> static inline void tdx_io_out(int size, u16 port, u32 value)
> {
> - struct tdx_module_args args = {
> - .r10 = TDX_HYPERCALL_STANDARD,
> - .r11 = hcall_func(EXIT_REASON_IO_INSTRUCTION),
> - .r12 = size,
> - .r13 = 1,
> - .r14 = port,
> - .r15 = value,
> - };
> -
> - __tdx_hypercall(&args);
> + TDVMCALL_0(hcall_func(EXIT_REASON_IO_INSTRUCTION),
> + size, TDX_PORT_WRITE, port, value);
> }

I actually really like the self-documenting nature of the structures. I
don't think it's a win if this is where the lines-of-code savings comes
from.