[PATCH 1/2] [Crash-utility] RISCV64: Dump NT_PRSTATUS in 'help -n'

2023-12-04 Thread Song Shuai
00 80822426 80822422 ff293f20 814ee2a8 ff6000104800 ff200027bb18 ``` Signed-off-by: Song Shu

[PATCH 2/2] [Crash-utility] RISCV64: Fix 'bt' output when no ra on the stack top

2023-12-04 Thread Song Shuai
013d80] vfs_write at 801b68b4 #5 [ff213e30] ksys_write at 801b6c4a #6 [ff213e80] __riscv_sys_write at 801b6cc4 #7 [ff213e90] do_trap_ecall_u at ffff80836798 crash> ``` Signed-off-by: Song Shuai --- riscv64.c | 15 +-- 1 file chang

[PATCH 2/2] riscv: kexec: Remove -fPIE for PURGATORY_CFLAGS

2023-10-11 Thread Song Shuai
: 39b33072941f ("riscv: Introduce CONFIG_RELOCATABLE") Signed-off-by: Song Shuai --- arch/riscv/purgatory/Makefile | 4 1 file changed, 4 insertions(+) diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile index 9e6476719abb..982fc8e77108 100644 --- a/arch/riscv/purgator

[PATCH 1/2] riscv: kexec: Cleanup riscv_kexec_relocate

2023-10-11 Thread Song Shuai
machine and works as it was. Signed-off-by: Song Shuai --- arch/riscv/kernel/kexec_relocate.S | 54 +- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/arch/riscv/kernel/kexec_relocate.S b/arch/riscv/kernel/kexec_relocate.S index 059c5e216ae7

[PATCH V2 0/2] riscv: kexec: cleanup and fixups

2023-10-11 Thread Song Shuai
ntry point of kernel at 0x8020 [ 880.388650] kexec_image: Unknown rela relocation: 20 [ 880.389173] kexec_image: Error loading purgatory ret=-8 So remove the -fPIE option for PURGATORY_CFLAGS to generate R_RISCV_PCREL_HI20 relocations type making puragtory work as it was. Song Shuai (2): ri

Re: [PATCH 0/7] Kexec-tools: Improve RISC-V port

2023-10-10 Thread Song Shuai
在 2023/9/20 19:56, Simon Horman 写道: On Fri, Sep 15, 2023 at 11:50:06AM +0800, Song Shuai wrote: Hi, This series is created to improve RISC-V port of kexec-tools, and is based on the horms/kexec-tools:build-test-riscv-v2 branch. In my mind the big question is how to move RISC-V support from

[PATCH makedumpfile V2 2/2] riscv64: Correct the pfn_start for flatmem

2023-10-10 Thread Song Shuai
To let info->max_mapnr indicate the direct max PFN and then make the kdump header's max_mapnr_64 correct, riscv64 port didn't define ARCH_PFN_OFFSET. As for FLATMEM type, the pfn region of mem_map_data should be adjusted to start from info->phys_base instead of zero. Signed-off-by: Song

[PATCH makedumpfile V2 0/2] Add riscv64 support for makedumpfile

2023-10-10 Thread Song Shuai
80096000 => 20026001 PTE: 80098000 => 20021ce7 PAGE: 80087000 PTE PHYSICAL FLAGS 20021ce7 80087000 (PRESENT|READ|WRITE|GLOBAL|ACCESSED|DIRTY) PAGE PHYSICAL MAPPING INDEX CNT FLAGS ff1c020021c0 800870000 0 1 0

[PATCH makedumpfile V2 1/2] Add riscv64 support

2023-10-10 Thread Song Shuai
This patch adds support for riscv64 in makedumpfile. It implements the "vtop" for kenrel memory regions and supports Sv39/Sv48/Sv57 page modes for RV64. Signed-off-by: Song Shuai --- Makefile | 2 +- arch/riscv64.c | 219 + make

Re: [PATCH makedumpfile 0/2] Add riscv64 support for makedumpfile

2023-10-06 Thread Song Shuai
在 2023/10/3 12:22, HAGIO KAZUHITO(萩尾 一仁) 写道: Hi, thank you for the patch. On 2023/09/27 20:18, Song Shuai wrote: These 2 patches add riscv64 support for makedumpfile: Patch1 - Add riscv64 support === This patch adds support for riscv64 in makedumpfile

[PATCH makedumpfile 2/2] riscv64: Correct the pfn_start for flatmem

2023-09-27 Thread Song Shuai
To let info->max_mapnr indicte the direct max PFN and then make the kdump header's max_mapnr_64 correct, riscv64 port didn't define ARCH_PFN_OFFSET. As for FLATMEM type, the pfn region of mem_map_data should be adjusted to start from info->phys_base instead of zero. Signed-off-by: Song

[PATCH makedumpfile 1/2] Add riscv64 support

2023-09-27 Thread Song Shuai
This patch adds support for riscv64 in makedumpfile. It implements the "vtop" for kenrel memory regions and supports Sv39/Sv48/Sv57 page modes for RV64. Signed-off-by: Song Shuai --- Makefile | 2 +- arch/riscv64.c | 219 + make

[PATCH makedumpfile 0/2] Add riscv64 support for makedumpfile

2023-09-27 Thread Song Shuai
20026001 PTE: 80098000 => 20021ce7 PAGE: 80087000 PTE PHYSICAL FLAGS 20021ce7 80087000 (PRESENT|READ|WRITE|GLOBAL|ACCESSED|DIRTY) PAGE PHYSICAL MAPPING INDEX CNT FLAGS ff1c020021c0 800870000 0 1 0 // same as the makedum

[PATCH 7/7] RISC-V: Support loading Image binary file

2023-09-14 Thread Song Shuai
Add image-riscv file_type to probe/load Image file type, As for kexec_load, find the pbase aligned text_offset from image header and prepare segments for this syscall. for kexec_file_load, setup the related options and let kernel part to deal with the Image. Signed-off-by: Song Shuai

[PATCH 6/7] RISC-V: Separate elf_riscv_find_pbase out

2023-09-14 Thread Song Shuai
The is the preparative patch for RISC-V kexec Image file support. Separate the elf_riscv_find_pbase() function out to allow kernel_load syscall load Image binary file. Signed-off-by: Song Shuai --- kexec/arch/riscv/kexec-elf-riscv.c | 72 +- kexec/arch/riscv/kexec

[PATCH 5/7] RISC-V: Enable kexe_file_load

2023-09-14 Thread Song Shuai
]: https://lore.kernel.org/all/20220408100914.150110-1-lizheng...@huawei.com/ Signed-off-by: Song Shuai --- kexec/arch/riscv/kexec-elf-riscv.c | 5 ++-- kexec/arch/riscv/kexec-riscv.c | 41 ++ kexec/arch/riscv/kexec-riscv.h | 1 + kexec/kexec-syscall.h

[PATCH 4/7] RISC-V: Correct the usage of command line option

2023-09-14 Thread Song Shuai
RISC-V process OPT_CMDLINE with the "command-line" partten, but the riscv_opts_usage shows the "cmdline" option. So correct the usage's output. Signed-off-by: Song Shuai --- kexec/arch/riscv/kexec-riscv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ke

[PATCH 3/7] RISC-V: Get memory ranges from iomem

2023-09-14 Thread Song Shuai
FI Runtime memory and fail the kexeced kernel to deal EFI stuff. In my test, the kexeced kernel warned "efi: System table signature incorrect!" and then paniced at efi_call_rts() due to the null efi.runtime. So we should use /proc/iomem to get memory ranges. Signed-off-by: Song Shuai -

[PATCH 2/7] RISC-V: Fix the undeclared ‘EM_RISCV’ build failure

2023-09-14 Thread Song Shuai
Use local `elf.h` instead of `linux/elf.h` to fix this build error: ``` kexec/arch/riscv/crashdump-riscv.c:17:13: error: ‘EM_RISCV’ undeclared here (not in a function); did you mean ‘EM_CRIS’? .machine = EM_RISCV, ^~~~ EM_CRIS ``` Signed-off-by: Song Shuai

[PATCH 1/7] RISC-V: Use linux,usable-memory-range for crash kernel

2023-09-14 Thread Song Shuai
ema/blob/main/dtschema/schemas/chosen.yaml Signed-off-by: Song Shuai --- kexec/arch/riscv/kexec-riscv.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kexec/arch/riscv/kexec-riscv.c b/kexec/arch/riscv/kexec-riscv.c index fe5dd2d..5aea035 100644 --- a/kexec/arch/riscv/kexec-

[PATCH 0/7] Kexec-tools: Improve RISC-V port

2023-09-14 Thread Song Shuai
://lore.kernel.org/linux-riscv/20230914020044.1397356-1-songshuaish...@tinylab.org/T/#t Li Zhengyu (1): RISC-V: Enable kexe_file_load Song Shuai (6): RISC-V: Use linux,usable-memory-range for crash kernel RISC-V: Fix the undeclared ‘EM_RISCV’ build failure RISC-V: Get memory ranges from iomem

[PATCH V1 2/3] riscv: kexec: Align the kexeced kernel entry

2023-09-07 Thread Song Shuai
("RISC-V: Support for kexec_file on panic") Signed-off-by: Song Shuai --- arch/riscv/kernel/elf_kexec.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c index 38390d3bdcac..bc7a00ff5c8b 100644 --- a/

[PATCH V1 3/3] riscv: kexec: Remove -fPIE for PURGATORY_CFLAGS

2023-09-07 Thread Song Shuai
: 39b33072941f ("riscv: Introduce CONFIG_RELOCATABLE") Signed-off-by: Song Shuai --- arch/riscv/purgatory/Makefile | 4 1 file changed, 4 insertions(+) diff --git a/arch/riscv/purgatory/Makefile b/arch/riscv/purgatory/Makefile index dc20e166983e..c2065d63945f 100644 --- a/arch/riscv/purgator

[PATCH V1 1/3] riscv: kexec: Cleanup riscv_kexec_relocate

2023-09-07 Thread Song Shuai
machine and works as it was. Signed-off-by: Song Shuai --- arch/riscv/kernel/kexec_relocate.S | 52 +- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/arch/riscv/kernel/kexec_relocate.S b/arch/riscv/kernel/kexec_relocate.S index 059c5e216ae7

[PATCH V1 0/3] riscv: kexec: cleanup and fixups

2023-09-07 Thread Song Shuai
1]: https://lore.kernel.org/linux-riscv/20230830063435.1105726-1-songshuaish...@tinylab.org/ [2]: https://lore.kernel.org/linux-riscv/20230906095817.364390-1-songshuaish...@tinylab.org/ [3]: https://github.com/sugarfillet/kexec-tools/tree/fix-riscv Song Shuai (3): riscv: kexec: Cleanup riscv_kexe

[Crash-utility PATCH V2] RISCV64: Add KASLR support

2023-08-18 Thread Song Shuai
From: Song Shuai This patch adds KASLR support for Crash to analyze KASLR-ed vmcore since RISC-V Linux is already sufficiently prepared for KASLR [1]. With this patch, even if the Crash '--kaslr' option is not set or Linux CONFIG_RANDOMIZE_BASE is not configured, the 'derive_kaslr_offset

[Crash-utility PATCH] RISCV64: Add KASLR support

2023-08-15 Thread Song Shuai
From: Song Shuai This patch adds KASLR support for Crash to analyze KASLR-ed vmcore since RISC-V Linux is already sufficiently prepared for KASLR [1]. With this patch, even if the Crash '--kaslr' option is not set or Linux CONFIG_RANDOMIZE_BASE is not configured, the 'derive_kaslr_offset

Re: [PATCH 1/2] RISC-V: Use linux,usable-memory-range for crash kernel

2023-08-14 Thread Song Shuai
在 2023/8/14 19:10, Conor Dooley 写道: On Fri, Aug 11, 2023 at 06:41:16PM +0800, Song Shuai wrote: Now we use "memeory::linux,usable-memory" to indicate the available memory for the crash kernel. While booting with UEFI, the crash kernel would use efi.memmap to re-populat

[PATCH 1/2] RISC-V: Use linux,usable-memory-range for crash kernel

2023-08-11 Thread Song Shuai
ema/blob/main/dtschema/schemas/chosen.yaml Signed-off-by: Song Shuai --- kexec/arch/riscv/kexec-riscv.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kexec/arch/riscv/kexec-riscv.c b/kexec/arch/riscv/kexec-riscv.c index fe5dd2d..5aea035 100644 --- a/kexec/arch/riscv/kexec-

