arch/x86: Remove unnecessary dependencies on bootparam.h
Subsystems (7)
v4 cover arch/x86: Remove unnecessary dependencies on bootparam.h
Reduce built time in some cases by removing unnecessary include statements for <asm/bootparam.h>. Reorganize some header files accordingly.
While working on the kernel's boot-up graphics, I noticed that touching include/linux/screen_info.h triggers a complete rebuild of the kernel on x86. It turns out that the architecture's PCI and EFI headers include <asm/bootparam.h>, which depends on <linux/screen_info.h>. But none of the drivers have any business with boot parameters or the screen_info state.
The patchset moves code from bootparam.h and efi.h into separate header files and removes obsolete include statements on x86. I did
make allmodconfig
make -j28
touch include/linux/screen_info.h
time make -j28
to measure the time it takes to rebuild. Results without the patchset are around 20 minutes.
real 20m46,705s user 354m29,166s sys 28m27,359s
And with the patchset applied it goes down to less than one minute.
real 0m56,643s user 4m0,661s sys 0m32,956s
The test system is an Intel i5-13500.
v4:
* fix fwd declaration in compressed/misc.h (Ard)
v3:
* keep setup_header in bootparam.h (Ard)
* implement arch_ima_efi_boot_mode() in source file (Ard)
v2:
* only keep struct boot_params in bootparam.h (Ard)
* simplify arch_ima_efi_boot_mode define (Ard)
* updated cover letter
Thomas Zimmermann (4):
arch/x86: Move UAPI setup structures into setup_data.h arch/x86: Move internal setup_data structures into setup_data.h arch/x86: Implement arch_ima_efi_boot_mode() in source file arch/x86: Do not include <asm/bootparam.h> in several files
arch/x86/boot/compressed/acpi.c | 2 + arch/x86/boot/compressed/cmdline.c | 2 + arch/x86/boot/compressed/efi.c | 2 + arch/x86/boot/compressed/efi.h | 9 --- arch/x86/boot/compressed/misc.h | 3 +- arch/x86/boot/compressed/pgtable_64.c | 1 + arch/x86/boot/compressed/sev.c | 1 + arch/x86/include/asm/efi.h | 14 +---- arch/x86/include/asm/kexec.h | 1 - arch/x86/include/asm/mem_encrypt.h | 2 +- arch/x86/include/asm/pci.h | 13 ---- arch/x86/include/asm/setup_data.h | 32 ++++++++++ arch/x86/include/asm/sev.h | 3 +- arch/x86/include/asm/x86_init.h | 2 - arch/x86/include/uapi/asm/bootparam.h | 72 +--------------------- arch/x86/include/uapi/asm/setup_data.h | 83 ++++++++++++++++++++++++++ arch/x86/kernel/crash.c | 1 + arch/x86/kernel/sev-shared.c | 2 + arch/x86/platform/efi/efi.c | 5 ++ arch/x86/platform/pvh/enlighten.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + arch/x86/xen/vga.c | 1 - 22 files changed, 142 insertions(+), 111 deletions(-) create mode 100644 arch/x86/include/asm/setup_data.h create mode 100644 arch/x86/include/uapi/asm/setup_data.h
Signature · 1 line
2.43.0
PATCH v4 1/4 arch/x86: Move UAPI setup structures into setup_data.h
The type definition of struct pci_setup_rom in <asm/pci.h> requires struct setup_data from <asm/bootparam.h>. Many drivers include <linux/pci.h>, but do not use boot parameters. Changes to bootparam.h or its included header files could easily trigger a large, unnecessary rebuild of the kernel.
Moving struct setup_data and related code into its own header file avoids including <asm/bootparam.h> in <asm/pci.h>. Instead include the new header <asm/screen_data.h> and remove the include statement for x86_init.h, which is unnecessary but pulls in bootparams.h.
---
v3:
* keep setup_header and friends in bootparam.h (Ard)
--- arch/x86/include/asm/pci.h | 2 +- arch/x86/include/uapi/asm/bootparam.h | 72 +--------------------- arch/x86/include/uapi/asm/setup_data.h | 83 ++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 72 deletions(-) create mode 100644 arch/x86/include/uapi/asm/setup_data.h
arch/x86/include/asm/pci.h +1 -1
@@ -10,7 +10,7 @@#include <linux/numa.h> #include <asm/io.h> #include <asm/memtype.h> -#include <asm/x86_init.h> +#include <asm/setup_data.h> struct pci_sysdata {int domain;/* PCI domain */
arch/x86/include/uapi/asm/bootparam.h +1 -71
95 lines not on this page · raw message
arch/x86/include/uapi/asm/setup_data.h new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v4 2/4 arch/x86: Move internal setup_data structures into setup_data.h
In reply to Thomas ZimmermannThe type definition of struct pci_setup_rom in <asm/pci.h> requires struct setup_data from <asm/bootparam.h>. Many drivers include <linux/pci.h>, but do not use boot parameters. Changes to bootparam.h or its included header files could easily trigger a large, unnecessary rebuild of the kernel.
Moving struct pci_setup_rom into its own header file avoids including <asm/bootparam.h> in <asm/pci.h>. Moving struct_efi_setup_data allows to unify duplicated definition of the data structure in a single place.
--- arch/x86/boot/compressed/efi.h | 9 --------- arch/x86/include/asm/efi.h | 9 --------- arch/x86/include/asm/pci.h | 13 ------------- arch/x86/include/asm/setup_data.h | 32 +++++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 31 deletions(-) create mode 100644 arch/x86/include/asm/setup_data.h
arch/x86/boot/compressed/efi.h +0 -9
@@ -97,15 +97,6 @@ typedef struct {u32 tables; } efi_system_table_32_t; -/* kexec external ABI */ -struct efi_setup_data { -u64 fw_vendor; -u64 __unused; -u64 tables; -u64 smbios; -u64 reserved[8 ]; -}; -struct efi_unaccepted_memory {u32 version;u32 unit_size;
arch/x86/include/asm/efi.h +0 -9
@@ -143,15 +143,6 @@ extern void efi_free_boot_services(void);void arch_efi_call_virt_setup (void );void arch_efi_call_virt_teardown (void ); -/* kexec external ABI */ -struct efi_setup_data { -u64 fw_vendor; -u64 __unused; -u64 tables; -u64 smbios; -u64 reserved[8 ]; -}; -extern u64 efi_setup;#ifdef CONFIG_EFI
arch/x86/include/asm/pci.h +0 -13
@@ -10,7 +10,6 @@#include <linux/numa.h> #include <asm/io.h> #include <asm/memtype.h> -#include <asm/setup_data.h> struct pci_sysdata {int domain;/* PCI domain */
@@ -124,16 +123,4 @@ cpumask_of_pcibus(const struct pci_bus *bus) }#endif -struct pci_setup_rom { -struct setup_data data; -uint16_t vendor; -uint16_t devid; -uint64_t pcilen; -unsigned long segment; -unsigned long bus; -unsigned long device; -unsigned long function; -uint8_t romdata[]; -}; -#endif /* _ASM_X86_PCI_H */
arch/x86/include/asm/setup_data.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_X86_SETUP_DATA_H +#define _ASM_X86_SETUP_DATA_H + +#include <uapi/asm/setup_data.h> + +#ifndef __ASSEMBLY__ + +struct pci_setup_rom { +struct setup_data data; +uint16_t vendor; +uint16_t devid; +uint64_t pcilen; +unsigned long segment; +unsigned long bus; +unsigned long device; +unsigned long function; +uint8_t romdata[]; +}; + +/* kexec external ABI */ +struct efi_setup_data { +u64 fw_vendor; +u64 __unused; +u64 tables; +u64 smbios; +u64 reserved[8 ]; +}; + +#endif /* __ASSEMBLY__ */ + +#endif /* _ASM_X86_SETUP_DATA_H */
Signature · 1 line
2.43.0
kernel test robot
build botRe: [PATCH v4 2/4] arch/x86: Move internal setup_data structures into setup_data.h
kernel test robot noticed the following build warnings:
Hi Thomas,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/x86/core]
[also build test WARNING on efi/next tip/master tip/auto-latest linus/master v6.7 next-20240108] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/arch-x86-Move-UAPI-setup-structures-into-setup_data-h/20240108-180158 base: tip/x86/core patch link: https://lore.kernel.org/r/20240108095903.8427-3-tzimmermann%40suse.de patch subject: [PATCH v4 2/4] arch/x86: Move internal setup_data structures into setup_data.h config: x86_64-rhel-8.3-bpf (https://download.01.org/0day-ci/archive/20240109/[email protected]/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240109/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from arch/x86/realmode/rm/wakemain.c:3:
In file included from arch/x86/boot/boot.h:24:
In file included from arch/x86/include/asm/setup.h:10:
In file included from arch/x86/include/asm/page_types.h:7:
In file included from include/linux/mem_encrypt.h:17:
In file included from arch/x86/include/asm/mem_encrypt.h:18:
In file included from arch/x86/include/uapi/asm/bootparam.h:5:
>> arch/x86/include/asm/setup_data.h:10:20: warning: field 'data' with variable sized type 'struct setup_data' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]
10 | struct setup_data data;
| ^1 warning generated.
vim +10 arch/x86/include/asm/setup_data.h
8
9 struct pci_setup_rom {
> 10 struct setup_data data;
11 uint16_t vendor;
12 uint16_t devid;
13 uint64_t pcilen;
14 unsigned long segment;
15 unsigned long bus;
16 unsigned long device;
17 unsigned long function;
18 uint8_t romdata[];
19 };
20 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH v4 2/4] arch/x86: Move internal setup_data structures into setup_data.h
Quoted 32 lines · kernel test robot
Hi Thomas,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/x86/core]
[also build test WARNING on efi/next tip/master tip/auto-latest linus/master v6.7 next-20240108] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/arch-x86-Move-UAPI-setup-structures-into-setup_data-h/20240108-180158 base: tip/x86/core patch link: https://lore.kernel.org/r/20240108095903.8427-3-tzimmermann%40suse.de patch subject: [PATCH v4 2/4] arch/x86: Move internal setup_data structures into setup_data.h config: x86_64-rhel-8.3-bpf (https://download.01.org/0day-ci/archive/20240109/[email protected]/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240109/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All warnings (new ones prefixed by >>):
In file included from
arch/x86/realmode/rm/wakemain.c:3:
In file included fromarch/x86/boot/boot.h:24:
In file included fromarch/x86/include/asm/setup.h:10:
In file included fromarch/x86/include/asm/page_types.h:7:
In file included frominclude/linux/mem_encrypt.h:17:
In file included fromarch/x86/include/asm/mem_encrypt.h:18:
In file included fromarch/x86/include/uapi/asm/bootparam.h:5:
Quoted 4 lines
Quoted 1 line
Quoted 1 line
arch/x86/include/asm/setup_data.h:10:20: warning: field 'data' with variable sized type 'structsetup_data' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]10 | struct setup_data data; | ^1 warning generated.
I think this warning is expected. This structure is now included in the realmode part of arch/x86, which has its own set of build flags, including -Wall, which includes -Wgnu on clang. The kernel obviously uses GNU extensions and states this clearly with '-std=gnu11', so -Wno-gnu is unconditionally added to KBUILD_CFLAGS for clang. It seems that same treatment is needed for REALMODE_CFLAGS, which also matches arch/x86/boot/compressed/Makefile, see commit 6c3b56b19730 ("x86/boot:
Disable Clang warnings about GNU extensions"):
arch/x86/Makefile +3 -0
@@ -53,6 +53,9 @@ REALMODE_CFLAGS += -fno-stack-protector REALMODE_CFLAGS += -Wno-address-of-packed-member REALMODE_CFLAGS += $(cc_stack_align4) REALMODE_CFLAGS += $(CLANG_FLAGS) +ifdef CONFIG_CC_IS_CLANG +REALMODE_CFLAGS += -Wno-gnu +endif export REALMODE_CFLAGS # BITS is used as extension for files which are available in a 32 bit
Re: [PATCH v4 2/4] arch/x86: Move internal setup_data structures into setup_data.h
Hi
Am 09.01.24 um 18:58 schrieb Nathan Chancellor:
Quoted 52 lines · kernel test robot
Quoted 32 lines
Hi Thomas,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/x86/core]
[also build test WARNING on efi/next tip/master tip/auto-latest linus/master v6.7 next-20240108] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/arch-x86-Move-UAPI-setup-structures-into-setup_data-h/20240108-180158 base: tip/x86/core patch link: https://lore.kernel.org/r/20240108095903.8427-3-tzimmermann%40suse.de patch subject: [PATCH v4 2/4] arch/x86: Move internal setup_data structures into setup_data.h config: x86_64-rhel-8.3-bpf (https://download.01.org/0day-ci/archive/20240109/[email protected]/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240109/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All warnings (new ones prefixed by >>):
In file included from
arch/x86/realmode/rm/wakemain.c:3:
In file included fromarch/x86/boot/boot.h:24:
In file included fromarch/x86/include/asm/setup.h:10:
In file included fromarch/x86/include/asm/page_types.h:7:
In file included frominclude/linux/mem_encrypt.h:17:
In file included fromarch/x86/include/asm/mem_encrypt.h:18:
In file included fromarch/x86/include/uapi/asm/bootparam.h:5:Quoted 4 lines
Quoted 1 line
Quoted 1 line
arch/x86/include/asm/setup_data.h:10:20: warning: field 'data' with variable sized type 'structsetup_data' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]10 | struct
setup_datadata;
| ^
1 warning generated.I think this warning is expected. This structure is now included in the realmode part of
arch/x86, which has its own set of build flags, including -Wall, which includes -Wgnu on clang. The kernel obviously uses GNU extensions and states this clearly with '-std=gnu11', so -Wno-gnu is unconditionally added toKBUILD_CFLAGSfor clang. It seems that same treatment is needed forREALMODE_CFLAGS, which also matchesarch/x86/boot/compressed/Makefile, see commit6c3b56b19730("x86/boot:
Disable Clang warnings about GNU extensions"):arch/x86/Makefile +0
-0
arch/x86/Makefile REALMODE_CFLAGS += -fno-stack-protector · line 58
Quoted 6 lines
arch/x86/Makefile +3
-0@@ -53,6 +53,9 @@ REALMODE_CFLAGS += -fno-stack-protector REALMODE_CFLAGS += -Wno-address-of-packed-member REALMODE_CFLAGS += $(cc_stack_align4) REALMODE_CFLAGS += $(CLANG_FLAGS) +ifdef CONFIG_CC_IS_CLANG +REALMODE_CFLAGS += -Wno-gnu +endif
Thanks. Shall I include this change in the patchset?
Best regards
Thomas
Quoted 3 lines
arch/x86/Makefile +0
-0export REALMODE_CFLAGS # BITS is used as extension for files which are available in a 32 bit
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH v4 2/4] arch/x86: Move internal setup_data structures into setup_data.h
Quoted 50 lines · Thomas Zimmermann
Hi
Am 09.01.24 um 18:58 schrieb Nathan Chancellor:
Quoted 47 lines · kernel test robot
Quoted 32 lines
Hi Thomas,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/x86/core]
[also build test WARNING on efi/next tip/master tip/auto-latest linus/master v6.7 next-20240108] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/arch-x86-Move-UAPI-setup-structures-into-setup_data-h/20240108-180158 base: tip/x86/core patch link: https://lore.kernel.org/r/20240108095903.8427-3-tzimmermann%40suse.de patch subject: [PATCH v4 2/4] arch/x86: Move internal setup_data structures into setup_data.h config: x86_64-rhel-8.3-bpf (https://download.01.org/0day-ci/archive/20240109/[email protected]/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240109/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All warnings (new ones prefixed by >>):
In file included from
arch/x86/realmode/rm/wakemain.c:3:
In file included fromarch/x86/boot/boot.h:24:
In file included fromarch/x86/include/asm/setup.h:10:
In file included fromarch/x86/include/asm/page_types.h:7:
In file included frominclude/linux/mem_encrypt.h:17:
In file included fromarch/x86/include/asm/mem_encrypt.h:18:
In file included fromarch/x86/include/uapi/asm/bootparam.h:5:Quoted 4 lines
Quoted 1 line
Quoted 1 line
arch/x86/include/asm/setup_data.h:10:20: warning: field 'data' with variable sized type 'structsetup_data' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end]10 | struct
setup_datadata;
| ^
1 warning generated.I think this warning is expected. This structure is now included in the realmode part of
arch/x86, which has its own set of build flags, including -Wall, which includes -Wgnu on clang. The kernel obviously uses GNU extensions and states this clearly with '-std=gnu11', so -Wno-gnu is unconditionally added toKBUILD_CFLAGSfor clang. It seems that same treatment is needed forREALMODE_CFLAGS, which also matchesarch/x86/boot/compressed/Makefile, see commit6c3b56b19730("x86/boot:
Disable Clang warnings about GNU extensions"):
Quoted 13 lines
arch/x86/Makefile REALMODE_CFLAGS += -fno-stack-protector · line 58
Quoted 11 lines
arch/x86/Makefile +3
-0@@ -53,6 +53,9 @@ REALMODE_CFLAGS += -fno-stack-protector REALMODE_CFLAGS += -Wno-address-of-packed-member REALMODE_CFLAGS += $(cc_stack_align4) REALMODE_CFLAGS += $(CLANG_FLAGS) +ifdef CONFIG_CC_IS_CLANG +REALMODE_CFLAGS += -Wno-gnu +endifThanks. Shall I include this change in the patchset?
Yes, I think so to keep the build clean.
Quoted 13 lines
Best regards
ThomasQuoted 2 lines
arch/x86/Makefile +0
-0export REALMODE_CFLAGS # BITS is used as extension for files which are available in a 32 bitSignature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
PATCH v4 3/4 arch/x86: Implement arch_ima_efi_boot_mode() in source file
In reply to Thomas ZimmermannThe x86 implementation of arch_ima_efi_boot_mode() uses the global boot_param state. Move it into a source file to clean up the header. Avoid potential rebuilds of unrelated source files if boot_params changes.
--- arch/x86/include/asm/efi.h | 5 +++-- arch/x86/platform/efi/efi.c | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-)
arch/x86/include/asm/efi.h +3 -2
@@ -409,8 +409,9 @@ extern int __init efi_memmap_split_count(efi_memory_desc_t *md,extern void __init efi_memmap_insert (struct efi_memory_map *old_memmap,void *buf,struct efi_mem_range *mem); -#define arch_ima_efi_boot_mode \ - ({ extern struct boot_params boot_params; boot_params.secure_boot; }) +extern enum efi_secureboot_mode __x86_ima_efi_boot_mode (void ); + +#define arch_ima_efi_boot_mode __x86_ima_efi_boot_mode()#ifdef CONFIG_EFI_RUNTIME_MAP int efi_get_runtime_map_size (void );
arch/x86/platform/efi/efi.c +5 -0
@@ -950,3 +950,8 @@ umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n) }return attr->mode; } + +enum efi_secureboot_mode __x86_ima_efi_boot_mode (void ) +{ +return boot_params.secure_boot; +}
Signature · 1 line
2.43.0
PATCH v4 4/4 arch/x86: Do not include <asm/bootparam.h> in several files
In reply to Thomas ZimmermannRemove the include statement for <asm/bootparam.h> from several files that don't require it. Limits the exposure of the boot parameters within the Linux kernel code.
---
v4:
* fix fwd declaration in compressed/misc.h (Ard)
v3:
* revert of e820/types.h required
v2:
* clean up misc.h and e820/types.h
* include bootparam.h in several source files
--- arch/x86/boot/compressed/acpi.c | 2 ++ arch/x86/boot/compressed/cmdline.c | 2 ++ arch/x86/boot/compressed/efi.c | 2 ++ arch/x86/boot/compressed/misc.h | 3 ++- arch/x86/boot/compressed/pgtable_64.c | 1 + arch/x86/boot/compressed/sev.c | 1 + 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 -- arch/x86/kernel/crash.c | 1 + arch/x86/kernel/sev-shared.c | 2 ++ arch/x86/platform/pvh/enlighten.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + arch/x86/xen/vga.c | 1 - 15 files changed, 18 insertions(+), 7 deletions(-)
arch/x86/boot/compressed/acpi.c +2 -0
@@ -5,6 +5,8 @@#include "../string.h" #include "efi.h" +#include <asm/bootparam.h> +#include <linux/numa.h> /*
arch/x86/boot/compressed/cmdline.c +2 -0
@@ -1,6 +1,8 @@// SPDX-License-Identifier: GPL-2.0 #include "misc.h" +#include <asm/bootparam.h> +static unsigned long fs;static inline void set_fs (unsigned long seg) {
arch/x86/boot/compressed/efi.c +2 -0
@@ -7,6 +7,8 @@#include "misc.h" +#include <asm/bootparam.h> +/** * efi_get_type - Given a pointer to boot_params, determine the type of EFI environment. *
arch/x86/boot/compressed/misc.h +2 -1
@@ -33,7 +33,6 @@#include <linux/elf.h> #include <asm/page.h> #include <asm/boot.h> -#include <asm/bootparam.h> #include <asm/desc_defs.h> #include "tdx.h"
@@ -53,6 +52,8 @@#define memptr unsigned#endif +struct boot_params ; +/* boot/compressed/vmlinux start and end markers */ extern char _head[], _end[];
arch/x86/boot/compressed/pgtable_64.c +1 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include "misc.h" +#include <asm/bootparam.h> #include <asm/e820/types.h> #include <asm/processor.h> #include "pgtable.h"
arch/x86/boot/compressed/sev.c +1 -0
@@ -12,6 +12,7 @@*/ #include "misc.h" +#include <asm/bootparam.h> #include <asm/pgtable_types.h> #include <asm/sev.h> #include <asm/trapnr.h>
arch/x86/include/asm/kexec.h +0 -1
@@ -25,7 +25,6 @@#include <asm/page.h> #include <asm/ptrace.h> -#include <asm/bootparam.h> struct kimage ;
arch/x86/include/asm/mem_encrypt.h +1 -1
@@ -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 );
arch/x86/include/asm/sev.h +2 -1
@@ -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 */
arch/x86/include/asm/x86_init.h +0 -2
@@ -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 ;
arch/x86/kernel/crash.c +1 -0
@@ -26,6 +26,7 @@#include <linux/vmalloc.h> #include <linux/memblock.h> +#include <asm/bootparam.h> #include <asm/processor.h> #include <asm/hardirq.h> #include <asm/nmi.h>
arch/x86/kernel/sev-shared.c +2 -0
@@ -9,6 +9,8 @@* and is included directly into both code-bases. */ +#include <asm/setup_data.h> +#ifndef __BOOT_COMPRESSED#define error (v) pr_err(v)#define has_cpuflag (f) boot_cpu_has(f)
arch/x86/platform/pvh/enlighten.c +1 -0
@@ -3,6 +3,7 @@#include <xen/hvc-console.h> +#include <asm/bootparam.h> #include <asm/io_apic.h> #include <asm/hypervisor.h> #include <asm/e820/api.h>
arch/x86/xen/enlighten_pvh.c +1 -0
@@ -4,6 +4,7 @@#include <xen/hvc-console.h> +#include <asm/bootparam.h> #include <asm/io_apic.h> #include <asm/hypervisor.h> #include <asm/e820/api.h>
arch/x86/xen/vga.c +0 -1
@@ -2,7 +2,6 @@#include <linux/screen_info.h> #include <linux/init.h> -#include <asm/bootparam.h> #include <asm/setup.h> #include <xen/interface/xen.h>
Signature · 1 line
2.43.0
kernel test robot
build botRe: [PATCH v4 4/4] arch/x86: Do not include <asm/bootparam.h> in several files
kernel test robot noticed the following build errors:
Hi Thomas,
kernel test robot noticed the following build errors:
[auto build test ERROR on tip/x86/core]
[also build test ERROR on efi/next tip/master tip/auto-latest linus/master v6.7 next-20240108] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/arch-x86-Move-UAPI-setup-structures-into-setup_data-h/20240108-180158 base: tip/x86/core patch link: https://lore.kernel.org/r/20240108095903.8427-5-tzimmermann%40suse.de patch subject: [PATCH v4 4/4] arch/x86: Do not include <asm/bootparam.h> in several files config: i386-allnoconfig (https://download.01.org/0day-ci/archive/20240109/[email protected]/config) compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240109/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from arch/x86/boot/compressed/cmdline.c:2:
>> arch/x86/boot/compressed/misc.h:154:5: error: incomplete definition of type 'struct boot_params'
154 | bp->cc_blob_address = 0;
| ~~^
arch/x86/include/asm/mem_encrypt.h:18:8: note: forward declaration of 'struct boot_params'
18 | struct boot_params;
| ^1 error generated.
vim +154 arch/x86/boot/compressed/misc.h
cec49df9d331fe Joe Millenbach 2012-07-19 135
597cfe48212a3f Joerg Roedel 2020-09-07 136 #ifdef CONFIG_AMD_MEM_ENCRYPT
ec1c66af3a30d4 Michael Roth 2022-02-09 137 void sev_enable(struct boot_params *bp);
8c29f016540532 Nikunj A Dadhania 2023-01-18 138 void snp_check_features(void);
597cfe48212a3f Joerg Roedel 2020-09-07 139 void sev_es_shutdown_ghcb(void);
69add17a7c1992 Joerg Roedel 2020-09-07 140 extern bool sev_es_check_ghcb_fault(unsigned long address);
4f9c403e44e5e8 Brijesh Singh 2022-02-09 141 void snp_set_page_private(unsigned long paddr);
4f9c403e44e5e8 Brijesh Singh 2022-02-09 142 void snp_set_page_shared(unsigned long paddr);
76f61e1e89b32f Michael Roth 2022-02-24 143 void sev_prep_identity_maps(unsigned long top_level_pgt);
597cfe48212a3f Joerg Roedel 2020-09-07 144 #else
4b1c742407571e Michael Roth 2022-08-23 145 static inline void sev_enable(struct boot_params *bp)
4b1c742407571e Michael Roth 2022-08-23 146 {
4b1c742407571e Michael Roth 2022-08-23 147 /*
4b1c742407571e Michael Roth 2022-08-23 148 * bp->cc_blob_address should only be set by boot/compressed kernel.
4b1c742407571e Michael Roth 2022-08-23 149 * Initialize it to 0 unconditionally (thus here in this stub too) to
4b1c742407571e Michael Roth 2022-08-23 150 * ensure that uninitialized values from buggy bootloaders aren't
4b1c742407571e Michael Roth 2022-08-23 151 * propagated.
4b1c742407571e Michael Roth 2022-08-23 152 */
4b1c742407571e Michael Roth 2022-08-23 153 if (bp)
4b1c742407571e Michael Roth 2022-08-23 @154 bp->cc_blob_address = 0;
4b1c742407571e Michael Roth 2022-08-23 155 }
8c29f016540532 Nikunj A Dadhania 2023-01-18 156 static inline void snp_check_features(void) { }
597cfe48212a3f Joerg Roedel 2020-09-07 157 static inline void sev_es_shutdown_ghcb(void) { }
69add17a7c1992 Joerg Roedel 2020-09-07 158 static inline bool sev_es_check_ghcb_fault(unsigned long address)
69add17a7c1992 Joerg Roedel 2020-09-07 159 {
69add17a7c1992 Joerg Roedel 2020-09-07 160 return false;
69add17a7c1992 Joerg Roedel 2020-09-07 161 }
4f9c403e44e5e8 Brijesh Singh 2022-02-09 162 static inline void snp_set_page_private(unsigned long paddr) { }
4f9c403e44e5e8 Brijesh Singh 2022-02-09 163 static inline void snp_set_page_shared(unsigned long paddr) { }
76f61e1e89b32f Michael Roth 2022-02-24 164 static inline void sev_prep_identity_maps(unsigned long top_level_pgt) { }
597cfe48212a3f Joerg Roedel 2020-09-07 165 #endif597cfe48212a3f Joerg Roedel 2020-09-07 166
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v4 4/4] arch/x86: Do not include <asm/bootparam.h> in several files
In reply to Thomas Zimmermannkernel test robot noticed the following build errors:
Hi Thomas,
kernel test robot noticed the following build errors:
[auto build test ERROR on tip/x86/core]
[also build test ERROR on efi/next tip/master tip/auto-latest linus/master v6.7 next-20240108] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Zimmermann/arch-x86-Move-UAPI-setup-structures-into-setup_data-h/20240108-180158 base: tip/x86/core patch link: https://lore.kernel.org/r/20240108095903.8427-5-tzimmermann%40suse.de patch subject: [PATCH v4 4/4] arch/x86: Do not include <asm/bootparam.h> in several files config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20240109/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240109/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from arch/x86/boot/compressed/cmdline.c:2:
arch/x86/boot/compressed/misc.h: In function 'sev_enable':
>> arch/x86/boot/compressed/misc.h:154:19: error: invalid use of undefined type 'struct boot_params'
154 | bp->cc_blob_address = 0;
| ^~vim +154 arch/x86/boot/compressed/misc.h
cec49df9d331fea Joe Millenbach 2012-07-19 135
597cfe48212a3f1 Joerg Roedel 2020-09-07 136 #ifdef CONFIG_AMD_MEM_ENCRYPT
ec1c66af3a30d45 Michael Roth 2022-02-09 137 void sev_enable(struct boot_params *bp);
8c29f0165405325 Nikunj A Dadhania 2023-01-18 138 void snp_check_features(void);
597cfe48212a3f1 Joerg Roedel 2020-09-07 139 void sev_es_shutdown_ghcb(void);
69add17a7c19925 Joerg Roedel 2020-09-07 140 extern bool sev_es_check_ghcb_fault(unsigned long address);
4f9c403e44e5e88 Brijesh Singh 2022-02-09 141 void snp_set_page_private(unsigned long paddr);
4f9c403e44e5e88 Brijesh Singh 2022-02-09 142 void snp_set_page_shared(unsigned long paddr);
76f61e1e89b32f3 Michael Roth 2022-02-24 143 void sev_prep_identity_maps(unsigned long top_level_pgt);
597cfe48212a3f1 Joerg Roedel 2020-09-07 144 #else
4b1c742407571ef Michael Roth 2022-08-23 145 static inline void sev_enable(struct boot_params *bp)
4b1c742407571ef Michael Roth 2022-08-23 146 {
4b1c742407571ef Michael Roth 2022-08-23 147 /*
4b1c742407571ef Michael Roth 2022-08-23 148 * bp->cc_blob_address should only be set by boot/compressed kernel.
4b1c742407571ef Michael Roth 2022-08-23 149 * Initialize it to 0 unconditionally (thus here in this stub too) to
4b1c742407571ef Michael Roth 2022-08-23 150 * ensure that uninitialized values from buggy bootloaders aren't
4b1c742407571ef Michael Roth 2022-08-23 151 * propagated.
4b1c742407571ef Michael Roth 2022-08-23 152 */
4b1c742407571ef Michael Roth 2022-08-23 153 if (bp)
4b1c742407571ef Michael Roth 2022-08-23 @154 bp->cc_blob_address = 0;
4b1c742407571ef Michael Roth 2022-08-23 155 }
8c29f0165405325 Nikunj A Dadhania 2023-01-18 156 static inline void snp_check_features(void) { }
597cfe48212a3f1 Joerg Roedel 2020-09-07 157 static inline void sev_es_shutdown_ghcb(void) { }
69add17a7c19925 Joerg Roedel 2020-09-07 158 static inline bool sev_es_check_ghcb_fault(unsigned long address)
69add17a7c19925 Joerg Roedel 2020-09-07 159 {
69add17a7c19925 Joerg Roedel 2020-09-07 160 return false;
69add17a7c19925 Joerg Roedel 2020-09-07 161 }
4f9c403e44e5e88 Brijesh Singh 2022-02-09 162 static inline void snp_set_page_private(unsigned long paddr) { }
4f9c403e44e5e88 Brijesh Singh 2022-02-09 163 static inline void snp_set_page_shared(unsigned long paddr) { }
76f61e1e89b32f3 Michael Roth 2022-02-24 164 static inline void sev_prep_identity_maps(unsigned long top_level_pgt) { }
597cfe48212a3f1 Joerg Roedel 2020-09-07 165 #endif597cfe48212a3f1 Joerg Roedel 2020-09-07 166
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki