[V2,0/2] riscv: kexec_file: Support loading Image binary file

Message ID 20231016092006.3347632-1-songshuaishuai@tinylab.org
Headers
Series riscv: kexec_file: Support loading Image binary file |

Message

Song Shuai Oct. 16, 2023, 9:20 a.m. UTC
  Changes since V1:
https://lore.kernel.org/linux-riscv/20230914020044.1397356-1-songshuaishuai@tinylab.org/

- Patch1: fix the build error due to the missing functions in machine_kexec_file.c
- Patch2: use FIELD_GET() to get the flags's endianness as Emil proposed
- Cover: update the kexec-tools link as this one[2] which is based on horms/kexec-tools main branch

This series makes the kexec_file_load() syscall support to load Image binary file.
At the same time, corresponding support for kexec-tools had been pushed to my repo[2].

Now, we can leverage that kexec-tools and this series to use the
kexec_load() or kexec_file_load() syscall to boot both vmlinux 
and Image file, as seen in these combo tests:

```
1. kexec -l vmlinux [other options] // or boot paniced kernel with -p
2. kexec -l Image
3. kexec -s -l vmlinux
4. kexec -s -l Image
```

Though all of the aforementioned tests had been passed in my RV64 Qemu-virt, 
it should be noted that tests 3 and 4 should be the emphasis for the current series.

~~[1]: https://github.com/sugarfillet/kexec-tools/commits/rv-Image~~
[2]: https://github.com/sugarfillet/kexec-tools/commits/main_rv

Song Shuai (2):
  riscv: kexec_file: Split the loading of kernel and others
  riscv: kexec_file: Support loading Image binary file

 arch/riscv/include/asm/kexec.h         |   6 +
 arch/riscv/kernel/Makefile             |   2 +-
 arch/riscv/kernel/elf_kexec.c          | 469 -------------------------
 arch/riscv/kernel/kexec_elf.c          | 147 ++++++++
 arch/riscv/kernel/kexec_image.c        |  98 ++++++
 arch/riscv/kernel/machine_kexec_file.c | 344 ++++++++++++++++++
 6 files changed, 596 insertions(+), 470 deletions(-)
 delete mode 100644 arch/riscv/kernel/elf_kexec.c
 create mode 100644 arch/riscv/kernel/kexec_elf.c
 create mode 100644 arch/riscv/kernel/kexec_image.c
  

Comments

Song Shuai Dec. 13, 2023, 10:26 a.m. UTC | #1
在 2023/10/16 17:20, Song Shuai 写道:
> Changes since V1:
> https://lore.kernel.org/linux-riscv/20230914020044.1397356-1-songshuaishuai@tinylab.org/
> 
> - Patch1: fix the build error due to the missing functions in machine_kexec_file.c
> - Patch2: use FIELD_GET() to get the flags's endianness as Emil proposed
> - Cover: update the kexec-tools link as this one[2] which is based on horms/kexec-tools main branch
ping ...
> 
> This series makes the kexec_file_load() syscall support to load Image binary file.
> At the same time, corresponding support for kexec-tools had been pushed to my repo[2].
> 
> Now, we can leverage that kexec-tools and this series to use the
> kexec_load() or kexec_file_load() syscall to boot both vmlinux
> and Image file, as seen in these combo tests:
> 
> ```
> 1. kexec -l vmlinux [other options] // or boot paniced kernel with -p
> 2. kexec -l Image
> 3. kexec -s -l vmlinux
> 4. kexec -s -l Image
> ```
> 
> Though all of the aforementioned tests had been passed in my RV64 Qemu-virt,
> it should be noted that tests 3 and 4 should be the emphasis for the current series.
> 
> ~~[1]: https://github.com/sugarfillet/kexec-tools/commits/rv-Image~~
> [2]: https://github.com/sugarfillet/kexec-tools/commits/main_rv
> 
> Song Shuai (2):
>    riscv: kexec_file: Split the loading of kernel and others
>    riscv: kexec_file: Support loading Image binary file
> 
>   arch/riscv/include/asm/kexec.h         |   6 +
>   arch/riscv/kernel/Makefile             |   2 +-
>   arch/riscv/kernel/elf_kexec.c          | 469 -------------------------
>   arch/riscv/kernel/kexec_elf.c          | 147 ++++++++
>   arch/riscv/kernel/kexec_image.c        |  98 ++++++
>   arch/riscv/kernel/machine_kexec_file.c | 344 ++++++++++++++++++
>   6 files changed, 596 insertions(+), 470 deletions(-)
>   delete mode 100644 arch/riscv/kernel/elf_kexec.c
>   create mode 100644 arch/riscv/kernel/kexec_elf.c
>   create mode 100644 arch/riscv/kernel/kexec_image.c
>