]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/purgatory: Omit use of bin2c
authorMasahiro Yamada <masahiroy@kernel.org>
Mon, 25 Jul 2022 01:56:19 +0000 (10:56 +0900)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 27 Jul 2022 11:36:03 +0000 (21:36 +1000)
The .incbin assembler directive is much faster than bin2c + $(CC).

Do similar refactoring as in commit b8abea4e0c09 ("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).

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220725015619.618070-1-masahiroy@kernel.org
arch/powerpc/Kconfig
arch/powerpc/purgatory/.gitignore
arch/powerpc/purgatory/Makefile
arch/powerpc/purgatory/kexec-purgatory.S [new file with mode: 0644]
scripts/remove-stale-files

index 26331cdd3642baf5f202a84b6f4a2703fe3e4d4d..c76d499e2aa34a2b4bff3aedc7e53816cd991fee 100644 (file)
@@ -553,7 +553,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
index b8dc6ff342542fea9d55e5f381f23f2a21f5fb04..5e40575c1f2b29b3ef3a1a0d60b84ffb7687a618 100644 (file)
@@ -1,3 +1,2 @@
 # SPDX-License-Identifier: GPL-2.0-only
-kexec-purgatory.c
 purgatory.ro
index 348f595810523f1febe4225ebb3604fd75b3263e..a81d155b89aed1457c11a232402bf84eaef74166 100644 (file)
@@ -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
diff --git a/arch/powerpc/purgatory/kexec-purgatory.S b/arch/powerpc/purgatory/kexec-purgatory.S
new file mode 100644 (file)
index 0000000..f494fd5
--- /dev/null
@@ -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_purgatory_end:
+
+       .align  8
+kexec_purgatory_size:
+       .globl  kexec_purgatory_size
+       .quad   .Lkexec_purgatory_end - kexec_purgatory
index 7adab4618035bc7e5984f4880489ef93a5c49994..5a75434696983d390593c477489cd92d8dfc1a45 100755 (executable)
@@ -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.