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

Pull RISC-V fixes from Palmer Dabbelt:
"A handful of RISC-V related fixes:

- avoid errors when the stack tracing code is tracing itself.

- resurrect the memtest= kernel command line argument on RISC-V,
which was briefly enabled during the merge window before a
refactoring disabled it.

- build fix and some warning cleanups"

* tag 'riscv-for-linus-5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
riscv: kexec: Fix W=1 build warnings
riscv: kprobes: Fix build error when MMU=n
riscv: Select ARCH_USE_MEMTEST
riscv: stacktrace: fix the riscv stacktrace when CONFIG_FRAME_POINTER enabled

Changed files
+18 -14
arch
riscv
+1
arch/riscv/Kconfig
··· 34 34 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX 35 35 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT 36 36 select ARCH_SUPPORTS_HUGETLBFS if MMU 37 + select ARCH_USE_MEMTEST 37 38 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU 38 39 select ARCH_WANT_FRAME_POINTERS 39 40 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
+2 -2
arch/riscv/include/asm/kexec.h
··· 42 42 unsigned long fdt_addr; 43 43 }; 44 44 45 - const extern unsigned char riscv_kexec_relocate[]; 46 - const extern unsigned int riscv_kexec_relocate_size; 45 + extern const unsigned char riscv_kexec_relocate[]; 46 + extern const unsigned int riscv_kexec_relocate_size; 47 47 48 48 typedef void (*riscv_kexec_method)(unsigned long first_ind_entry, 49 49 unsigned long jump_addr,
+6 -5
arch/riscv/kernel/machine_kexec.c
··· 14 14 #include <asm/set_memory.h> /* For set_memory_x() */ 15 15 #include <linux/compiler.h> /* For unreachable() */ 16 16 #include <linux/cpu.h> /* For cpu_down() */ 17 + #include <linux/reboot.h> 17 18 18 - /** 19 + /* 19 20 * kexec_image_info - Print received image details 20 21 */ 21 22 static void ··· 40 39 } 41 40 } 42 41 43 - /** 42 + /* 44 43 * machine_kexec_prepare - Initialize kexec 45 44 * 46 45 * This function is called from do_kexec_load, when the user has ··· 101 100 } 102 101 103 102 104 - /** 103 + /* 105 104 * machine_kexec_cleanup - Cleanup any leftovers from 106 105 * machine_kexec_prepare 107 106 * ··· 136 135 #endif 137 136 } 138 137 139 - /** 138 + /* 140 139 * machine_crash_shutdown - Prepare to kexec after a kernel crash 141 140 * 142 141 * This function is called by crash_kexec just before machine_kexec ··· 152 151 pr_info("Starting crashdump kernel...\n"); 153 152 } 154 153 155 - /** 154 + /* 156 155 * machine_kexec - Jump to the loaded kimage 157 156 * 158 157 * This function is called by kernel_kexec which is called by the
+2
arch/riscv/kernel/probes/kprobes.c
··· 84 84 return 0; 85 85 } 86 86 87 + #ifdef CONFIG_MMU 87 88 void *alloc_insn_page(void) 88 89 { 89 90 return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END, ··· 92 91 VM_FLUSH_RESET_PERMS, NUMA_NO_NODE, 93 92 __builtin_return_address(0)); 94 93 } 94 + #endif 95 95 96 96 /* install breakpoint in text */ 97 97 void __kprobes arch_arm_kprobe(struct kprobe *p)
+7 -7
arch/riscv/kernel/stacktrace.c
··· 27 27 fp = frame_pointer(regs); 28 28 sp = user_stack_pointer(regs); 29 29 pc = instruction_pointer(regs); 30 - } else if (task == NULL || task == current) { 31 - fp = (unsigned long)__builtin_frame_address(0); 32 - sp = sp_in_global; 33 - pc = (unsigned long)walk_stackframe; 30 + } else if (task == current) { 31 + fp = (unsigned long)__builtin_frame_address(1); 32 + sp = (unsigned long)__builtin_frame_address(0); 33 + pc = (unsigned long)__builtin_return_address(0); 34 34 } else { 35 35 /* task blocked in __switch_to */ 36 36 fp = task->thread.s[0]; ··· 106 106 return true; 107 107 } 108 108 109 - void dump_backtrace(struct pt_regs *regs, struct task_struct *task, 109 + noinline void dump_backtrace(struct pt_regs *regs, struct task_struct *task, 110 110 const char *loglvl) 111 111 { 112 - pr_cont("%sCall Trace:\n", loglvl); 113 112 walk_stackframe(task, regs, print_trace_address, (void *)loglvl); 114 113 } 115 114 116 115 void show_stack(struct task_struct *task, unsigned long *sp, const char *loglvl) 117 116 { 117 + pr_cont("%sCall Trace:\n", loglvl); 118 118 dump_backtrace(NULL, task, loglvl); 119 119 } 120 120 ··· 139 139 140 140 #ifdef CONFIG_STACKTRACE 141 141 142 - void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, 142 + noinline void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie, 143 143 struct task_struct *task, struct pt_regs *regs) 144 144 { 145 145 walk_stackframe(task, regs, consume_entry, cookie);