[PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools

Simon Horman horms at kernel.org
Fri Oct 21 08:27:10 PDT 2022


On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote:
> From: Nick Kossifidis <mick at ics.forth.gr>
> 
> This patch adds support for loading the ELF kernel image. It parses
> the current/provided device tree to determine the system's memory
> layout, and /proc/iomem for the various kernel segments.
> 
> This patch was firstly developed by Nick Kossifidis, and two fixes (
>    1: fail to find free memory area for dtb load when using initrd image,
>       lists.infradead.org/pipermail/linux-riscv/2022-August/018398.html;
>    2: fix memory range size calculation,
>        kexec/arch/riscv/crashdump-riscv.c:line 85
> ) are contributed by Yixun Lan, Xianting Tian.
> 
> Tested on Qemu's rv64 virt machine and SoC of T-Head RISC-V Xuantie 910 CPU.

Hi,

thanks for some patch.

Some minor feedback follows.

Separately, I'll post a patch to add RISC-V builds to the github
workflow. If you could include that in V3 I'd be most grateful.

> 
> Tested-by: Yixun Lan <yixun.lan at gmail.com>
> Co-developed-by: Xianting Tian <xianting.tian at linux.alibaba.com>
> Co-developed-by: Yixun Lan <yixun.lan at gmail.com>
> Signed-off-by: Nick Kossifidis <mick at ics.forth.gr>

...

> +	ret = mem_regions_alloc_and_add(mem_ranges, start,
> +					end - start, type);

mem_regions_alloc_and_add isn't always available.
f.e. on mips this causes a build failure.

Ref: https://github.com/horms/kexec-tools/actions/runs/3298491143/jobs/5440677595

...

> +int dtb_get_memory_ranges(char *dtb, struct memory_ranges *mem_ranges, struct memory_ranges *extra_ranges)
> +{

...

> +	mem_regions_sort(mem_ranges);

Likewise, mem_regions_sort isn't always available.
f.e. on mips this causes a build failure.

...

> diff --git a/purgatory/arch/riscv/Makefile b/purgatory/arch/riscv/Makefile
> new file mode 100644
> index 0000000..8bded71
> --- /dev/null
> +++ b/purgatory/arch/riscv/Makefile
> @@ -0,0 +1,7 @@
> +#
> +# Purgatory riscv
> +#
> +
> +riscv_PURGATORY_SRCS =
> +
> +dist += purgatory/arch/sh/Makefile $(riscv_PURGATORY_SRCS)

s/sh/riscv/

Else the distribution tarball won't include this Makefile

You can exercise this using:
  make distcheck DISTCHECK_CONFIGURE_FLAGS="--host=riscv64-linux-gnu"



More information about the kexec mailing list