Skip to content

Commit 01687e7

Browse files
committed
Merge tag 'riscv-for-linus-6.3-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V updates from Palmer Dabbelt: "There's a bunch of fixes/cleanups throughout the tree as usual, but we also have a handful of new features: - Various improvements to the extension detection and alternative patching infrastructure - Zbb-optimized string routines - Support for cpu-capacity in the RISC-V DT bindings - Zicbom no longer depends on toolchain support - Some performance and code size improvements to ftrace - Support for ARCH_WANT_LD_ORPHAN_WARN - Oops now contain the faulting instruction" * tag 'riscv-for-linus-6.3-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (67 commits) RISC-V: add a spin_shadow_stack declaration riscv: mm: hugetlb: Enable ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP riscv: Add header include guards to insn.h riscv: alternative: proceed one more instruction for auipc/jalr pair riscv: Avoid enabling interrupts in die() riscv, mm: Perform BPF exhandler fixup on page fault RISC-V: take text_mutex during alternative patching riscv: hwcap: Don't alphabetize ISA extension IDs RISC-V: fix ordering of Zbb extension riscv: jump_label: Fixup unaligned arch_static_branch function RISC-V: Only provide the single-letter extensions in HWCAP riscv: mm: fix regression due to update_mmu_cache change scripts/decodecode: Add support for RISC-V riscv: Add instruction dump to RISC-V splats riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI stub riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols riscv: lds: define RUNTIME_DISCARD_EXIT RISC-V: move some stray __RISCV_INSN_FUNCS definitions from kprobes ...
2 parents d0a32f5 + eb9be83 commit 01687e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1463
-626
lines changed

Documentation/devicetree/bindings/arm/cpus.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ properties:
259259
260260
capacity-dmips-mhz:
261261
description:
262-
u32 value representing CPU capacity (see ./cpu-capacity.txt) in
262+
u32 value representing CPU capacity (see ../cpu/cpu-capacity.txt) in
263263
DMIPS/MHz, relative to highest capacity-dmips-mhz
264264
in the system.
265265

Documentation/devicetree/bindings/arm/cpu-capacity.txt renamed to Documentation/devicetree/bindings/cpu/cpu-capacity.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
==========================================
2-
ARM CPUs capacity bindings
2+
CPU capacity bindings
33
==========================================
44

55
==========================================
66
1 - Introduction
77
==========================================
88

9-
ARM systems may be configured to have cpus with different power/performance
9+
Some systems may be configured to have cpus with different power/performance
1010
characteristics within the same chip. In this case, additional information has
1111
to be made available to the kernel for it to be aware of such differences and
1212
take decisions accordingly.

Documentation/devicetree/bindings/riscv/cpus.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ properties:
114114
List of phandles to idle state nodes supported
115115
by this hart (see ./idle-states.yaml).
116116
117+
capacity-dmips-mhz:
118+
description:
119+
u32 value representing CPU capacity (see ../cpu/cpu-capacity.txt) in
120+
DMIPS/MHz, relative to highest capacity-dmips-mhz
121+
in the system.
122+
117123
required:
118124
- riscv,isa
119125
- interrupt-controller

Documentation/riscv/uabi.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,46 @@
33
RISC-V Linux User ABI
44
=====================
55

6+
ISA string ordering in /proc/cpuinfo
7+
------------------------------------
8+
9+
The canonical order of ISA extension names in the ISA string is defined in
10+
chapter 27 of the unprivileged specification.
11+
The specification uses vague wording, such as should, when it comes to ordering,
12+
so for our purposes the following rules apply:
13+
14+
#. Single-letter extensions come first, in canonical order.
15+
The canonical order is "IMAFDQLCBKJTPVH".
16+
17+
#. All multi-letter extensions will be separated from other extensions by an
18+
underscore.
19+
20+
#. Additional standard extensions (starting with 'Z') will be sorted after
21+
single-letter extensions and before any higher-privileged extensions.
22+
23+
#. For additional standard extensions, the first letter following the 'Z'
24+
conventionally indicates the most closely related alphabetical
25+
extension category. If multiple 'Z' extensions are named, they will be
26+
ordered first by category, in canonical order, as listed above, then
27+
alphabetically within a category.
28+
29+
#. Standard supervisor-level extensions (starting with 'S') will be listed
30+
after standard unprivileged extensions. If multiple supervisor-level
31+
extensions are listed, they will be ordered alphabetically.
32+
33+
#. Standard machine-level extensions (starting with 'Zxm') will be listed
34+
after any lower-privileged, standard extensions. If multiple machine-level
35+
extensions are listed, they will be ordered alphabetically.
36+
37+
#. Non-standard extensions (starting with 'X') will be listed after all standard
38+
extensions. If multiple non-standard extensions are listed, they will be
39+
ordered alphabetically.
40+
41+
An example string following the order is::
42+
43+
rv64imadc_zifoo_zigoo_zafoo_sbar_scar_zxmbaz_xqux_xrux
44+
45+
Misaligned accesses
46+
-------------------
47+
648
Misaligned accesses are supported in userspace, but they may perform poorly.

