RISC-V updates for v7.2-rc2

- Fix a crash when a kretprobe reads from the stack
 
 - Fix an issue with the build-time mcount sorter that broke ftrace
 
 - Fix the rv32 IRQ stack frame padding to match the ABI
 
 - Only defer IOMMU configuration during initialization.  This avoids
   an issue where IOMMU configuration could be indefinitely deferred
 
 - Add the missing build salt to the vDSO
 
 - Now that RISC-V systems with higher numbers of cores are starting to
   become available, raise NR_CPUS for RISC-V to 256
 
 - Clean up some warnings from sparse caused by the RISC-V-optimized
   RAID6 code
 
 - Clean up our __cpu_up() code with a few minor fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEElRDoIDdEz9/svf2Kx4+xDQu9KksFAmpH+BAACgkQx4+xDQu9
 Kkt2BxAAkHACbEzUDBJnhKL+Ce39S4QzNb+5iE25t7cUrpkK2ArYMBCd5Zir0Q+E
 WIP1nmDYsE9z6fNa8CncIEY6CnNBNDRK2eR7BiUM+tOhS5jMqvctb7LxkIGgbh3/
 VuNCw0NIavQ5zMqdVHQVzfIS+PojysZVnSQ3CwAHV1hgKO0p1FVozfv3N+TWBHjL
 hMCGxCNxIQaDXFKLSYlOh4fJEgpyznRo/YNybmugCAe8HqY2RyOgWhm62ipL0kcP
 OAjpKRIJ9o4CCaC+F3TNGjubw2I+AkEf8rMbw1KDuzwDI2HmsubMyFS/LHrhM0D7
 VhSjxu3DxJT7ObM4ID07hjywWTRAfmwI0AokajYmBPqVi3t+erJnAU2ayExnFmg9
 PWN53BbEMg+T2W5ym7arhWz28MdHoATviwEy1gLgaJbQtAQJDzK1FQ9in5m+AJAe
 QAO6O04bS+PUOz4orlGMDa7bLnHQucLKNvkI7EkXdS47yYPvs6OwOX1EjfMkM1TE
 O+36Uc6FSAEoO3nN5QGhV2OUegPyKm8lSJhqfftK4qBSd7Ffd9Mpsw9APCj/75ay
 uZ2yvllHli+SLo/xgOs/oFFUTrID1LUmwDzU7K1tr11hI2AV2BZ4aA1h3B6LbVt9
 Tz3vxaOC4DEx9owhQRaFgo13KvSYAAz4QYAwr1EMPHtDMRxu6k8=
 =qgfC
 -----END PGP SIGNATURE-----

Merge tag 'riscv-for-linus-7.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Paul Walmsley:

 - Fix a crash when a kretprobe reads from the stack

 - Fix an issue with the build-time mcount sorter that broke ftrace

 - Fix the rv32 IRQ stack frame padding to match the ABI

 - Only defer IOMMU configuration during initialization. This avoids an
   issue where IOMMU configuration could be indefinitely deferred

 - Add the missing build salt to the vDSO

 - Now that RISC-V systems with higher numbers of cores are starting to
   become available, raise NR_CPUS for RISC-V to 256

 - Clean up some warnings from sparse caused by the RISC-V-optimized
   RAID6 code

 - Clean up our __cpu_up() code with a few minor fixes

* tag 'riscv-for-linus-7.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: probes: save original sp in rethook trampoline
  riscv: Fix 32-bit call_on_irq_stack() frame pointer ABI
  scripts/sorttable: Handle RISC-V patchable ftrace entries
  riscv: smp: use secs_to_jiffies in __cpu_up
  ACPI: RIMT: Only defer the IOMMU configuration in init stage
  riscv: Add build salt to the vDSO
  raid6: fix raid6_recov_rvv symbol undeclared warning
  raid6: fix riscv symbol undeclared warnigns
  riscv: Raise default NR_CPUS for 64BIT to 256
This commit is contained in:
Linus Torvalds 2026-07-03 15:07:24 -10:00
commit 590cae7152
10 changed files with 30 additions and 16 deletions

View File

@ -454,7 +454,8 @@ config NR_CPUS
range 2 32 if RISCV_SBI_V01 && 32BIT
range 2 64 if RISCV_SBI_V01 && 64BIT
default "32" if 32BIT
default "64" if 64BIT
default "64" if RISCV_SBI_V01 && 64BIT
default "256" if !RISCV_SBI_V01 && 64BIT
config HOTPLUG_CPU
bool "Support for hot-pluggable CPUs"

View File

@ -501,8 +501,8 @@ void asm_offsets(void)
OFFSET(SBI_HART_BOOT_STACK_PTR_OFFSET, sbi_hart_boot_data, stack_ptr);
DEFINE(STACKFRAME_SIZE_ON_STACK, ALIGN(sizeof(struct stackframe), STACK_ALIGN));
OFFSET(STACKFRAME_FP, stackframe, fp);
OFFSET(STACKFRAME_RA, stackframe, ra);
DEFINE(STACKFRAME_FP, offsetof(struct stackframe, fp) - sizeof(struct stackframe));
DEFINE(STACKFRAME_RA, offsetof(struct stackframe, ra) - sizeof(struct stackframe));
#ifdef CONFIG_FUNCTION_TRACER
DEFINE(FTRACE_OPS_FUNC, offsetof(struct ftrace_ops, func));
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS

