Re: [PATCHv6 17/30] x86/tdx: Port I/O: add runtime hypercalls

From: Thomas Gleixner
Date: Thu Mar 17 2022 - 08:25:21 EST


On Wed, Mar 16 2022 at 05:08, Kirill A. Shutemov wrote:
> +static bool handle_in(struct pt_regs *regs, int size, int port)
> +{
> + struct tdx_hypercall_args args = {
> + .r10 = TDX_HYPERCALL_STANDARD,
> + .r11 = hcall_func(EXIT_REASON_IO_INSTRUCTION),
> + .r12 = size,
> + .r13 = PORT_READ,
> + .r14 = port,
> + };
> + bool success;
> + u64 mask = GENMASK(BITS_PER_BYTE * size, 0);

Reverse fir tree ordering please:

u64 mask = GENMASK(BITS_PER_BYTE * size, 0);
bool success;

> +/*
> + * Emulate I/O using hypercall.
> + *
> + * Assumes the IO instruction was using ax, which is enforced
> + * by the standard io.h macros.
> + *
> + * Return True on success or False on failure.
> + */
> +static bool handle_io(struct pt_regs *regs, u32 exit_qual)
> +{
> + bool in;
> + int size, port;

Ditto.

Other than that:

Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>