diff mbox series

[v10,07/14] arm64: enable KEXEC_FILE config

Message ID 20180623022058.10935-8-takahiro.akashi@linaro.org
State Superseded
Headers show
Series arm64: kexec: add kexec_file_load() support | expand

Commit Message

AKASHI Takahiro June 23, 2018, 2:20 a.m. UTC
Modify arm64/Kconfig to enable kexec_file_load support.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 arch/arm64/Kconfig                     | 10 ++++++++++
 arch/arm64/kernel/Makefile             |  3 ++-
 arch/arm64/kernel/machine_kexec_file.c | 16 ++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm64/kernel/machine_kexec_file.c

-- 
2.17.0

Comments

James Morse July 3, 2018, 4:33 p.m. UTC | #1
Hi Akashi,

On 23/06/18 03:20, AKASHI Takahiro wrote:
> Modify arm64/Kconfig to enable kexec_file_load support.


> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig

> index 42c090cf0292..f68318f61c85 100644

> --- a/arch/arm64/Kconfig

> +++ b/arch/arm64/Kconfig

> @@ -835,6 +835,16 @@ config KEXEC

>  	  but it is independent of the system firmware.   And like a reboot

>  	  you can start any kernel with it, not just Linux.

>  

> +config KEXEC_FILE

> +	bool "kexec file based system call"

> +	select KEXEC_CORE

> +	select BUILD_BIN2C


Wasn't BIN2C only needed for purgatory?

x86/powerpc/s390 all select CRYPTO_SHA256 here, presumably for arch-specific
verification mechanisms. I assume we're using SIGNED_PE_FILE_VERIFICATION instead.


> +	help

> +	  This is new version of kexec system call. This system call is

> +	  file based and takes file descriptors as system call argument

> +	  for kernel and initramfs as opposed to list of segments as

> +	  accepted by previous system call.

> +

>  config CRASH_DUMP

>  	bool "Build kdump crash kernel"

>  	help



Acked-by: James Morse <james.morse@arm.com>



Thanks,

James
AKASHI Takahiro July 9, 2018, 6:31 a.m. UTC | #2
James,

On Tue, Jul 03, 2018 at 05:33:20PM +0100, James Morse wrote:
> Hi Akashi,

> 

> On 23/06/18 03:20, AKASHI Takahiro wrote:

> > Modify arm64/Kconfig to enable kexec_file_load support.

> 

> > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig

> > index 42c090cf0292..f68318f61c85 100644

> > --- a/arch/arm64/Kconfig

> > +++ b/arch/arm64/Kconfig

> > @@ -835,6 +835,16 @@ config KEXEC

> >  	  but it is independent of the system firmware.   And like a reboot

> >  	  you can start any kernel with it, not just Linux.

> >  

> > +config KEXEC_FILE

> > +	bool "kexec file based system call"

> > +	select KEXEC_CORE

> > +	select BUILD_BIN2C

> 

> Wasn't BIN2C only needed for purgatory?


Right. Will remove it.

> x86/powerpc/s390 all select CRYPTO_SHA256 here, presumably for arch-specific

> verification mechanisms. I assume we're using SIGNED_PE_FILE_VERIFICATION instead.


To be clear, hash check (sha256) will be done at reboot (in purgatory),
while binary verification will be done at load.

> 

> > +	help

> > +	  This is new version of kexec system call. This system call is

> > +	  file based and takes file descriptors as system call argument

> > +	  for kernel and initramfs as opposed to list of segments as

> > +	  accepted by previous system call.

> > +

> >  config CRASH_DUMP

> >  	bool "Build kdump crash kernel"

> >  	help

> 

> 

> Acked-by: James Morse <james.morse@arm.com>


Thanks!
-Takahiro AKASHI

> 

> Thanks,

> 

> James
diff mbox series

Patch

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 42c090cf0292..f68318f61c85 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -835,6 +835,16 @@  config KEXEC
 	  but it is independent of the system firmware.   And like a reboot
 	  you can start any kernel with it, not just Linux.
 
+config KEXEC_FILE
+	bool "kexec file based system call"
+	select KEXEC_CORE
+	select BUILD_BIN2C
+	help
+	  This is new version of kexec system call. This system call is
+	  file based and takes file descriptors as system call argument
+	  for kernel and initramfs as opposed to list of segments as
+	  accepted by previous system call.
+
 config CRASH_DUMP
 	bool "Build kdump crash kernel"
 	help
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 0025f8691046..06281e1ad7ed 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -48,8 +48,9 @@  arm64-obj-$(CONFIG_ARM64_ACPI_PARKING_PROTOCOL)	+= acpi_parking_protocol.o
 arm64-obj-$(CONFIG_PARAVIRT)		+= paravirt.o
 arm64-obj-$(CONFIG_RANDOMIZE_BASE)	+= kaslr.o
 arm64-obj-$(CONFIG_HIBERNATION)		+= hibernate.o hibernate-asm.o
-arm64-obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o	\
+arm64-obj-$(CONFIG_KEXEC_CORE)		+= machine_kexec.o relocate_kernel.o	\
 					   cpu-reset.o
+arm64-obj-$(CONFIG_KEXEC_FILE)		+= machine_kexec_file.o
 arm64-obj-$(CONFIG_ARM64_RELOC_TEST)	+= arm64-reloc-test.o
 arm64-reloc-test-y := reloc_test_core.o reloc_test_syms.o
 arm64-obj-$(CONFIG_CRASH_DUMP)		+= crash_dump.o
diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c
new file mode 100644
index 000000000000..c38a8048ed00
--- /dev/null
+++ b/arch/arm64/kernel/machine_kexec_file.c
@@ -0,0 +1,16 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * kexec_file for arm64
+ *
+ * Copyright (C) 2018 Linaro Limited
+ * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
+ *
+ */
+
+#define pr_fmt(fmt) "kexec_file: " fmt
+
+#include <linux/kexec.h>
+
+const struct kexec_file_ops * const kexec_file_loaders[] = {
+	NULL
+};