View File

@ -386,8 +386,8 @@ SYM_CODE_END(ret_from_fork_user_asm)
SYM_FUNC_START(call_on_irq_stack)
/* Create a frame record to save ra and s0 (fp) */
addi sp, sp, -STACKFRAME_SIZE_ON_STACK
REG_S ra, STACKFRAME_RA(sp)
REG_S s0, STACKFRAME_FP(sp)
REG_S ra, (STACKFRAME_SIZE_ON_STACK + STACKFRAME_RA)(sp)
REG_S s0, (STACKFRAME_SIZE_ON_STACK + STACKFRAME_FP)(sp)
addi s0, sp, STACKFRAME_SIZE_ON_STACK
/* Switch to the per-CPU shadow call stack */
@ -405,8 +405,8 @@ SYM_FUNC_START(call_on_irq_stack)
/* Switch back to the thread stack and restore ra and s0 */
addi sp, s0, -STACKFRAME_SIZE_ON_STACK
REG_L ra, STACKFRAME_RA(sp)
REG_L s0, STACKFRAME_FP(sp)
REG_L ra, (STACKFRAME_SIZE_ON_STACK + STACKFRAME_RA)(sp)
REG_L s0, (STACKFRAME_SIZE_ON_STACK + STACKFRAME_FP)(sp)
addi sp, sp, STACKFRAME_SIZE_ON_STACK
ret

View File

@ -41,6 +41,9 @@
REG_S x29, PT_T4(sp)
REG_S x30, PT_T5(sp)
REG_S x31, PT_T6(sp)
/* save original sp */
addi a0, sp, PT_SIZE_ON_STACK
REG_S a0, PT_SP(sp)
.endm
.macro restore_all_base_regs

View File

@ -189,13 +189,12 @@ int arch_cpuhp_kick_ap_alive(unsigned int cpu, struct task_struct *tidle)
#else
int __cpu_up(unsigned int cpu, struct task_struct *tidle)
{
int ret = 0;
int ret;
tidle->thread_info.cpu = cpu;
ret = start_secondary_cpu(cpu, tidle);
if (!ret) {
wait_for_completion_timeout(&cpu_running,
msecs_to_jiffies(1000));
wait_for_completion_timeout(&cpu_running, secs_to_jiffies(1));
if (!cpu_online(cpu)) {
pr_crit("CPU%u: failed to come online\n", cpu);

View File

@ -4,6 +4,7 @@
* Here we can supply some information useful to userland.
*/
#include <linux/build-salt.h>
#include <linux/elfnote.h>
#include <linux/version.h>
#include <asm/assembler.h>
@ -12,4 +13,6 @@ ELFNOTE_START(Linux, 0, "a")
.long LINUX_VERSION_CODE
ELFNOTE_END
BUILD_SALT
emit_riscv_feature_1_and

View File

@ -9,6 +9,7 @@
#include <linux/acpi.h>
#include <linux/acpi_rimt.h>
#include <linux/device/driver.h>
#include <linux/iommu.h>
#include <linux/list.h>
#include <linux/pci.h>
@ -257,11 +258,11 @@ static int rimt_iommu_xlate(struct device *dev, struct acpi_rimt_node *node, u32
rimt_fwnode = rimt_get_fwnode(node);
/*
* The IOMMU drivers may not be probed yet.
* Defer the IOMMU configuration
* The IOMMU drivers may not be probed yet. Defer the IOMMU
* configuration if it's still in initialization stage.
*/
if (!rimt_fwnode)
return -EPROBE_DEFER;
return driver_deferred_probe_check_state(dev);
/*
* EPROBE_DEFER ensures IOMMU is probed before the devices that

View File

@ -8,6 +8,7 @@
#include <linux/raid/pq.h>
#include "algos.h"
#include "rvv.h"
#include "pq_arch.h"
static void __raid6_2data_recov_rvv(int bytes, u8 *p, u8 *q, u8 *dp,
u8 *dq, const u8 *pbmul,

View File

@ -10,6 +10,7 @@
*/
#include "rvv.h"
#include "pq_arch.h"
#ifdef __riscv_vector
#error "This code must be built without compiler support for vector"

View File

@ -891,17 +891,22 @@ static int do_file(char const *const fname, void *addr)
table_sort_t custom_sort = NULL;
switch (elf_map_machine(ehdr)) {
case EM_AARCH64:
#ifdef MCOUNT_SORT_ENABLED
case EM_AARCH64:
/* arm64 also needs RELA-based weak-function fixups. */
sort_reloc = true;
rela_type = 0x403;
/* arm64 uses patchable function entry placing before function */
/* fallthrough */
case EM_RISCV:
/* arm64 and RISC-V place patchable entries before the function. */
before_func = 8;
#else
case EM_AARCH64:
case EM_RISCV:
#endif
/* fallthrough */
case EM_386:
case EM_LOONGARCH:
case EM_RISCV:
case EM_S390:
case EM_X86_64:
custom_sort = sort_relative_table_with_data;