Re: [PATCHv4 15/30] x86/boot: Allow to hook up alternative port I/O helpers

Josh Poimboeuf
2022-02-27T22:02:31Z

On Thu, Feb 24, 2022 at 06:56:15PM +0300, Kirill A. Shutemov wrote:
> Port I/O instructions trigger #VE in the TDX environment. In response to
> the exception, kernel emulates these instructions using hypercalls.
>
> But during early boot, on the decompression stage, it is cumbersome to
> deal with #VE. It is cleaner to go to hypercalls directly, bypassing #VE
> handling.
>
> Add a way to hook up alternative port I/O helpers in the boot stub.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

I think you missed my comment from v3. Repeating it here:

At least from reading the commit message it's not self-evident why #VE
handling would be worse, especially since there's already #VC support in
boot. It would help to give more info about that in the commit message.

The current approach also seems fragile, doesn't it require all future
code to remember to not do i/o directly? How do we make sure that
doesn't happen going forward?

How does it fail if some code accidentally does i/o directly? Or
triggers #VE some other way? Is the error understandable and
actionable?

--
Josh