Skip to content

Commit dbf8381

Browse files
committed
Merge tag 'riscv-for-linus-5.9-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V updates from Palmer Dabbelt: "We have a lot of new kernel features for this merge window: - ARCH_SUPPORTS_ATOMIC_RMW, to allow OSQ locks to be enabled - The ability to enable NO_HZ_FULL - Support for enabling kcov, kmemleak, stack protector, and VM debugging - JUMP_LABEL support There are also a handful of cleanups" * tag 'riscv-for-linus-5.9-mw0' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (24 commits) riscv: disable stack-protector for vDSO RISC-V: Fix build warning for smpboot.c riscv: fix build warning of mm/pageattr riscv: Fix build warning for mm/init RISC-V: Setup exception vector early riscv: Select ARCH_HAS_DEBUG_VM_PGTABLE riscv: Use generic pgprot_* macros from <linux/pgtable.h> mm: pgtable: Make generic pgprot_* macros available for no-MMU riscv: Cleanup unnecessary define in asm-offset.c riscv: Add jump-label implementation riscv: Support R_RISCV_ADD64 and R_RISCV_SUB64 relocs Replace HTTP links with HTTPS ones: RISC-V riscv: Add STACKPROTECTOR supported riscv: Fix typo in asm/hwcap.h uapi header riscv: Add kmemleak support riscv: Allow building with kcov coverage riscv: Enable context tracking riscv: Support irq_work via self IPIs riscv: Enable LOCKDEP_SUPPORT & fixup TRACE_IRQFLAGS_SUPPORT riscv: Fixup lockdep_assert_held with wrong param cpu_running ...
2 parents e1ec517 + 40284a0 commit dbf8381

File tree

32 files changed

+356
-71
lines changed

32 files changed

+356
-71
lines changed

Documentation/features/core/jump-labels/arch-support.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
| openrisc: | TODO |
2424
| parisc: | ok |
2525
| powerpc: | ok |
26-
| riscv: | TODO |
26+
| riscv: | ok |
2727
| s390: | ok |
2828
| sh: | TODO |
2929
| sparc: | ok |

Documentation/features/debug/debug-vm-pgtable/arch-support.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
| openrisc: | TODO |
2424
| parisc: | TODO |
2525
| powerpc: | ok |
26-
| riscv: | TODO |
26+
| riscv: | ok |
2727
| s390: | ok |
2828
| sh: | TODO |
2929
| sparc: | TODO |

arch/riscv/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ config 32BIT
1313
config RISCV
1414
def_bool y
1515
select ARCH_CLOCKSOURCE_INIT
16+
select ARCH_SUPPORTS_ATOMIC_RMW
1617
select ARCH_HAS_BINFMT_FLAT
18+
select ARCH_HAS_DEBUG_VM_PGTABLE
1719
select ARCH_HAS_DEBUG_VIRTUAL if MMU
1820
select ARCH_HAS_DEBUG_WX
1921
select ARCH_HAS_GCOV_PROFILE_ALL
2022
select ARCH_HAS_GIGANTIC_PAGE
23+
select ARCH_HAS_KCOV
2124
select ARCH_HAS_MMIOWB
2225
select ARCH_HAS_PTE_SPECIAL
2326
select ARCH_HAS_SET_DIRECT_MAP
@@ -47,21 +50,27 @@ config RISCV
4750
select GENERIC_TIME_VSYSCALL if MMU && 64BIT
4851
select HANDLE_DOMAIN_IRQ
4952
select HAVE_ARCH_AUDITSYSCALL
53+
select HAVE_ARCH_JUMP_LABEL
54+
select HAVE_ARCH_JUMP_LABEL_RELATIVE
5055
select HAVE_ARCH_KASAN if MMU && 64BIT
5156
select HAVE_ARCH_KGDB
5257
select HAVE_ARCH_KGDB_QXFER_PKT
5358
select HAVE_ARCH_MMAP_RND_BITS if MMU
5459
select HAVE_ARCH_SECCOMP_FILTER
5560
select HAVE_ARCH_TRACEHOOK
5661
select HAVE_ASM_MODVERSIONS
62+
select HAVE_CONTEXT_TRACKING
63+
select HAVE_DEBUG_KMEMLEAK
5764
select HAVE_DMA_CONTIGUOUS if MMU
5865
select HAVE_EBPF_JIT if MMU
5966
select HAVE_FUTEX_CMPXCHG if FUTEX
67+
select HAVE_GCC_PLUGINS
6068
select HAVE_GENERIC_VDSO if MMU && 64BIT
6169
select HAVE_PCI
6270
select HAVE_PERF_EVENTS
6371
select HAVE_PERF_REGS
6472
select HAVE_PERF_USER_STACK_DUMP
73+
select HAVE_STACKPROTECTOR
6574
select HAVE_SYSCALL_TRACEPOINTS
6675
select IRQ_DOMAIN
6776
select MODULES_USE_ELF_RELA if MODULES
@@ -179,6 +188,9 @@ config PGTABLE_LEVELS
179188
default 3 if 64BIT
180189
default 2
181190

