* [PATCH] powerpc/purgatory: Omit use of bin2c
@ 2022-06-25 22:40 Masahiro Yamada
2022-07-24 15:12 ` Masahiro Yamada
2022-07-25 1:41 ` Segher Boessenkool
0 siblings, 2 replies; 4+ messages in thread
From: Masahiro Yamada @ 2022-06-25 22:40 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
linuxppc-dev
Cc: Masahiro Yamada, linux-kernel
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).
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
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
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index c2ce2e60c8f0..1cb684ee3519 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -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
diff --git a/arch/powerpc/purgatory/.gitignore b/arch/powerpc/purgatory/.gitignore
index b8dc6ff34254..5e40575c1f2b 100644
--- a/arch/powerpc/purgatory/.gitignore
+++ b/arch/powerpc/purgatory/.gitignore
@@ -1,3 +1,2 @@
# SPDX-License-Identifier: GPL-2.0-only
-kexec-purgatory.c
purgatory.ro
diff --git a/arch/powerpc/purgatory/Makefile b/arch/powerpc/purgatory/Makefile
index 348f59581052..a81d155b89ae 100644
--- a/arch/powerpc/purgatory/Makefile
+++ b/arch/powerpc/purgatory/Makefile
@@ -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
index 000000000000..4e5f64a0bf4a
--- /dev/null
+++ b/arch/powerpc/purgatory/kexec-purgatory.S
@@ -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
diff --git a/scripts/remove-stale-files b/scripts/remove-stale-files
index 7adab4618035..5a7543469698 100755
--- a/scripts/remove-stale-files
+++ b/scripts/remove-stale-files
@@ -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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/purgatory: Omit use of bin2c
2022-06-25 22:40 [PATCH] powerpc/purgatory: Omit use of bin2c Masahiro Yamada
@ 2022-07-24 15:12 ` Masahiro Yamada
2022-07-25 1:41 ` Segher Boessenkool
1 sibling, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2022-07-24 15:12 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
linuxppc-dev
Cc: Linux Kernel Mailing List
On Sun, Jun 26, 2022 at 7:42 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> 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).
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
Ping?
> 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
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index c2ce2e60c8f0..1cb684ee3519 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -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
> diff --git a/arch/powerpc/purgatory/.gitignore b/arch/powerpc/purgatory/.gitignore
> index b8dc6ff34254..5e40575c1f2b 100644
> --- a/arch/powerpc/purgatory/.gitignore
> +++ b/arch/powerpc/purgatory/.gitignore
> @@ -1,3 +1,2 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -kexec-purgatory.c
> purgatory.ro
> diff --git a/arch/powerpc/purgatory/Makefile b/arch/powerpc/purgatory/Makefile
> index 348f59581052..a81d155b89ae 100644
> --- a/arch/powerpc/purgatory/Makefile
> +++ b/arch/powerpc/purgatory/Makefile
> @@ -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
> index 000000000000..4e5f64a0bf4a
> --- /dev/null
> +++ b/arch/powerpc/purgatory/kexec-purgatory.S
> @@ -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
> diff --git a/scripts/remove-stale-files b/scripts/remove-stale-files
> index 7adab4618035..5a7543469698 100755
> --- a/scripts/remove-stale-files
> +++ b/scripts/remove-stale-files
> @@ -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
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/purgatory: Omit use of bin2c
2022-06-25 22:40 [PATCH] powerpc/purgatory: Omit use of bin2c Masahiro Yamada
2022-07-24 15:12 ` Masahiro Yamada
@ 2022-07-25 1:41 ` Segher Boessenkool
2022-07-25 1:58 ` Masahiro Yamada
1 sibling, 1 reply; 4+ messages in thread
From: Segher Boessenkool @ 2022-07-25 1:41 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: Paul Mackerras, linuxppc-dev, linux-kernel
On Sun, Jun 26, 2022 at 07:40:37AM +0900, Masahiro Yamada wrote:
> The .incbin assembler directive is much faster than bin2c + $(CC).
And perhaps more importantly it is simpler and less clumsy.
> --- /dev/null
> +++ b/arch/powerpc/purgatory/kexec-purgatory.S
> @@ -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/)
> +
> + .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 :-)
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Segher
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/purgatory: Omit use of bin2c
2022-07-25 1:41 ` Segher Boessenkool
@ 2022-07-25 1:58 ` Masahiro Yamada
0 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2022-07-25 1:58 UTC (permalink / raw)
To: Segher Boessenkool
Cc: Paul Mackerras, linuxppc-dev, Linux Kernel Mailing List
On Mon, Jul 25, 2022 at 10:42 AM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Sun, Jun 26, 2022 at 07:40:37AM +0900, Masahiro Yamada wrote:
> > The .incbin assembler directive is much faster than bin2c + $(CC).
>
> And perhaps more importantly it is simpler and less clumsy.
>
> > --- /dev/null
> > +++ b/arch/powerpc/purgatory/kexec-purgatory.S
> > @@ -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.
>
> > +
> > + .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 :-)
>
> Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
>
>
> Segher
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-25 2:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-25 22:40 [PATCH] powerpc/purgatory: Omit use of bin2c Masahiro Yamada
2022-07-24 15:12 ` Masahiro Yamada
2022-07-25 1:41 ` Segher Boessenkool
2022-07-25 1:58 ` Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).