Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
x86/boot: Allow to hook up alternative port I/O helpers
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. All port I/O operations are routed via 'pio_ops'. By default 'pio_ops' initialized with native port I/O implementations. This is a preparation patch. The next patch will override 'pio_ops' if the kernel booted in the TDX environment. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
- Loading branch information
Showing
12 changed files
with
93 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0 */ | ||
| #ifndef BOOT_IO_H | ||
| #define BOOT_IO_H | ||
|
|
||
| #include <asm/shared/io.h> | ||
|
|
||
| struct port_io_ops { | ||
| unsigned char (*inb)(int port); | ||
| unsigned short (*inw)(int port); | ||
| unsigned int (*inl)(int port); | ||
| void (*outb)(unsigned char v, int port); | ||
| void (*outw)(unsigned short v, int port); | ||
| void (*outl)(unsigned int v, int port); | ||
| }; | ||
|
|
||
| extern struct port_io_ops pio_ops; | ||
|
|
||
| static inline void init_io_ops(void) | ||
| { | ||
| pio_ops = (struct port_io_ops){ | ||
| .inb = inb, | ||
| .inw = inw, | ||
| .inl = inl, | ||
| .outb = outb, | ||
| .outw = outw, | ||
| .outl = outl, | ||
| }; | ||
| } | ||
|
|
||
| #endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters