]> www.infradead.org Git - users/hch/misc.git/commit
x86/cpufeatures: Generate the <asm/cpufeaturemasks.h> header based on build config
authorH. Peter Anvin (Intel) <hpa@zytor.com>
Wed, 5 Mar 2025 18:47:22 +0000 (10:47 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 19 Mar 2025 10:15:11 +0000 (11:15 +0100)
commit841326332bcb13ae4e6cd456350bf566a402b45e
tree52b6665c43cefdcb9be299062a31c66c27f5f4a7
parent3d37d9396eb37a62ba75bf8f3bd934500cf64bf0
x86/cpufeatures: Generate the <asm/cpufeaturemasks.h> header based on build config

Introduce an AWK script to auto-generate the <asm/cpufeaturemasks.h> header
with required and disabled feature masks based on <asm/cpufeatures.h>
and the current build config.

Thus for any CPU feature with a build config, e.g., X86_FRED, simply add:

  config X86_DISABLED_FEATURE_FRED
def_bool y
depends on !X86_FRED

to arch/x86/Kconfig.cpufeatures, instead of adding a conditional CPU
feature disable flag, e.g., DISABLE_FRED.

Lastly, the generated required and disabled feature masks will be added to
their corresponding feature masks for this particular compile-time
configuration.

  [ Xin: build integration improvements ]
  [ mingo: Improved changelog and comments ]

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Signed-off-by: Xin Li (Intel) <xin@zytor.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20250305184725.3341760-3-xin@zytor.com
arch/x86/Makefile
arch/x86/boot/cpucheck.c
arch/x86/boot/cpuflags.c
arch/x86/boot/mkcpustr.c
arch/x86/include/asm/Kbuild
arch/x86/include/asm/cpufeature.h
arch/x86/include/asm/cpufeatures.h
arch/x86/kernel/verify_cpu.S
arch/x86/tools/cpufeaturemasks.awk [new file with mode: 0755]