191+
config LOCKDEP_SUPPORT
192+
def_bool y
193+
182194
source "arch/riscv/Kconfig.socs"
183195

184196
menu "Platform type"

arch/riscv/boot/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# Based on the ia64 and arm64 boot/Makefile.
1515
#
1616

17+
KCOV_INSTRUMENT := n
18+
1719
OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
1820

1921
targets := Image loader

arch/riscv/configs/defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ CONFIG_BPF_SYSCALL=y
1717
CONFIG_SOC_SIFIVE=y
1818
CONFIG_SOC_VIRT=y
1919
CONFIG_SMP=y
20+
CONFIG_JUMP_LABEL=y
2021
CONFIG_MODULES=y
2122
CONFIG_MODULE_UNLOAD=y
2223
CONFIG_NET=y

arch/riscv/configs/nommu_k210_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CONFIG_SMP=y
3333
CONFIG_NR_CPUS=2
3434
CONFIG_CMDLINE="earlycon console=ttySIF0"
3535
CONFIG_CMDLINE_FORCE=y
36+
CONFIG_JUMP_LABEL=y
3637
# CONFIG_BLOCK is not set
3738
CONFIG_BINFMT_FLAT=y
3839
# CONFIG_COREDUMP is not set

arch/riscv/configs/nommu_virt_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ CONFIG_MAXPHYSMEM_2GB=y
3030
CONFIG_SMP=y
3131
CONFIG_CMDLINE="root=/dev/vda rw earlycon=uart8250,mmio,0x10000000,115200n8 console=ttyS0"
3232
CONFIG_CMDLINE_FORCE=y
33+
CONFIG_JUMP_LABEL=y
3334
# CONFIG_BLK_DEV_BSG is not set
3435
CONFIG_PARTITION_ADVANCED=y
3536
# CONFIG_MSDOS_PARTITION is not set

arch/riscv/configs/rv32_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ CONFIG_BPF_SYSCALL=y
1717
CONFIG_SOC_VIRT=y
1818
CONFIG_ARCH_RV32I=y
1919
CONFIG_SMP=y
20+
CONFIG_JUMP_LABEL=y
2021
CONFIG_MODULES=y
2122
CONFIG_MODULE_UNLOAD=y
2223
CONFIG_NET=y

arch/riscv/include/asm/irq_work.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _ASM_RISCV_IRQ_WORK_H
3+
#define _ASM_RISCV_IRQ_WORK_H
4+
5+
static inline bool arch_irq_work_has_interrupt(void)
6+
{
7+
return true;
8+
}
9+
extern void arch_irq_work_raise(void);
10+
#endif /* _ASM_RISCV_IRQ_WORK_H */

arch/riscv/include/asm/jump_label.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (C) 2020 Emil Renner Berthing
4+
*
5+
* Based on arch/arm64/include/asm/jump_label.h
6+
*/
7+
#ifndef __ASM_JUMP_LABEL_H
8+
#define __ASM_JUMP_LABEL_H
9+
10+
#ifndef __ASSEMBLY__
11+
12+
#include <linux/types.h>
13+
#include <asm/asm.h>
14+
15+
#define JUMP_LABEL_NOP_SIZE 4
16+
17+
static __always_inline bool arch_static_branch(struct static_key *key,
18+
bool branch)
19+
{
20+
asm_volatile_goto(
21+
" .option push \n\t"
22+
" .option norelax \n\t"
23+
" .option norvc \n\t"
24+
"1: nop \n\t"
25+
" .option pop \n\t"
26+
" .pushsection __jump_table, \"aw\" \n\t"
27+
" .align " RISCV_LGPTR " \n\t"
28+
" .long 1b - ., %l[label] - . \n\t"
29+
" " RISCV_PTR " %0 - . \n\t"
30+
" .popsection \n\t"
31+
: : "i"(&((char *)key)[branch]) : : label);
32+
33+
return false;
34+
label:
35+
return true;
36+
}
37+
38+
static __always_inline bool arch_static_branch_jump(struct static_key *key,
39+
bool branch)
40+
{
41+
asm_volatile_goto(
42+
" .option push \n\t"
43+
" .option norelax \n\t"
44+
" .option norvc \n\t"
45+
"1: jal zero, %l[label] \n\t"
46+
" .option pop \n\t"
47+
" .pushsection __jump_table, \"aw\" \n\t"
48+
" .align " RISCV_LGPTR " \n\t"
49+
" .long 1b - ., %l[label] - . \n\t"
50+
" " RISCV_PTR " %0 - . \n\t"
51+
" .popsection \n\t"
52+
: : "i"(&((char *)key)[branch]) : : label);
53+
54+
return false;
55+
label:
56+
return true;
57+
}
58+
59+
#endif /* __ASSEMBLY__ */
60+
#endif /* __ASM_JUMP_LABEL_H */

0 commit comments

Comments
 (0)