Skip to content

Commit eab4002

Browse files
committed
Merge tag 'riscv-for-linus-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V updates from Palmer Dabbelt: "This contains a handful of new features: - Partial support for the Kendryte K210. There are still a few outstanding issues that I have patches for, but I don't actually have a board to test them so they're not included yet. - SBI v0.2 support. - Fixes to support for building with LLVM-based toolchains. The resulting images are known not to boot yet. I don't anticipate a part two, but I'll probably have something early in the RCs to finish up the K210 support" * tag 'riscv-for-linus-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (38 commits) riscv: create a loader.bin boot image for Kendryte SoC riscv: Kendryte K210 default config riscv: Add Kendryte K210 device tree riscv: Select required drivers for Kendryte SOC riscv: Add Kendryte K210 SoC support riscv: Add SOC early init support riscv: Unaligned load/store handling for M_MODE RISC-V: Support cpu hotplug RISC-V: Add supported for ordered booting method using HSM RISC-V: Add SBI HSM extension definitions RISC-V: Export SBI error to linux error mapping function RISC-V: Add cpu_ops and modify default booting method RISC-V: Move relocate and few other functions out of __init RISC-V: Implement new SBI v0.2 extensions RISC-V: Introduce a new config for SBI v0.1 RISC-V: Add SBI v0.2 extension definitions RISC-V: Add basic support for SBI v0.2 RISC-V: Mark existing SBI as 0.1 SBI. riscv: Use macro definition instead of magic number riscv: Add support to dump the kernel page tables ...
2 parents 5d30bca + 37809df commit eab4002

Some content is hidden

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

54 files changed

+3093
-294
lines changed

arch/riscv/Kconfig

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ config RISCV
2020
select CLONE_BACKWARDS
2121
select COMMON_CLK
2222
select GENERIC_CLOCKEVENTS
23-
select GENERIC_CPU_DEVICES
2423
select GENERIC_IRQ_SHOW
2524
select GENERIC_PCI_IOMAP
2625
select GENERIC_SCHED_CLOCK
@@ -29,6 +28,7 @@ config RISCV
2928
select GENERIC_SMP_IDLE_THREAD
3029
select GENERIC_ATOMIC64 if !64BIT
3130
select GENERIC_IOREMAP
31+
select GENERIC_PTDUMP if MMU
3232
select HAVE_ARCH_AUDITSYSCALL
3333
select HAVE_ARCH_SECCOMP_FILTER
3434
select HAVE_ASM_MODVERSIONS
@@ -58,6 +58,9 @@ config RISCV
5858
select HAVE_EBPF_JIT
5959
select EDAC_SUPPORT
6060
select ARCH_HAS_GIGANTIC_PAGE
61+
select ARCH_HAS_SET_DIRECT_MAP
62+
select ARCH_HAS_SET_MEMORY
63+
select ARCH_HAS_STRICT_KERNEL_RWX
6164
select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
6265
select SPARSEMEM_STATIC if 32BIT
6366
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
@@ -129,6 +132,9 @@ config ARCH_SELECT_MEMORY_MODEL
129132
config ARCH_WANT_GENERAL_HUGETLB
130133
def_bool y
131134

135+
config ARCH_SUPPORTS_DEBUG_PAGEALLOC
136+
def_bool y
137+
132138
config SYS_SUPPORTS_HUGETLBFS
133139
def_bool y
134140

@@ -247,6 +253,17 @@ config NR_CPUS
247253
depends on SMP
248254
default "8"
249255

256+
config HOTPLUG_CPU
257+
bool "Support for hot-pluggable CPUs"
258+
depends on SMP
259+
select GENERIC_IRQ_MIGRATION
260+
help
261+
262+
Say Y here to experiment with turning CPUs off and on. CPUs
263+
can be controlled through /sys/devices/system/cpu.
264+
265+
Say N if you want to disable CPU hotplug.
266+
250267
choice
251268
prompt "CPU Tuning"
252269
default TUNE_GENERIC
@@ -307,6 +324,13 @@ config SECCOMP
307324
and the task is only allowed to execute a few safe syscalls
308325
defined by each seccomp mode.
309326