Documentation/scheduler/sched-capacity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ for that purpose.
260260

261261
The arm and arm64 architectures directly map this to the arch_topology driver
262262
CPU scaling data, which is derived from the capacity-dmips-mhz CPU binding; see
263-
Documentation/devicetree/bindings/arm/cpu-capacity.txt.
263+
Documentation/devicetree/bindings/cpu/cpu-capacity.txt.
264264

265265
3.2 Frequency invariance
266266
------------------------

Documentation/translations/zh_CN/scheduler/sched-capacity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ CFS调度类基于实体负载跟踪机制(Per-Entity Load Tracking, PELT)
233233

234234
arm和arm64架构直接把这个信息映射到arch_topology驱动的CPU scaling数据中(译注:参考
235235
arch_topology.h的percpu变量cpu_scale),它是从capacity-dmips-mhz CPU binding中衍生计算
236-
出来的。参见Documentation/devicetree/bindings/arm/cpu-capacity.txt。
236+
出来的。参见Documentation/devicetree/bindings/cpu/cpu-capacity.txt。
237237

238238
3.2 频率不变性
239239
--------------

arch/riscv/Kconfig

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ config RISCV
1414
def_bool y
1515
select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
1616
select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
17+
select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
1718
select ARCH_HAS_BINFMT_FLAT
1819
select ARCH_HAS_CURRENT_STACK_POINTER
19-
select ARCH_HAS_DEBUG_VM_PGTABLE
2020
select ARCH_HAS_DEBUG_VIRTUAL if MMU
21+
select ARCH_HAS_DEBUG_VM_PGTABLE
2122
select ARCH_HAS_DEBUG_WX
2223
select ARCH_HAS_FORTIFY_SOURCE
2324
select ARCH_HAS_GCOV_PROFILE_ALL
@@ -44,12 +45,14 @@ config RISCV
4445
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
4546
select ARCH_WANT_FRAME_POINTERS
4647
select ARCH_WANT_GENERAL_HUGETLB
48+
select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
4749
select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
50+
select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
4851
select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
4952
select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
5053
select BUILDTIME_TABLE_SORT if MMU
51-
select CLONE_BACKWARDS
5254
select CLINT_TIMER if !MMU
55+
select CLONE_BACKWARDS
5356
select COMMON_CLK
5457
select CPU_PM if CPU_IDLE
5558
select EDAC_SUPPORT
@@ -84,16 +87,16 @@ config RISCV
8487
select HAVE_ARCH_MMAP_RND_BITS if MMU
8588
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
8689
select HAVE_ARCH_SECCOMP_FILTER
90+
select HAVE_ARCH_THREAD_STRUCT_WHITELIST
8791
select HAVE_ARCH_TRACEHOOK
8892
select HAVE_ARCH_TRANSPARENT_HUGEPAGE if 64BIT && MMU
89-
select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE
90-
select HAVE_ARCH_THREAD_STRUCT_WHITELIST
9193
select HAVE_ARCH_VMAP_STACK if MMU && 64BIT
9294
select HAVE_ASM_MODVERSIONS
9395
select HAVE_CONTEXT_TRACKING_USER
9496
select HAVE_DEBUG_KMEMLEAK
9597
select HAVE_DMA_CONTIGUOUS if MMU
9698
select HAVE_EBPF_JIT if MMU
99+
select HAVE_FUNCTION_ARG_ACCESS_API
97100
select HAVE_FUNCTION_ERROR_INJECTION
98101
select HAVE_GCC_PLUGINS
99102
select HAVE_GENERIC_VDSO if MMU && 64BIT
@@ -110,10 +113,9 @@ config RISCV
110113
select HAVE_PERF_USER_STACK_DUMP
111114
select HAVE_POSIX_CPU_TIMERS_TASK_WORK
112115
select HAVE_REGS_AND_STACK_ACCESS_API
113-
select HAVE_FUNCTION_ARG_ACCESS_API
116+
select HAVE_RSEQ
114117
select HAVE_STACKPROTECTOR
115118
select HAVE_SYSCALL_TRACEPOINTS
116-
select HAVE_RSEQ
117119
select IRQ_DOMAIN
118120
select IRQ_FORCED_THREADING
119121
select MODULES_USE_ELF_RELA if MODULES
@@ -137,7 +139,7 @@ config RISCV
137139
select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
138140
select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
139141
select HAVE_FUNCTION_GRAPH_TRACER
140-
select HAVE_FUNCTION_TRACER if !XIP_KERNEL
142+
select HAVE_FUNCTION_TRACER if !XIP_KERNEL && !PREEMPTION
141143

