From: Mark Brown broonie@kernel.org
mainline inclusion from mainline-v5.18-rc1 commit c07d8017bceb82cbe5fedd129d072c59a53f5513 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8DFTV CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=...
--------------------------------
Now that we have a script for generating system registers hook it up to the build system similarly to cpucaps. Since we don't currently have any actual register information in the input file this should produce no change in the built kernel. For ease of review the register information will be converted in separate patches.
Signed-off-by: Mark Brown broonie@kernel.org Acked-by: Mark Rutland mark.rutland@arm.com Link: https://lore.kernel.org/r/20220503170233.507788-10-broonie@kernel.org Signed-off-by: Catalin Marinas catalin.marinas@arm.com Signed-off-by: Junhao He hejunhao3@huawei.com --- arch/arm64/Makefile | 3 +++ arch/arm64/include/asm/Kbuild | 2 ++ arch/arm64/include/asm/sysreg.h | 8 ++++++++ arch/arm64/tools/Makefile | 18 ++++++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 arch/arm64/tools/Makefile
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 4a42de35a898..5971ca85a6a1 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -170,6 +170,9 @@ vdso_install: $(if $(CONFIG_COMPAT_VDSO), \ $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@)
+archprepare: + $(Q)$(MAKE) $(build)=arch/arm64/tools kapi + # We use MRPROPER_FILES and CLEAN_FILES now archclean: $(Q)$(MAKE) $(clean)=$(boot) diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index a3426b61ff65..cef37f080b05 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild @@ -4,3 +4,5 @@ generic-y += mcs_spinlock.h generic-y += qrwlock.h generic-y += set_memory.h generic-y += user.h + +generated-y += sysreg-defs.h diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index 7aded7acdd06..ca9c9b8ca571 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -111,6 +111,14 @@ #define SYS_DC_CSW sys_insn(1, 0, 7, 10, 2) #define SYS_DC_CISW sys_insn(1, 0, 7, 14, 2)
+/* + * Automatically generated definitions for system registers, the + * manual encodings below are in the process of being converted to + * come from here. The header relies on the definition of sys_reg() + * earlier in this file. + */ +#include "asm/sysreg-defs.h" + /* * System registers, organised loosely by encoding but grouped together * where the architected name contains an index. e.g. ID_MMFR<n>_EL1. diff --git a/arch/arm64/tools/Makefile b/arch/arm64/tools/Makefile new file mode 100644 index 000000000000..9c3b7edfd720 --- /dev/null +++ b/arch/arm64/tools/Makefile @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0 + +gen := arch/$(ARCH)/include/generated +kapi := $(gen)/asm + +kapi-hdrs-y := $(kapi)/sysreg-defs.h + +targets += $(addprefix ../../../, $(kapi-hdrs-y)) + +PHONY += kapi + +kapi: $(kapi-hdrs-y) + +quiet_cmd_gen_sysreg = GEN $@ + cmd_gen_sysreg = mkdir -p $(dir $@); $(AWK) -f $(real-prereqs) > $@ + +$(kapi)/sysreg-defs.h: $(src)/gen-sysreg.awk $(src)/sysreg FORCE + $(call if_changed,gen_sysreg)