[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <10b4cfef-49f8-12db-0ad7-2a6acad00234@intel.com>
Date: Thu, 24 Feb 2022 14:22:36 -0800
From: Dave Hansen <dave.hansen@...el.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
luto@...nel.org, peterz@...radead.org
Cc: sathyanarayanan.kuppuswamy@...ux.intel.com, aarcange@...hat.com,
ak@...ux.intel.com, dan.j.williams@...el.com, david@...hat.com,
hpa@...or.com, jgross@...e.com, jmattson@...gle.com,
joro@...tes.org, jpoimboe@...hat.com, knsathya@...nel.org,
pbonzini@...hat.com, sdeep@...are.com, seanjc@...gle.com,
tony.luck@...el.com, vkuznets@...hat.com, wanpengli@...cent.com,
thomas.lendacky@....com, brijesh.singh@....com, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCHv4 16/30] x86/boot/compressed: Support TDX guest port I/O
at decompression time
On 2/24/22 07:56, Kirill A. Shutemov wrote:
> @@ -24,4 +88,11 @@ void early_tdx_detect(void)
>
> /* Cache TDX guest feature status */
> tdx_guest_detected = true;
> +
> + pio_ops.inb = tdx_inb;
> + pio_ops.inw = tdx_inw;
> + pio_ops.inl = tdx_inl;
> + pio_ops.outb = tdx_outb;
> + pio_ops.outw = tdx_outw;
> + pio_ops.outl = tdx_outl;
> }
I guess the kernel isn't going to get far if any of this goes wrong.
But, I do kinda wish that code ^^ was connected to the below code somehow:
> +static inline void init_io_ops(void)
> +{
> + pio_ops.inb = inb;
> + pio_ops.inw = inw;
> + pio_ops.inl = inl;
> + pio_ops.outb = outb;
> + pio_ops.outw = outw;
> + pio_ops.outl = outl;
> +}
Maybe just a comment would do it. Or, maybe init_io_ops() should just
be called init_default_io_ops(). I think this would do:
/*
* Use the normal I/O instructions by default.
* TDX guests override these to use hypercalls.
*/
if it went in init_io_ops() from the last patch.
>
> +static inline unsigned int tdx_io_in(int size, u16 port)
> +{
> + struct tdx_hypercall_args args = {
> + .r10 = TDX_HYPERCALL_STANDARD,
> + .r11 = EXIT_REASON_IO_INSTRUCTION,
> + .r12 = size,
> + .r13 = 0,
^ munged whitespace?
> + .r14 = port,
> + };
> +
> + if (__tdx_hypercall(&args, TDX_HCALL_HAS_OUTPUT))
> + return UINT_MAX;
> +
> + return args.r11;
> +}
With that fixed:
Acked-by: Dave Hansen <dave.hansen@...ux.intel.com>
Powered by blists - more mailing lists