Re: [PATCH v6 3/5] x86/cpufeatures: Generate a feature mask header based on build config

From: Xin Li
Date: Tue Mar 04 2025 - 05:19:46 EST


On 3/3/2025 5:25 AM, Borislav Petkov wrote:
On Mon, Mar 03, 2025 at 04:05:54AM -0800, H. Peter Anvin wrote:
"make headers" on an unconfigured tree should presumably only produce the uapi headers, not kernel-internal ones, one could surmise?

Well, that's kinda a question for you guys:

cfc7686900a87 (H. Peter Anvin (Intel) 2025-02-28 00:23:36 -0800 281)archheaders: $(out)/$(featuremasks_hdr)
1f57d5d85ba7f (Ingo Molnar 2015-06-03 18:36:41 +0200 282) $(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all

and the headers target has

headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts

as its prereq.

Judging by

59b2bd05f5f4 ("kbuild: add 'headers' target to build up uapi headers in usr/include")

It seems that 'archprepare' works, however I'm not sure if it's the best
choice. Any suggestion?

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 60583987d320..2db535958b8d 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -276,9 +276,9 @@ $(out)/$(featuremasks_hdr): $(featuremasks_awk) $(cpufeatures_hdr) $(KCONFIG_CON
$(shell mkdir -p $(out))
$(call if_changed,gen_featuremasks)

-targets += $(out)/$(featuremasks_hdr)
+archprepare: $(out)/$(featuremasks_hdr)

-archheaders: $(out)/$(featuremasks_hdr)
+archheaders:
$(Q)$(MAKE) $(build)=arch/x86/entry/syscalls all

###


it sure looks like "make headers" should be for uapi headers only.

Oh, and it should be documented in "make help" output btw.

Want me to add it btw?

Thanks!
Xin