327+
config RISCV_SBI_V01
328+
bool "SBI v0.1 support"
329+
default y
330+
depends on RISCV_SBI
331+
help
332+
This config allows kernel to use SBI v0.1 APIs. This will be
333+
deprecated in future once legacy M-mode software are no longer in use.
310334
endmenu
311335

312336
menu "Boot options"

arch/riscv/Kconfig.socs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,14 @@ config SOC_VIRT
2020
help
2121
This enables support for QEMU Virt Machine.
2222

23+
config SOC_KENDRYTE
24+
bool "Kendryte K210 SoC"
25+
depends on !MMU
26+
select BUILTIN_DTB
27+
select SERIAL_SIFIVE if TTY
28+
select SERIAL_SIFIVE_CONSOLE if TTY
29+
select SIFIVE_PLIC
30+
help
31+
This enables support for Kendryte K210 SoC platform hardware.
32+
2333
endmenu

arch/riscv/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ PHONY += vdso_install
8585
vdso_install:
8686
$(Q)$(MAKE) $(build)=arch/riscv/kernel/vdso $@
8787

88-
ifeq ($(CONFIG_RISCV_M_MODE),y)
89-
KBUILD_IMAGE := $(boot)/loader
88+
ifeq ($(CONFIG_RISCV_M_MODE)$(CONFIG_SOC_KENDRYTE),yy)
89+
KBUILD_IMAGE := $(boot)/loader.bin
9090
else
9191
KBUILD_IMAGE := $(boot)/Image.gz
9292
endif
93-
BOOT_TARGETS := Image Image.gz loader
93+
BOOT_TARGETS := Image Image.gz loader loader.bin
9494

9595
all: $(notdir $(KBUILD_IMAGE))
9696

arch/riscv/boot/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ $(obj)/Image.lzma: $(obj)/Image FORCE
4141
$(obj)/Image.lzo: $(obj)/Image FORCE
4242
$(call if_changed,lzo)
4343

44+
$(obj)/loader.bin: $(obj)/loader FORCE
45+
$(call if_changed,objcopy)
46+
4447
install:
4548
$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
4649
$(obj)/Image System.map "$(INSTALL_PATH)"

arch/riscv/boot/dts/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0
22
subdir-y += sifive
3+
subdir-y += kendryte

arch/riscv/boot/dts/kendryte/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
dtb-$(CONFIG_SOC_KENDRYTE) += k210.dtb