142144
config ARCH_MMAP_RND_BITS_MIN
143145
default 18 if 64BIT
@@ -234,9 +236,9 @@ config LOCKDEP_SUPPORT
234236
config RISCV_DMA_NONCOHERENT
235237
bool
236238
select ARCH_HAS_DMA_PREP_COHERENT
237-
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
238-
select ARCH_HAS_SYNC_DMA_FOR_CPU
239239
select ARCH_HAS_SETUP_DMA_OPS
240+
select ARCH_HAS_SYNC_DMA_FOR_CPU
241+
select ARCH_HAS_SYNC_DMA_FOR_DEVICE
240242
select DMA_DIRECT_REMAP
241243

242244
config AS_HAS_INSN
@@ -351,11 +353,11 @@ endchoice
351353
config NUMA
352354
bool "NUMA Memory Allocation and Scheduler Support"
353355
depends on SMP && MMU
356+
select ARCH_SUPPORTS_NUMA_BALANCING
354357
select GENERIC_ARCH_NUMA
358+
select NEED_PER_CPU_EMBED_FIRST_CHUNK
355359
select OF_NUMA
356-
select ARCH_SUPPORTS_NUMA_BALANCING
357360
select USE_PERCPU_NUMA_NODE_ID
358-
select NEED_PER_CPU_EMBED_FIRST_CHUNK
359361
help
360362
Enable NUMA (Non-Uniform Memory Access) support.
361363

@@ -400,8 +402,8 @@ config RISCV_ISA_SVPBMT
400402
bool "SVPBMT extension support"
401403
depends on 64BIT && MMU
402404
depends on !XIP_KERNEL
403-
select RISCV_ALTERNATIVE
404405
default y
406+
select RISCV_ALTERNATIVE
405407
help
406408
Adds support to dynamically detect the presence of the SVPBMT
407409
ISA-extension (Supervisor-mode: page-based memory types) and
@@ -415,20 +417,36 @@ config RISCV_ISA_SVPBMT
415417

416418
If you don't know what to do here, say Y.
417419

418-
config TOOLCHAIN_HAS_ZICBOM
420+
config TOOLCHAIN_HAS_ZBB
419421
bool
420422
default y
421-
depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zicbom)
422-
depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zicbom)
423-
depends on LLD_VERSION >= 150000 || LD_VERSION >= 23800
423+
depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
424+
depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
425+
depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
426+
depends on AS_IS_GNU
427+
428+
config RISCV_ISA_ZBB
429+
bool "Zbb extension support for bit manipulation instructions"
430+
depends on TOOLCHAIN_HAS_ZBB
431+
depends on !XIP_KERNEL && MMU
432+
select RISCV_ALTERNATIVE
433+
default y
434+
help
435+
Adds support to dynamically detect the presence of the ZBB
436+
extension (basic bit manipulation) and enable its usage.
437+
438+
The Zbb extension provides instructions to accelerate a number
439+
of bit-specific operations (count bit population, sign extending,
440+
bitrotation, etc).
441+
442+
If you don't know what to do here, say Y.
424443

425444
config RISCV_ISA_ZICBOM
426445
bool "Zicbom extension support for non-coherent DMA operation"
427-
depends on TOOLCHAIN_HAS_ZICBOM
428446
depends on !XIP_KERNEL && MMU
429-
select RISCV_DMA_NONCOHERENT
430-
select RISCV_ALTERNATIVE
431447
default y
448+
select RISCV_ALTERNATIVE
449+
select RISCV_DMA_NONCOHERENT
432450
help
433451
Adds support to dynamically detect the presence of the ZICBOM
434452
extension (Cache Block Management Operations) and enable its
@@ -490,9 +508,9 @@ config RISCV_BOOT_SPINWAIT
490508

491509
config KEXEC
492510
bool "Kexec system call"
493-
select KEXEC_CORE
494-
select HOTPLUG_CPU if SMP
495511
depends on MMU
512+
select HOTPLUG_CPU if SMP
513+
select KEXEC_CORE
496514
help
497515
kexec is a system call that implements the ability to shutdown your
498516
current kernel, and to start another kernel. It is like a reboot
@@ -503,10 +521,10 @@ config KEXEC
503521

