Skip to content

Commit 83a7a61

Browse files
riscv: kexec: add kexec_file_load() support
This patch set implements kexec_file_load() for RISC-V, which is currently only allowed on rv64 due to some minor build issues on 32-bit platforms in the generic code. This allows users to kexec() using an FD as opposed to a buffer. Link: https://lore.kernel.org/all/20220408100914.150110-1-lizhengyu3@huawei.com/ * palmer/riscv-kexec_file: RISC-V: Load purgatory in kexec_file RISC-V: Add purgatory RISC-V: Support for kexec_file on panic RISC-V: Add kexec_file support RISC-V: use memcpy for kexec_file mode kexec_file: Fix kexec_file.c build error for riscv platform
2 parents 7eb6369 + 838b3e2 commit 83a7a61

13 files changed

Lines changed: 686 additions & 4 deletions

File tree

arch/riscv/Kbuild

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
obj-y += kernel/ mm/ net/
44
obj-$(CONFIG_BUILTIN_DTB) += boot/dts/
55

6+
obj-$(CONFIG_ARCH_HAS_KEXEC_PURGATORY) += purgatory/
7+
68
# for cleaning
79
subdir- += boot

arch/riscv/Kconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,26 @@ config KEXEC
418418

419419
The name comes from the similarity to the exec system call.
420420

421+
config KEXEC_FILE
422+
bool "kexec file based systmem call"
423+
select KEXEC_CORE
424+
select KEXEC_ELF
425+
select HAVE_IMA_KEXEC if IMA
426+
depends on 64BIT
427+
help
428+
This is new version of kexec system call. This system call is
429+
file based and takes file descriptors as system call argument
430+
for kernel and initramfs as opposed to list of segments as
431+
accepted by previous system call.
432+
433+
If you don't know what to do here, say Y.
434+
435+
config ARCH_HAS_KEXEC_PURGATORY
436+
def_bool KEXEC_FILE
437+
select BUILD_BIN2C
438+
depends on CRYPTO=y
439+
depends on CRYPTO_SHA256=y
440+
421441
config CRASH_DUMP
422442
bool "Build kdump crash kernel"
423443
help

arch/riscv/include/asm/kexec.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@ typedef void (*riscv_kexec_method)(unsigned long first_ind_entry,
5353

5454
extern riscv_kexec_method riscv_kexec_norelocate;
5555

56+
#ifdef CONFIG_KEXEC_FILE
57+
extern const struct kexec_file_ops elf_kexec_ops;
58+
#endif
59+
5660
#endif

arch/riscv/kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ endif
7979
obj-$(CONFIG_HOTPLUG_CPU) += cpu-hotplug.o
8080
obj-$(CONFIG_KGDB) += kgdb.o
8181
obj-$(CONFIG_KEXEC) += kexec_relocate.o crash_save_regs.o machine_kexec.o
82+
obj-$(CONFIG_KEXEC_FILE) += elf_kexec.o machine_kexec_file.o
8283
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
8384

8485
obj-$(CONFIG_JUMP_LABEL) += jump_label.o

0 commit comments

Comments
 (0)