| Date | Thu, 24 Feb 2022 14:22:36 -0800 | From | Dave Hansen <> | 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@linux.intel.com>
|