Re: [PATCH 3/3] arch/x86: Do not include <asm/bootparam.h> in several header files

From: Ard Biesheuvel
Date: Thu Dec 07 2023 - 10:38:17 EST


On Wed, 6 Dec 2023 at 13:54, Thomas Zimmermann <tzimmermann@xxxxxxx> wrote:
>
> Remove the include statement for <asm/bootparam.h> from several header
> files that don't require it. Limits the exposure of the boot parameters
> within the Linux kernel code.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>

Acked-by: Ard Biesheuvel <ardb@xxxxxxxxxx>

> ---
> arch/x86/include/asm/kexec.h | 1 -
> arch/x86/include/asm/mem_encrypt.h | 2 +-
> arch/x86/include/asm/sev.h | 3 ++-
> arch/x86/include/asm/x86_init.h | 2 --
> 4 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
> index c9f6a6c5de3c..91ca9a9ee3a2 100644
> --- a/arch/x86/include/asm/kexec.h
> +++ b/arch/x86/include/asm/kexec.h
> @@ -25,7 +25,6 @@
>
> #include <asm/page.h>
> #include <asm/ptrace.h>
> -#include <asm/bootparam.h>
>
> struct kimage;
>
> diff --git a/arch/x86/include/asm/mem_encrypt.h b/arch/x86/include/asm/mem_encrypt.h
> index 359ada486fa9..c1a8a3408c18 100644
> --- a/arch/x86/include/asm/mem_encrypt.h
> +++ b/arch/x86/include/asm/mem_encrypt.h
> @@ -15,7 +15,7 @@
> #include <linux/init.h>
> #include <linux/cc_platform.h>
>
> -#include <asm/bootparam.h>
> +struct boot_params;
>
> #ifdef CONFIG_X86_MEM_ENCRYPT
> void __init mem_encrypt_init(void);
> diff --git a/arch/x86/include/asm/sev.h b/arch/x86/include/asm/sev.h
> index 5b4a1ce3d368..8dad8b1613bf 100644
> --- a/arch/x86/include/asm/sev.h
> +++ b/arch/x86/include/asm/sev.h
> @@ -13,7 +13,6 @@
>
> #include <asm/insn.h>
> #include <asm/sev-common.h>
> -#include <asm/bootparam.h>
> #include <asm/coco.h>
>
> #define GHCB_PROTOCOL_MIN 1ULL
> @@ -22,6 +21,8 @@
>
> #define VMGEXIT() { asm volatile("rep; vmmcall\n\r"); }
>
> +struct boot_params;
> +
> enum es_result {
> ES_OK, /* All good */
> ES_UNSUPPORTED, /* Requested operation not supported */
> diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
> index c878616a18b8..f062715578a0 100644
> --- a/arch/x86/include/asm/x86_init.h
> +++ b/arch/x86/include/asm/x86_init.h
> @@ -2,8 +2,6 @@
> #ifndef _ASM_X86_PLATFORM_H
> #define _ASM_X86_PLATFORM_H
>
> -#include <asm/bootparam.h>
> -
> struct ghcb;
> struct mpc_bus;
> struct mpc_cpu;
> --
> 2.43.0
>