arch/riscv/boot/dts/kendryte/k210.dts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: GPL-2.0+
2+
/*
3+
* Copyright (C) 2020 Western Digital Corporation or its affiliates.
4+
*/
5+
6+
/dts-v1/;
7+
8+
#include "k210.dtsi"
9+
10+
/ {
11+
model = "Kendryte K210 generic";
12+
compatible = "kendryte,k210";
13+
14+
chosen {
15+
bootargs = "earlycon console=ttySIF0";
16+
stdout-path = "serial0";
17+
};
18+
};
19+
20+
&uarths0 {
21+
status = "okay";
22+
};
23+
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// SPDX-License-Identifier: GPL-2.0+
2+
/*
3+
* Copyright (C) 2019 Sean Anderson <[email protected]>
4+
* Copyright (C) 2020 Western Digital Corporation or its affiliates.
5+
*/
6+
#include <dt-bindings/clock/k210-clk.h>
7+
8+
/ {
9+
/*
10+
* Although the K210 is a 64-bit CPU, the address bus is only 32-bits
11+
* wide, and the upper half of all addresses is ignored.
12+
*/
13+
#address-cells = <1>;
14+
#size-cells = <1>;
15+
compatible = "kendryte,k210";
16+
17+
aliases {
18+
serial0 = &uarths0;
19+
};
20+
21+
/*
22+
* The K210 has an sv39 MMU following the priviledge specification v1.9.
23+
* Since this is a non-ratified draft specification, the kernel does not
24+
* support it and the K210 support enabled only for the !MMU case.
25+
* Be consistent with this by setting the CPUs MMU type to "none".
26+
*/
27+
cpus {
28+
#address-cells = <1>;
29+
#size-cells = <0>;
30+
timebase-frequency = <7800000>;
31+
cpu0: cpu@0 {
32+
device_type = "cpu";
33+
reg = <0>;
34+
compatible = "kendryte,k210", "sifive,rocket0", "riscv";
35+
riscv,isa = "rv64imafdc";
36+
mmu-type = "none";
37+
i-cache-size = <0x8000>;
38+
i-cache-block-size = <64>;
39+
d-cache-size = <0x8000>;
40+
d-cache-block-size = <64>;
41+
clocks = <&sysctl K210_CLK_CPU>;
42+
clock-frequency = <390000000>;
43+
cpu0_intc: interrupt-controller {
44+
#interrupt-cells = <1>;
45+
interrupt-controller;
46+
compatible = "riscv,cpu-intc";
47+
};
48+
};
49+
cpu1: cpu@1 {
50+
device_type = "cpu";
51+
reg = <1>;
52+
compatible = "kendryte,k210", "sifive,rocket0", "riscv";
53+
riscv,isa = "rv64imafdc";
54+
mmu-type = "none";
55+
i-cache-size = <0x8000>;
56+
i-cache-block-size = <64>;
57+
d-cache-size = <0x8000>;
58+
d-cache-block-size = <64>;
59+
clocks = <&sysctl K210_CLK_CPU>;
60+
clock-frequency = <390000000>;
61+
cpu1_intc: interrupt-controller {
62+
#interrupt-cells = <1>;
63+
interrupt-controller;
64+
compatible = "riscv,cpu-intc";
65+
};
66+
};
67+
};
68+
69+
sram: memory@80000000 {
70+
device_type = "memory";
71+
reg = <0x80000000 0x400000>,
72+
<0x80400000 0x200000>,
73+
<0x80600000 0x200000>;
74+
reg-names = "sram0", "sram1", "aisram";
75+
};
76+
77+
clocks {
78+
in0: oscillator {
79+
compatible = "fixed-clock";
80+
#clock-cells = <0>;
81+
clock-frequency = <26000000>;
82+
};
83+
};
84+
85+
soc {
86+
#address-cells = <1>;
87+
#size-cells = <1>;
88+
compatible = "kendryte,k210-soc", "simple-bus";
89+
ranges;
90+
interrupt-parent = <&plic0>;
91+
92+
sysctl: sysctl@50440000 {
93+
compatible = "kendryte,k210-sysctl", "simple-mfd";
94+
reg = <0x50440000 0x1000>;
95+
#clock-cells = <1>;
96+
};
97+
98+
clint0: interrupt-controller@2000000 {
99+
compatible = "riscv,clint0";
100+
reg = <0x2000000 0xC000>;
101+
interrupts-extended = <&cpu0_intc 3>, <&cpu1_intc 3>;
102+
clocks = <&sysctl K210_CLK_ACLK>;
103+
};
104+
105+
plic0: interrupt-controller@c000000 {
106+
#interrupt-cells = <1>;
107+
interrupt-controller;
108+
compatible = "kendryte,k210-plic0", "riscv,plic0";
109+
reg = <0xC000000 0x4000000>;
110+
interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 0xffffffff>,
111+
<&cpu1_intc 11>, <&cpu1_intc 0xffffffff>;
112+
riscv,ndev = <65>;
113+
riscv,max-priority = <7>;
114+
};
115+
116+
uarths0: serial@38000000 {
117+
compatible = "kendryte,k210-uarths", "sifive,uart0";
118+
reg = <0x38000000 0x1000>;
119+
interrupts = <33>;
120+
clocks = <&sysctl K210_CLK_CPU>;
121+
};
122+
};
123+
};

