Skip to content

kexec-tools RISC-V port

Björn Töpel kexec linux-riscv 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 2 repliesIn review
  2. v14 patches 4 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4RISC-V: Add support for riscv kexec/kdump on kexec-tools.github/workflows/build.yml configure.ac include/elf.h +14 more+1415 -10 replies
2/4RISC-V: Enable kexec_file_load syscallkexec/arch/riscv/kexec-elf-riscv.c kexec/arch/riscv/kexec-riscv.c kexec/arch/riscv/kexec-riscv.h +1 more+45 -30 replies
3/4RISC-V: Separate elf_riscv_find_pbase outkexec/arch/riscv/kexec-elf-riscv.c kexec/arch/riscv/kexec-riscv.c kexec/arch/riscv/kexec-riscv.h+69 -710 replies
4/4RISC-V: Support loading Image binary filekexec/arch/riscv/Makefile kexec/arch/riscv/image-header.h kexec/arch/riscv/kexec-image-riscv.c +2 more+193 -00 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by.

PatchYixun Lan
1/4T-b
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] kexec-tools RISC-V port

From: Björn Töpel <[email protected]>

Hi!

*Patch history*

v1: https://lore.kernel.org/kexec/[email protected]/
v2: Added Github Actions support for riscv64 (Simon)
Sorted filenames in Makefile (Simon)
Added missing dist files (Simon)
Fixed mips build (Simon)

Here's a passed CI run with this series on master:
https://github.com/bjoto/kexec-tools/actions/runs/14597988952/job/40948715214

*Cover*

This is an attempt to finally get the RISC-V patches for kexec-tools upstream.

Simon suggested in [1] that:

Quoted 6 lines

In my mind the big question is how to move RISC-V support from that branch, to being merged into main.

IIRC there were some issues that needed to be addressed. Perhaps they are all addressed by this series, and with some appropriate squashing we can move forwards with a series based on main?

I talked to Nick last week, and he suggested that we'd work the RISC-V collab Github [2], but I think it's just easier to do it on the list.

I've been collecting a number of different trees out there, and tried to group them in a series.

Given that there is not support for RISC-V upstream yet, I didn't see the need to carry all the fixes/updates ("development history") as separate commits -- it doesn't help bugtracking/bisectability.

Instead the first commit message is a big one, and tries to give attribution to all involved parties. Input/thoughts are very much welcome!

To properly test this on RISC-V, the upstream Linux kernel has most things in 6.15-rc1, e.g.:
commit 28093cfef5dd ("riscv/kexec_file: Handle R_RISCV_64 in purgatory relocator") commit 3f7023171df4 ("riscv/purgatory: 4B align purgatory_start")

To cross-build kexec-tools:

  | ./bootstrap 
  | ./configure --host=riscv64-linux-gnu
  | make

For some tests, additional kernel patches are needed, that as of today is not in 6.15-rc1:
* To test "kexec -s -l Image", kexec_file_load with Image support is needed [3]
* To test "kexec -c -l vmlinux" with CONFIG_RELOCATABLE, a kbuild fix is needed [4]
* Typically if you load initrd, or a large kernel [5] (since a bunch of Reserved regions are not properly exposed).

I've tested combinations with crashkernel (-p), and regular (-c/-s + -e) for:
* ACPI/UEFI
* DT/UEFI
* DT
* w/ initrd
* w/o initrd
* ELF (userland loader + kexec_load, and kexec_file_load)
* Image (userland loader + kexec_load, and kexec_file_load)

I'm sure there are combinations I've missed, but at least from my POV we're in a pretty good shape.

All authors: Please let me know if you prefer another split of the patches. Or something else for that matter! ;-)

Let's get the ball rolling!
Björn

[1] https://lore.kernel.org/kexec/[email protected]/
[2] https://github.com/riscv-collab/kexec-tools.git
[3] https://lore.kernel.org/linux-riscv/[email protected]/
[4] https://lore.kernel.org/linux-riscv/[email protected]/
[5] https://lore.kernel.org/linux-riscv/[email protected]/

Li Zhengyu (1):
RISC-V: Enable kexec_file_load syscall

Nick Kossifidis (1):
RISC-V: Add support for riscv kexec/kdump on kexec-tools

Song Shuai (2):
RISC-V: Separate elf_riscv_find_pbase out
RISC-V: Support loading Image binary file

 .github/workflows/build.yml             |   1 +
 configure.ac                            |   3 +
 include/elf.h                           |   1 +
 kexec/Makefile                          |   1 +
 kexec/arch/mips/Makefile                |   2 +
 kexec/arch/riscv/Makefile               |  38 ++
 kexec/arch/riscv/crashdump-riscv.c      | 140 +++++++
 kexec/arch/riscv/image-header.h         |  88 ++++
 kexec/arch/riscv/include/arch/options.h |  43 ++
 kexec/arch/riscv/iomem.h                |  10 +
 kexec/arch/riscv/kexec-elf-riscv.c      | 184 +++++++++
 kexec/arch/riscv/kexec-image-riscv.c    |  95 +++++
 kexec/arch/riscv/kexec-riscv.c          | 526 ++++++++++++++++++++++++
 kexec/arch/riscv/kexec-riscv.h          |  53 +++
 kexec/dt-ops.c                          | 442 +++++++++++++++++++-
 kexec/dt-ops.h                          |   7 +
 kexec/kexec-syscall.h                   |   7 +
 purgatory/Makefile                      |   1 +
 purgatory/arch/riscv/Makefile           |   7 +
 19 files changed, 1648 insertions(+), 1 deletion(-)
 create mode 100644 kexec/arch/riscv/Makefile
 create mode 100644 kexec/arch/riscv/crashdump-riscv.c
 create mode 100644 kexec/arch/riscv/image-header.h
 create mode 100644 kexec/arch/riscv/include/arch/options.h
 create mode 100644 kexec/arch/riscv/iomem.h
 create mode 100644 kexec/arch/riscv/kexec-elf-riscv.c
 create mode 100644 kexec/arch/riscv/kexec-image-riscv.c
 create mode 100644 kexec/arch/riscv/kexec-riscv.c
 create mode 100644 kexec/arch/riscv/kexec-riscv.h
 create mode 100644 purgatory/arch/riscv/Makefile

base-commit: 14f48ea80e510e5af79ca6c46fa28e99a3695d1c

Signature · 1 line
2.48.1