[PATCH 2/2] RISC-V: Fix the undeclared ‘EM_RISCV’ build failure

2023-08-11 Thread Song Shuai
Use local `elf.h` instead of `linux/elf.h` to fix this build error: ``` kexec/arch/riscv/crashdump-riscv.c:17:13: error: ‘EM_RISCV’ undeclared here (not in a function); did you mean ‘EM_CRIS’? .machine = EM_RISCV, ^~~~ EM_CRIS ``` Signed-off-by: Song Shuai

Re: [Crash-utility] RISCV64: Use va_kernel_pa_offset in VTOP()

2023-08-04 Thread Song Shuai
在 2023/8/4 12:42, HAGIO KAZUHITO(萩尾 一仁) 写道: On 2023/07/24 13:06, Song Shuai wrote: Since RISC-V Linux v6.4, the commit 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping") changes the phys_ram_base from the kernel_map.phys_addr to the start of DRAM. The Crash's VT

[Crash-utility PATCH V2] RISCV64: Use va_kernel_pa_offset in VTOP()

2023-08-04 Thread Song Shuai
el virtual address, that made Crash boot failed with Linux v6.4 and later version. Let Linux export kernel_map.va_kernel_pa_offset in v6.5 and backported v6.4.0 stable, so Crash can use "va_kernel_pa_offset" to translate the kernel virtual address in VTOP() correctly. Signed-off-by: Son

[RESEND PATCH -fixes 1/2] riscv: Export va_kernel_pa_offset in vmcoreinfo

2023-07-24 Thread Song Shuai
rnel.org/linux-riscv/20230724040649.220279-1-suagrfil...@gmail.com/ [1] Signed-off-by: Song Shuai --- arch/riscv/kernel/crash_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/kernel/crash_core.c b/arch/riscv/kernel/crash_core.c index b351a3c01355..55f1d7856b54 100644 ---

[RESEND PATCH -fixes 2/2] Documentation: kdump: Add va_kernel_pa_offset for RISCV64

2023-07-24 Thread Song Shuai
://lore.kernel.org/linux-riscv/20230724040649.220279-1-suagrfil...@gmail.com/ Signed-off-by: Song Shuai --- Documentation/admin-guide/kdump/vmcoreinfo.rst | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/admin-guide/kdump/vmcoreinfo.rst b/Documentation/admin-guide/kdump/vmc

[PATCH -fixes 1/2] riscv: Export va_kernel_pa_offset in vmcoreinfo

2023-07-24 Thread Song Shuai
rnel.org/linux-riscv/20230724040649.220279-1-suagrfil...@gmail.com/ [1] Signed-off-by: Song Shuai --- arch/riscv/kernel/crash_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/kernel/crash_core.c b/arch/riscv/kernel/crash_core.c index b351a3c01355..55f1d7856b54 100644 ---

Re: [Crash-utility] RISCV64: Use va_kernel_pa_offset in VTOP()

2023-07-24 Thread Song Shuai
在 2023/7/24 16:13, Alexandre Ghiti 写道: Hi Song, On 24/07/2023 06:06, Song Shuai wrote: Since RISC-V Linux v6.4, the commit 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping") changes the phys_ram_base from the kernel_map.phys_addr to the start of DRAM. Mayb

Re: [Crash-utility] RISCV64: Use va_kernel_pa_offset in VTOP()

2023-07-24 Thread Song Shuai
在 2023/7/24 15:41, Conor Dooley 写道: Hey, On Mon, Jul 24, 2023 at 12:06:49PM +0800, Song Shuai wrote: Since RISC-V Linux v6.4, the commit 3335068f8721 ("riscv: Use PUD/P4D/PGD pages for the linear mapping") changes the phys_ram_base from the kernel_map.phys_addr to the sta

[Crash-utility] RISCV64: Use va_kernel_pa_offset in VTOP()

2023-07-23 Thread Song Shuai
al address, that made Crash boot failed with Linux v6.4 and later version. Let Linux export kernel_map.va_kernel_pa_offset in v6.5 and Crash can use "va_kernel_pa_offset" to translate the kernel virtual address in VTOP() correctly. Signed-off-by: Song Shuai --- You can check/test the Linux ch