504522
config KEXEC_FILE
505523
bool "kexec file based systmem call"
524+
depends on 64BIT && MMU
525+
select HAVE_IMA_KEXEC if IMA
506526
select KEXEC_CORE
507527
select KEXEC_ELF
508-
select HAVE_IMA_KEXEC if IMA
509-
depends on 64BIT && MMU
510528
help
511529
This is new version of kexec system call. This system call is
512530
file based and takes file descriptors as system call argument
@@ -595,15 +613,15 @@ config EFI_STUB
595613
config EFI
596614
bool "UEFI runtime support"
597615
depends on OF && !XIP_KERNEL
598-
select LIBFDT
599-
select UCS2_STRING
600-
select EFI_PARAMS_FROM_FDT
601-
select EFI_STUB
616+
depends on MMU
617+
default y
602618
select EFI_GENERIC_STUB
619+
select EFI_PARAMS_FROM_FDT
603620
select EFI_RUNTIME_WRAPPERS
621+
select EFI_STUB
622+
select LIBFDT
604623
select RISCV_ISA_C
605-
depends on MMU
606-
default y
624+
select UCS2_STRING
607625
help
608626
This option provides support for runtime services provided
609627
by UEFI firmware (such as non-volatile variables, realtime
@@ -682,8 +700,8 @@ config PORTABLE
682700
bool
683701
default !NONPORTABLE
684702
select EFI
685-
select OF
686703
select MMU
704+
select OF
687705

688706
menu "Power management options"
689707

arch/riscv/Kconfig.socs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ config ARCH_SUNXI
4343

4444
config ARCH_VIRT
4545
def_bool SOC_VIRT
46-
46+
4747
config SOC_VIRT
4848
bool "QEMU Virt Machine"
4949
select CLINT_TIMER if RISCV_M_MODE
@@ -88,7 +88,8 @@ config SOC_CANAAN_K210_DTB_BUILTIN
8888
If unsure, say Y.
8989

9090
config ARCH_CANAAN_K210_DTB_SOURCE
91-
def_bool SOC_CANAAN_K210_DTB_SOURCE
91+
string
92+
default SOC_CANAAN_K210_DTB_SOURCE
9293

9394
config SOC_CANAAN_K210_DTB_SOURCE
9495
string "Source file for the Canaan Kendryte K210 builtin DTB"

arch/riscv/Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ LDFLAGS_vmlinux :=
1111
ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
1212
LDFLAGS_vmlinux := --no-relax
1313
KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY
14-
CC_FLAGS_FTRACE := -fpatchable-function-entry=8
14+
ifeq ($(CONFIG_RISCV_ISA_C),y)
15+
CC_FLAGS_FTRACE := -fpatchable-function-entry=4
16+
else
17+
CC_FLAGS_FTRACE := -fpatchable-function-entry=2
18+
endif
1519
endif
1620

1721
ifeq ($(CONFIG_CMODEL_MEDLOW),y)
@@ -58,9 +62,6 @@ riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c
5862
toolchain-need-zicsr-zifencei := $(call cc-option-yn, -march=$(riscv-march-y)_zicsr_zifencei)
5963
riscv-march-$(toolchain-need-zicsr-zifencei) := $(riscv-march-y)_zicsr_zifencei
6064

61-
# Check if the toolchain supports Zicbom extension
62-
riscv-march-$(CONFIG_TOOLCHAIN_HAS_ZICBOM) := $(riscv-march-y)_zicbom
63-
6465
# Check if the toolchain supports Zihintpause extension
6566
riscv-march-$(CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE) := $(riscv-march-y)_zihintpause
6667

arch/riscv/errata/sifive/errata.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include <linux/kernel.h>
7+
#include <linux/memory.h>
78
#include <linux/module.h>
89
#include <linux/string.h>
910
#include <linux/bug.h>
@@ -107,7 +108,10 @@ void __init_or_module sifive_errata_patch_func(struct alt_entry *begin,
107108

108109
tmp = (1U << alt->errata_id);
109110
if (cpu_req_errata & tmp) {
110-
patch_text_nosync(alt->old_ptr, alt->alt_ptr, alt->alt_len);
111+
mutex_lock(&text_mutex);
112+
patch_text_nosync(ALT_OLD_PTR(alt), ALT_ALT_PTR(alt),
113+
alt->alt_len);
114+
mutex_lock(&text_mutex);
111115
cpu_apply_errata |= tmp;
112116
}
113117
}

0 commit comments

Comments
 (0)