Re: [PATCHv6 15/30] x86/boot: Port I/O: allow to hook up alternative helpers

From: Dave Hansen
Date: Wed Mar 16 2022 - 18:02:42 EST


On 3/15/22 19:08, Kirill A. Shutemov wrote:
> +++ b/arch/x86/boot/io.h
> @@ -0,0 +1,50 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef BOOT_IO_H
> +#define BOOT_IO_H
> +
> +#include <asm/shared/io.h>
> +
> +#undef inb
> +#undef inw
> +#undef inl
> +#undef outb
> +#undef outw
> +#undef outl
> +
> +struct port_io_ops {
> + u8 (*inb)(u16 port);
> + u16 (*inw)(u16 port);
> + u32 (*inl)(u16 port);
> + void (*outb)(u8 v, u16 port);
> + void (*outw)(u16 v, u16 port);
> + void (*outl)(u32 v, u16 port);
> +};
> +

This is ugly, but I don't have any better ideas considering all the
other review feedback. It's also the boot code, so the ugliness is much
more limited in scope.

Reviewed-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>