PREEMPT_RT For RISC-V

This chapter mainly describes the application of PREEMPT_RT in StarFive JH-7110 SDK kernel (Linux kernel v5.15) for test only. If it comes to the implementation of industrial projects, using the kernel v6.6 LTS is more suitable, because RT-Linux has already supports the RISC-V architecture in the kernel 6.6 LTS, and most of the drivers for StarFiveJH-7110 can be found in kernel v6.6. Only needs to apply the RT-Linux patches on kernel v6.6 and compile the kernel containing the VisionFive 2 driver to use and test PREEMPT_RT.

The PREEMPT_RT patch already supports multiple architectures, and most of the important real-time functionality is implemented in architecture-independent kernel code. Therefore, it is safe to assume that these portions of the kernel are working correctly, and all changes required for RISC-V operation would have to be done only in architecture specific code. Within the Linux kernel source tree, this would include all files under the arch/riscv/ directory and every RISC-V specific driver in the drivers/ directory. The implemented changes to the Linux kernel are listed in Appendix A: Real-Time Linux Defconfig as a complete patch file.

This chapter discusses the different steps and modifications required when porting the basic functionality of the PREEMPT_RT patch to RISC-V architecture. First, in Patch Application, the process of applying the PREEMPT_RT patch to the mainline kernel source tree is presented. Finally, in LAZY_PREEMPT, RT-Linux configuration LAZY_PREEMPT is discussed.