powerpc/purgatory: Omit use of bin2c
PATCH 1/1 powerpc/purgatory: Omit use of bin2c
The .incbin assembler directive is much faster than bin2c + $(CC).
Do similar refactoring as in commit 4c0f032d4963 ("s390/purgatory:
Omit use of bin2c").
Please note the .quad directive matches to size_t in C (both 8 byte) because the purgatory is compiled only for the 64-bit kernel. (KEXEC_FILE depends on PPC64).
---
arch/powerpc/Kconfig | 1 - arch/powerpc/purgatory/.gitignore | 1 - arch/powerpc/purgatory/Makefile | 8 ++------ arch/powerpc/purgatory/kexec-purgatory.S | 14 ++++++++++++++ scripts/remove-stale-files | 2 ++ 5 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 arch/powerpc/purgatory/kexec-purgatory.S
arch/powerpc/Kconfig +0 -1
@@ -547,7 +547,6 @@ config KEXEC_FILE bool "kexec file based system call" select KEXEC_CORE select HAVE_IMA_KEXEC if IMA - select BUILD_BIN2C select KEXEC_ELF depends on PPC64 depends on CRYPTO=y
arch/powerpc/purgatory/.gitignore +0 -1
@@ -1,3 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -kexec-purgatory.c purgatory.ro
arch/powerpc/purgatory/Makefile +2 -6
@@ -2,17 +2,13 @@ KASAN_SANITIZE := n -targets += trampoline_$(BITS).o purgatory.ro kexec-purgatory.c +targets += trampoline_$(BITS).o purgatory.ro LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined $(obj)/purgatory.ro: $(obj)/trampoline_$(BITS).o FORCE $(call if_changed,ld) -quiet_cmd_bin2c = BIN2C $@ - cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@ - -$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE - $(call if_changed,bin2c) +$(obj)/kexec-purgatory.o: $(obj)/purgatory.ro obj-y += kexec-purgatory.o
arch/powerpc/purgatory/kexec-purgatory.S new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + + .section .rodata, "a" + + .align 8 +kexec_purgatory: + .globl kexec_purgatory + .incbin "arch/powerpc/purgatory/purgatory.ro" +.Lkexec_purgatroy_end: + + .align 8 +kexec_purgatory_size: + .globl kexec_purgatory_size + .quad .Lkexec_purgatroy_end - kexec_purgatory
scripts/remove-stale-files +2 -0
@@ -20,6 +20,8 @@ set -e # yard. Stale files stay in this file for a while (for some release cycles?), # then will be really dead and removed from the code base entirely. +rm -f arch/powerpc/purgatory/kexec-purgatory.c + # These were previously generated source files. When you are building the kernel # with O=, make sure to remove the stale files in the output tree. Otherwise, # the build system wrongly compiles the stale ones.
Signature · 1 line
2.32.0
Quoted 6 lines · Masahiro Yamada
The .incbin assembler directive is much faster than bin2c + $(CC).
Do similar refactoring as in commit
4c0f032d4963("s390/purgatory:
Omit use of bin2c").
Quoted 6 lines
Please note the .quad directive matches to
size_tin C (both 8 byte) because the purgatory is compiled only for the 64-bit kernel. (KEXEC_FILEdepends on PPC64).Signed-off-by Masahiro Yamada <[email protected]>---
Ping?
Quoted 88 lines
arch/powerpc/Kconfig | 1 - arch/powerpc/purgatory/.gitignore | 1 - arch/powerpc/purgatory/Makefile | 8 ++------ arch/powerpc/purgatory/kexec-purgatory.S | 14 ++++++++++++++ scripts/remove-stale-files | 2 ++ 5 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 arch/powerpc/purgatory/kexec-purgatory.Sarch/powerpc/Kconfig +0
-1@@ -547,7 +547,6 @@ config KEXEC_FILE bool "kexec file based system call" select KEXEC_CORE select HAVE_IMA_KEXEC if IMA - select BUILD_BIN2C select KEXEC_ELF depends on PPC64 depends on CRYPTO=yarch/powerpc/purgatory/.gitignore +0
-1@@ -1,3 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -kexec-purgatory.c purgatory.roarch/powerpc/purgatory/Makefile +2
-6@@ -2,17 +2,13 @@ KASAN_SANITIZE := n -targets += trampoline_$(BITS).o purgatory.ro kexec-purgatory.c +targets += trampoline_$(BITS).o purgatory.ro LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined $(obj)/purgatory.ro: $(obj)/trampoline_$(BITS).o FORCE $(call if_changed,ld) -quiet_cmd_bin2c = BIN2C $@ - cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@ - -$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE - $(call if_changed,bin2c) +$(obj)/kexec-purgatory.o: $(obj)/purgatory.ro obj-y += kexec-purgatory.oarch/powerpc/purgatory/kexec-purgatory.S new file +14
-0@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + + .section .rodata, "a" + + .align 8 +kexec_purgatory: + .globl kexec_purgatory + .incbin "arch/powerpc/purgatory/purgatory.ro" +.Lkexec_purgatroy_end: + + .align 8 +kexec_purgatory_size: + .globl kexec_purgatory_size + .quad .Lkexec_purgatroy_end - kexec_purgatoryscripts/remove-stale-files +2
-1@@ -20,6 +20,8 @@ set -e # yard. Stale files stay in this file for a while (for some release cycles?), # then will be really dead and removed from the code base entirely. +rm -f arch/powerpc/purgatory/kexec-purgatory.c + # These were previously generated source files. When you are building the kernel # with O=, make sure to remove the stale files in the output tree. Otherwise, # the build system wrongly compiles the stale ones. --2.32.0
Signature · 2 lines
Best Regards Masahiro Yamada
Quoted 1 line · Masahiro Yamada
The .incbin assembler directive is much faster than bin2c + $(CC).
And perhaps more importantly it is simpler and less clumsy.
arch/powerpc/purgatory/kexec-purgatory.S line 9
Quoted 12 lines
arch/powerpc/purgatory/kexec-purgatory.S new file +9
-0@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + + .section .rodata, "a" + + .align 8 +kexec_purgatory: + .globl kexec_purgatory + .incbin "arch/powerpc/purgatory/purgatory.ro" +.Lkexec_purgatroy_end:
Typo here (s/ro/or/)
arch/powerpc/purgatory/kexec-purgatory.S line 14
Quoted 5 lines
arch/powerpc/purgatory/kexec-purgatory.S new file +5
-0+ + .align 8 +kexec_purgatory_size: + .globl kexec_purgatory_size + .quad .Lkexec_purgatroy_end - kexec_purgatory
And here again ofc.
Looks good to me otherwise, nice cleanup :-)
Segher
Quoted 6 lines · Segher Boessenkool
Quoted 1 line · Masahiro Yamada
The .incbin assembler directive is much faster than bin2c + $(CC).
And perhaps more importantly it is simpler and less clumsy.
Quoted 14 lines
arch/powerpc/purgatory/kexec-purgatory.S line 9
Quoted 12 lines
arch/powerpc/purgatory/kexec-purgatory.S new file +9
-0@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + + .section .rodata, "a" + + .align 8 +kexec_purgatory: + .globl kexec_purgatory + .incbin "arch/powerpc/purgatory/purgatory.ro" +.Lkexec_purgatroy_end:Typo here (s/ro/or/)
Nice catch. Thanks.
I've sent v2.
Quoted 15 lines
arch/powerpc/purgatory/kexec-purgatory.S line 14
Quoted 6 lines
arch/powerpc/purgatory/kexec-purgatory.S new file +5
-0+ + .align 8 +kexec_purgatory_size: + .globl kexec_purgatory_size + .quad .Lkexec_purgatroy_end - kexec_purgatoryAnd here again ofc.
Looks good to me otherwise, nice cleanup :-)
Reviewed-by Segher Boessenkool <[email protected]>Segher
Signature · 2 lines
Best Regards Masahiro Yamada