Re: [PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
On Tue, 18 Jul 2023 17:40:17 +0800 Xianting Tian wrote: > 在 2023/7/18 下午5:37, Petr Tesařík 写道: > > On Mon, 27 Mar 2023 16:27:56 +0800 > > Guo Ren wrote: > > > >> F.Y.I > >> > >> xianting_...@126.com > >> > >> On Mon, Mar 27, 2023 at 9:52 AM Baoquan He wrote: > >>> Hi Xianting, > >>> > >>> On 10/26/22 at 10:59am, Xianting Tian wrote: > 在 2022/10/26 上午10:13, Xianting Tian 写道: > > Hi Simon > > > > thanks for the comments > > > > 在 2022/10/21 下午11:27, Simon Horman 写道: > >> On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote: > >>> From: Nick Kossifidis > >>> > >>> 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 > >>> Co-developed-by: Xianting Tian > >>> Co-developed-by: Yixun Lan > >>> Signed-off-by: Nick Kossifidis > >> ... > >> > >>> +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 > >> > > As you know, mem_regions_sort, mem_regions_alloc_and_add are the common > > funtions, > > > > The build error of mips is caused by this riscv patch? > > > > kexec/mem_regions.c:void mem_regions_sort(struct memory_ranges *ranges) > > kexec/mem_regions.h:void mem_regions_sort(struct memory_ranges *ranges); > > > > > > kexec/mem_regions.c:int mem_regions_alloc_and_add(struct memory_ranges > > *ranges, > > kexec/mem_regions.h:int mem_regions_alloc_and_add(struct memory_ranges > > *ranges, > > > >> ... > >> > >>> +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 000..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" > > thanks, I will fix this. > the fix is in my personal gitee > > https://gitee.com/xianting-tian/kexec-tools/commits/master > >>> Is this patchset reposting still in your working plan? I don't see the > >>> code in kexe-tools, so ping to ask. > >>> > >>> If this is not your work tasks any more, people interested can pick this > >>> patchset and post after polishing. > > Now it seems I am interested. FYI my plan is to start working on this > > if there is no further reaction from anybody else within a fortnight. > Good, please feel free to do it. Oh, thank you for your quick answer! Good. Cloned from Gitee, rebasing, testing... Petr T ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
在 2023/7/18 下午5:37, Petr Tesařík 写道: On Mon, 27 Mar 2023 16:27:56 +0800 Guo Ren wrote: F.Y.I xianting_...@126.com On Mon, Mar 27, 2023 at 9:52 AM Baoquan He wrote: Hi Xianting, On 10/26/22 at 10:59am, Xianting Tian wrote: 在 2022/10/26 上午10:13, Xianting Tian 写道: Hi Simon thanks for the comments 在 2022/10/21 下午11:27, Simon Horman 写道: On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote: From: Nick Kossifidis 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 Co-developed-by: Xianting Tian Co-developed-by: Yixun Lan Signed-off-by: Nick Kossifidis ... +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 As you know, mem_regions_sort, mem_regions_alloc_and_add are the common funtions, The build error of mips is caused by this riscv patch? kexec/mem_regions.c:void mem_regions_sort(struct memory_ranges *ranges) kexec/mem_regions.h:void mem_regions_sort(struct memory_ranges *ranges); kexec/mem_regions.c:int mem_regions_alloc_and_add(struct memory_ranges *ranges, kexec/mem_regions.h:int mem_regions_alloc_and_add(struct memory_ranges *ranges, ... +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 000..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" thanks, I will fix this. the fix is in my personal gitee https://gitee.com/xianting-tian/kexec-tools/commits/master Is this patchset reposting still in your working plan? I don't see the code in kexe-tools, so ping to ask. If this is not your work tasks any more, people interested can pick this patchset and post after polishing. Now it seems I am interested. FYI my plan is to start working on this if there is no further reaction from anybody else within a fortnight. Good, please feel free to do it. Petr T ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
On Mon, 27 Mar 2023 16:27:56 +0800 Guo Ren wrote: > F.Y.I > > xianting_...@126.com > > On Mon, Mar 27, 2023 at 9:52 AM Baoquan He wrote: > > > > Hi Xianting, > > > > On 10/26/22 at 10:59am, Xianting Tian wrote: > > > > > > 在 2022/10/26 上午10:13, Xianting Tian 写道: > > > > Hi Simon > > > > > > > > thanks for the comments > > > > > > > > 在 2022/10/21 下午11:27, Simon Horman 写道: > > > > > On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote: > > > > > > From: Nick Kossifidis > > > > > > > > > > > > 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 > > > > > > Co-developed-by: Xianting Tian > > > > > > Co-developed-by: Yixun Lan > > > > > > Signed-off-by: Nick Kossifidis > > > > > ... > > > > > > > > > > > +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 > > > > > > > > > > > > > As you know, mem_regions_sort, mem_regions_alloc_and_add are the common > > > > funtions, > > > > > > > > The build error of mips is caused by this riscv patch? > > > > > > > > kexec/mem_regions.c:void mem_regions_sort(struct memory_ranges *ranges) > > > > kexec/mem_regions.h:void mem_regions_sort(struct memory_ranges *ranges); > > > > > > > > > > > > kexec/mem_regions.c:int mem_regions_alloc_and_add(struct memory_ranges > > > > *ranges, > > > > kexec/mem_regions.h:int mem_regions_alloc_and_add(struct memory_ranges > > > > *ranges, > > > > > > > > > > > > > > ... > > > > > > > > > > > +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 000..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" > > > > thanks, I will fix this. > > > > > > the fix is in my personal gitee > > > > > > https://gitee.com/xianting-tian/kexec-tools/commits/master > > > > Is this patchset reposting still in your working plan? I don't see the > > code in kexe-tools, so ping to ask. > > > > If this is not your work tasks any more, people interested can pick this > > patchset and post after polishing. Now it seems I am interested. FYI my plan is to start working on this if there is no further reaction from anybody else within a fortnight. Petr T ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
F.Y.I xianting_...@126.com On Mon, Mar 27, 2023 at 9:52 AM Baoquan He wrote: > > Hi Xianting, > > On 10/26/22 at 10:59am, Xianting Tian wrote: > > > > 在 2022/10/26 上午10:13, Xianting Tian 写道: > > > Hi Simon > > > > > > thanks for the comments > > > > > > 在 2022/10/21 下午11:27, Simon Horman 写道: > > > > On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote: > > > > > From: Nick Kossifidis > > > > > > > > > > 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 > > > > > Co-developed-by: Xianting Tian > > > > > Co-developed-by: Yixun Lan > > > > > Signed-off-by: Nick Kossifidis > > > > ... > > > > > > > > > +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 > > > > > > As you know, mem_regions_sort, mem_regions_alloc_and_add are the common > > > funtions, > > > > > > The build error of mips is caused by this riscv patch? > > > > > > kexec/mem_regions.c:void mem_regions_sort(struct memory_ranges *ranges) > > > kexec/mem_regions.h:void mem_regions_sort(struct memory_ranges *ranges); > > > > > > > > > kexec/mem_regions.c:int mem_regions_alloc_and_add(struct memory_ranges > > > *ranges, > > > kexec/mem_regions.h:int mem_regions_alloc_and_add(struct memory_ranges > > > *ranges, > > > > > > > > > > > ... > > > > > > > > > +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 000..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" > > > thanks, I will fix this. > > > > the fix is in my personal gitee > > > > https://gitee.com/xianting-tian/kexec-tools/commits/master > > Is this patchset reposting still in your working plan? I don't see the > code in kexe-tools, so ping to ask. > > If this is not your work tasks any more, people interested can pick this > patchset and post after polishing. > > Thanks > Baoquan > -- Best Regards Guo Ren ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
Hi Xianting, On 10/26/22 at 10:59am, Xianting Tian wrote: > > 在 2022/10/26 上午10:13, Xianting Tian 写道: > > Hi Simon > > > > thanks for the comments > > > > 在 2022/10/21 下午11:27, Simon Horman 写道: > > > On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote: > > > > From: Nick Kossifidis > > > > > > > > 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 > > > > Co-developed-by: Xianting Tian > > > > Co-developed-by: Yixun Lan > > > > Signed-off-by: Nick Kossifidis > > > ... > > > > > > > + 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 > > > > As you know, mem_regions_sort, mem_regions_alloc_and_add are the common > > funtions, > > > > The build error of mips is caused by this riscv patch? > > > > kexec/mem_regions.c:void mem_regions_sort(struct memory_ranges *ranges) > > kexec/mem_regions.h:void mem_regions_sort(struct memory_ranges *ranges); > > > > > > kexec/mem_regions.c:int mem_regions_alloc_and_add(struct memory_ranges > > *ranges, > > kexec/mem_regions.h:int mem_regions_alloc_and_add(struct memory_ranges > > *ranges, > > > > > > > > ... > > > > > > > +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 000..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" > > thanks, I will fix this. > > the fix is in my personal gitee > > https://gitee.com/xianting-tian/kexec-tools/commits/master Is this patchset reposting still in your working plan? I don't see the code in kexe-tools, so ping to ask. If this is not your work tasks any more, people interested can pick this patchset and post after polishing. Thanks Baoquan ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
On Wed, Oct 26, 2022 at 10:13:48AM +0800, Xianting Tian wrote: > Hi Simon > > thanks for the comments > > 在 2022/10/21 下午11:27, Simon Horman 写道: > > On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote: > > > From: Nick Kossifidis > > > > > > 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 > > > Co-developed-by: Xianting Tian > > > Co-developed-by: Yixun Lan > > > Signed-off-by: Nick Kossifidis > > ... > > > > > + 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 > > As you know, mem_regions_sort, mem_regions_alloc_and_add are the common > funtions, > > The build error of mips is caused by this riscv patch? Yes, I think so. The workflow passes on main: https://github.com/horms/kexec-tools/actions/runs/3344523519 But not with the riscv patch applied: https://github.com/horms/kexec-tools/tree/build-test-riscv-v2 > kexec/mem_regions.c:void mem_regions_sort(struct memory_ranges *ranges) > kexec/mem_regions.h:void mem_regions_sort(struct memory_ranges *ranges); > > > kexec/mem_regions.c:int mem_regions_alloc_and_add(struct memory_ranges > *ranges, > kexec/mem_regions.h:int mem_regions_alloc_and_add(struct memory_ranges > *ranges, > > > > > ... > > > > > +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 000..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" > thanks, I will fix this. Thanks. ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
在 2022/10/26 上午10:13, Xianting Tian 写道: Hi Simon thanks for the comments 在 2022/10/21 下午11:27, Simon Horman 写道: On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote: From: Nick Kossifidis 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 Co-developed-by: Xianting Tian Co-developed-by: Yixun Lan Signed-off-by: Nick Kossifidis ... + 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 As you know, mem_regions_sort, mem_regions_alloc_and_add are the common funtions, The build error of mips is caused by this riscv patch? kexec/mem_regions.c:void mem_regions_sort(struct memory_ranges *ranges) kexec/mem_regions.h:void mem_regions_sort(struct memory_ranges *ranges); kexec/mem_regions.c:int mem_regions_alloc_and_add(struct memory_ranges *ranges, kexec/mem_regions.h:int mem_regions_alloc_and_add(struct memory_ranges *ranges, ... +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 000..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" thanks, I will fix this. the fix is in my personal gitee https://gitee.com/xianting-tian/kexec-tools/commits/master ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
Hi Simon thanks for the comments 在 2022/10/21 下午11:27, Simon Horman 写道: On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote: From: Nick Kossifidis 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 Co-developed-by: Xianting Tian Co-developed-by: Yixun Lan Signed-off-by: Nick Kossifidis ... + 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 As you know, mem_regions_sort, mem_regions_alloc_and_add are the common funtions, The build error of mips is caused by this riscv patch? kexec/mem_regions.c:void mem_regions_sort(struct memory_ranges *ranges) kexec/mem_regions.h:void mem_regions_sort(struct memory_ranges *ranges); kexec/mem_regions.c:int mem_regions_alloc_and_add(struct memory_ranges *ranges, kexec/mem_regions.h:int mem_regions_alloc_and_add(struct memory_ranges *ranges, ... +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 000..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" thanks, I will fix this. ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
On Thu, Oct 20, 2022 at 11:15:48AM +0800, Xianting Tian wrote: > From: Nick Kossifidis > > 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 > Co-developed-by: Xianting Tian > Co-developed-by: Yixun Lan > Signed-off-by: Nick Kossifidis ... > + 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 000..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" ___ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
[PATCH V2] RISC-V: Add support for riscv kexec/kdump on kexec-tools
From: Nick Kossifidis 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. Tested-by: Yixun Lan Co-developed-by: Xianting Tian Co-developed-by: Yixun Lan Signed-off-by: Nick Kossifidis --- Changes V1 -> V2: 1, Rebase the patch to latest kexec code. 2, Set patch author Nick Kossifidis. configure.ac| 3 + include/elf.h | 1 + kexec/Makefile | 1 + kexec/arch/riscv/Makefile | 35 ++ kexec/arch/riscv/crashdump-riscv.c | 140 kexec/arch/riscv/include/arch/options.h | 43 +++ kexec/arch/riscv/kexec-elf-riscv.c | 255 ++ kexec/arch/riscv/kexec-riscv.c | 365 +++ kexec/arch/riscv/kexec-riscv.h | 32 ++ kexec/dt-ops.c | 442 +++- kexec/dt-ops.h | 7 + kexec/kexec-syscall.h | 4 + purgatory/Makefile | 1 + purgatory/arch/riscv/Makefile | 7 + 14 files changed, 1335 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/include/arch/options.h create mode 100644 kexec/arch/riscv/kexec-elf-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 diff --git a/configure.ac b/configure.ac index d081c82..9204c37 100644 --- a/configure.ac +++ b/configure.ac @@ -61,6 +61,9 @@ case $target_cpu in loongarch*) ARCH="loongarch" ;; + riscv32|riscv64) + ARCH="riscv" + ;; * ) AC_MSG_ERROR([unsupported architecture $target_cpu]) ;; diff --git a/include/elf.h b/include/elf.h index 1c8d2cc..93a5ee5 100644 --- a/include/elf.h +++ b/include/elf.h @@ -259,6 +259,7 @@ typedef struct #define EM_ARC_A5 93 /* ARC Cores Tangent-A5 */ #define EM_XTENSA 94 /* Tensilica Xtensa Architecture */ #define EM_AARCH64 183 /* ARM AARCH64 */ +#define EM_RISCV 243 /* RISC-V */ #define EM_LOONGARCH 258 /* Loongson Loongarch*/ #define EM_NUM 184 diff --git a/kexec/Makefile b/kexec/Makefile index 8a52e8d..405864a 100644 --- a/kexec/Makefile +++ b/kexec/Makefile @@ -88,6 +88,7 @@ include $(srcdir)/kexec/arch/mips/Makefile include $(srcdir)/kexec/arch/cris/Makefile include $(srcdir)/kexec/arch/ppc/Makefile include $(srcdir)/kexec/arch/ppc64/Makefile +include $(srcdir)/kexec/arch/riscv/Makefile include $(srcdir)/kexec/arch/s390/Makefile include $(srcdir)/kexec/arch/sh/Makefile include $(srcdir)/kexec/arch/x86_64/Makefile diff --git a/kexec/arch/riscv/Makefile b/kexec/arch/riscv/Makefile new file mode 100644 index 000..f26cc90 --- /dev/null +++ b/kexec/arch/riscv/Makefile @@ -0,0 +1,35 @@ +# +# kexec riscv +# +riscv_KEXEC_SRCS = kexec/arch/riscv/kexec-riscv.c +riscv_KEXEC_SRCS += kexec/arch/riscv/kexec-elf-riscv.c +riscv_KEXEC_SRCS += kexec/arch/riscv/crashdump-riscv.c + +riscv_MEM_REGIONS = kexec/mem_regions.c + +riscv_DT_OPS += kexec/dt-ops.c + +riscv_ARCH_REUSE_INITRD = + +riscv_CPPFLAGS += -I $(srcdir)/kexec/ + +dist += kexec/arch/riscv/Makefile $(riscv_KEXEC_SRCS) \ + kexec/arch/riscv/kexec-riscv.h \ + kexec/arch/riscv/include/arch/options.h + +ifdef HAVE_LIBFDT + +LIBS += -lfdt + +else + +include $(srcdir)/kexec/libfdt/Makefile.libfdt + +libfdt_SRCS += $(LIBFDT_SRCS:%=kexec/libfdt/%) + +riscv_CPPFLAGS += -I$(srcdir)/kexec/libfdt + +riscv_KEXEC_SRCS += $(libfdt_SRCS) + +endif + diff --git a/kexec/arch/riscv/crashdump-riscv.c b/kexec/arch/riscv/crashdump-riscv.c new file mode 100644 index 000..3ed4fe3 --- /dev/null +++ b/kexec/arch/riscv/crashdump-riscv.c @@ -0,0 +1,140 @@ +#include +#include +#include + +#include "kexec.h" +#include "crashdump.h" +#include "kexec-elf.h" +#include "mem_regions.h" + +static struct crash_elf_info elf_info = { +#if __riscv_xlen == 64 + .class = ELFCLASS64, +#else + .class = ELFCLASS32, +#endif + .data = ELFDATA2LSB, + .machine= EM_RISCV, +}; + +static struct memory_ranges crash_mem_ranges = {0}; +struct