arch/riscv/configs/defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,4 @@ CONFIG_DEBUG_BLOCK_EXT_DEVT=y
128128
# CONFIG_FTRACE is not set
129129
# CONFIG_RUNTIME_TESTING_MENU is not set
130130
CONFIG_MEMTEST=y
131+
# CONFIG_SYSFS_SYSCALL is not set
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# CONFIG_CPU_ISOLATION is not set
2+
CONFIG_LOG_BUF_SHIFT=15
3+
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12
4+
CONFIG_BLK_DEV_INITRD=y
5+
CONFIG_INITRAMFS_SOURCE=""
6+
CONFIG_INITRAMFS_FORCE=y
7+
# CONFIG_RD_BZIP2 is not set
8+
# CONFIG_RD_LZMA is not set
9+
# CONFIG_RD_XZ is not set
10+
# CONFIG_RD_LZO is not set
11+
# CONFIG_RD_LZ4 is not set
12+
# CONFIG_BOOT_CONFIG is not set
13+
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
14+
# CONFIG_SYSFS_SYSCALL is not set
15+
# CONFIG_FHANDLE is not set
16+
# CONFIG_BASE_FULL is not set
17+
# CONFIG_EPOLL is not set
18+
# CONFIG_SIGNALFD is not set
19+
# CONFIG_TIMERFD is not set
20+
# CONFIG_EVENTFD is not set
21+
# CONFIG_AIO is not set
22+
# CONFIG_IO_URING is not set
23+
# CONFIG_ADVISE_SYSCALLS is not set
24+
# CONFIG_MEMBARRIER is not set
25+
# CONFIG_KALLSYMS is not set
26+
CONFIG_EMBEDDED=y
27+
# CONFIG_VM_EVENT_COUNTERS is not set
28+
# CONFIG_COMPAT_BRK is not set
29+
CONFIG_SLOB=y
30+
# CONFIG_SLAB_MERGE_DEFAULT is not set
31+
# CONFIG_MMU is not set
32+
CONFIG_SOC_KENDRYTE=y
33+
CONFIG_MAXPHYSMEM_2GB=y
34+
CONFIG_SMP=y
35+
CONFIG_NR_CPUS=2
36+
CONFIG_CMDLINE="earlycon console=ttySIF0"
37+
CONFIG_CMDLINE_FORCE=y
38+
CONFIG_USE_BUILTIN_DTB=y
39+
CONFIG_BUILTIN_DTB_SOURCE="kendryte/k210"
40+
# CONFIG_BLOCK is not set
41+
CONFIG_BINFMT_FLAT=y
42+
# CONFIG_COREDUMP is not set
43+
CONFIG_DEVTMPFS=y
44+
CONFIG_DEVTMPFS_MOUNT=y
45+
# CONFIG_FW_LOADER is not set
46+
# CONFIG_ALLOW_DEV_COREDUMP is not set
47+
# CONFIG_INPUT_KEYBOARD is not set
48+
# CONFIG_INPUT_MOUSE is not set
49+
# CONFIG_SERIO is not set
50+
# CONFIG_LEGACY_PTYS is not set
51+
# CONFIG_LDISC_AUTOLOAD is not set
52+
# CONFIG_DEVMEM is not set
53+
# CONFIG_HW_RANDOM is not set
54+
# CONFIG_HWMON is not set
55+
# CONFIG_VGA_CONSOLE is not set
56+
# CONFIG_HID is not set
57+
# CONFIG_USB_SUPPORT is not set
58+
# CONFIG_VIRTIO_MENU is not set
59+
# CONFIG_DNOTIFY is not set
60+
# CONFIG_INOTIFY_USER is not set
61+
# CONFIG_MISC_FILESYSTEMS is not set
62+
CONFIG_LSM="[]"
63+
CONFIG_PRINTK_TIME=y
64+
# CONFIG_DEBUG_MISC is not set
65+
# CONFIG_SCHED_DEBUG is not set
66+
# CONFIG_RCU_TRACE is not set
67+
# CONFIG_FTRACE is not set
68+
# CONFIG_RUNTIME_TESTING_MENU is not set

0 commit comments

Comments
 (0)