mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
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
This commit is contained in:
committed by
Ingo Molnar
parent
3d37d9396e
commit
841326332b
@@ -268,6 +268,21 @@ archscripts: scripts_basic
|
||||
archheaders:
|
||||
$(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all
|
||||
|
||||
###
|
||||
# <asm/cpufeaturemasks.h> header generation
|
||||
|
||||
cpufeaturemasks.hdr := arch/x86/include/generated/asm/cpufeaturemasks.h
|
||||
cpufeaturemasks.awk := $(srctree)/arch/x86/tools/cpufeaturemasks.awk
|
||||
cpufeatures_hdr := $(srctree)/arch/x86/include/asm/cpufeatures.h
|
||||
targets += $(cpufeaturemasks.hdr)
|
||||
quiet_cmd_gen_featuremasks = GEN $@
|
||||
cmd_gen_featuremasks = $(AWK) -f $(cpufeaturemasks.awk) $(cpufeatures_hdr) $(KCONFIG_CONFIG) > $@
|
||||
|
||||
$(cpufeaturemasks.hdr): $(cpufeaturemasks.awk) $(cpufeatures_hdr) $(KCONFIG_CONFIG) FORCE
|
||||
$(shell mkdir -p $(dir $@))
|
||||
$(call if_changed,gen_featuremasks)
|
||||
archprepare: $(cpufeaturemasks.hdr)
|
||||
|
||||
###
|
||||
# Kernel objects
|
||||
|
||||
|
||||
Reference in New Issue
Block a user