Skip to content

Commit e5e8d80

Browse files
soc: add OpenHW Group CVA6 SoC
Adds support for the CVA6 family of RISC-V CPUs. CVA6 is commonly found as a soft core CPU on FPGA designs. Different configurations and instruction set extensions can be configured, and different SoCs targeting various FPGA boards are available. This commit adds support for the 32-bit and 64-bit configurations of CVA6, as well as three slightly different SoCs (a minimal 32-bit configuration, a 64-bit configuration without FPU, a 64-bit configuration with FPU). Signed-off-by: Eric Ackermann <[email protected]>
1 parent 7abda99 commit e5e8d80

17 files changed

+534
-0
lines changed
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2025 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
description: OpenHW Group CVA6 CPU
5+
6+
compatible: "openhwgroup,cva6"
7+
8+
include: riscv,cpus.yaml
9+
10+
properties:
11+
timebase-frequency:
12+
required: true
13+
type: int
14+
description: Clock speed at which the core-local machine timer operates.

dts/riscv/openhwgroup/cv32a6.dtsi

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* Copyright 2024 CISPA Helmholtz Center for Information Security
5+
*/
6+
7+
#include <freq.h>
8+
#include "cva6.dtsi"
9+
10+
/*
11+
* Least common denominator of CVA6 32-bit CPUs: no FPU, no compressed instructions,
12+
* no MMU, no PMP.
13+
* Boards can overwrite the node if additional configurations are available.
14+
*/
15+
/ {
16+
cpus_0: cpus {
17+
#address-cells = <1>;
18+
#size-cells = <0>;
19+
20+
cpu_0: cpu@0 {
21+
clock-frequency = <DT_FREQ_M(50)>;
22+
timebase-frequency = <DT_FREQ_M(25)>;
23+
device_type = "cpu";
24+
compatible = "openhwgroup,cva6";
25+
riscv,isa = "rv32ima";
26+
/* overwrite in board configuration if sv32 MMU is enabled */
27+
mmu-type = "riscv,none";
28+
reg = <0>;
29+
30+
status = "okay";
31+
32+
hlic: interrupt-controller {
33+
#interrupt-cells = <0x01>;
34+
interrupt-controller;
35+
compatible = "riscv,cpu-intc";
36+
status = "okay";
37+
};
38+
};
39+
};
40+
};

dts/riscv/openhwgroup/cv64a6.dtsi

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* Copyright 2024 CISPA Helmholtz Center for Information Security
5+
*/
6+
7+
#include <freq.h>
8+
#include "cva6.dtsi"
9+
/*
10+
* Application-class configuration of CVA6 64-bit CPUs:
11+
* FPU for 32-bit and 64-bit floats, SV39 MMU.
12+
*
13+
*/
14+
/ {
15+
cpus_0: cpus {
16+
#address-cells = <1>;
17+
#size-cells = <0>;
18+
19+
cpu_0: cpu@0 {
20+
clock-frequency = <DT_FREQ_M(50)>;
21+
timebase-frequency = <DT_FREQ_M(25)>;
22+
device_type = "cpu";
23+
compatible = "openhwgroup,cva6";
24+
riscv,isa = "rv64imafdc";
25+
mmu-type = "riscv,sv39";
26+
reg = <0>;
27+
28+
status = "okay";
29+
30+
hlic: interrupt-controller {
31+
#interrupt-cells = <0x01>;
32+
interrupt-controller;
33+
compatible = "riscv,cpu-intc";
34+
status = "okay";
35+
};
36+
};
37+
};
38+
};

dts/riscv/openhwgroup/cva6.dtsi

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright 2024 CISPA Helmholtz Center for Information Security
4+
*/
5+
6+
#include <freq.h>
7+
8+
/*
9+
* CVA6 SoC without CPU, which comes in 32 and 64 bit variants
10+
*/
11+
/ {
12+
#address-cells = <0x01>;
13+
#size-cells = <0x01>;
14+
15+
clocks {
16+
17+
clk_cpu {
18+
#clock-cells = <0x00>;
19+
clock-frequency = <DT_FREQ_M(50)>;
20+
compatible = "fixed-clock";
21+
};
22+
23+
clk_bus: clk_bus_0 {
24+
#clock-cells = <0x00>;
25+
clock-frequency = <DT_FREQ_M(50)>;
26+
compatible = "fixed-clock";
27+
};
28+
};
29+
30+
soc {
31+
#address-cells = <0x01>;
32+
#size-cells = <0x01>;
33+
ranges;
34+
35+
/* Xilinx MIG memory controller */
36+
memory0: memory@80000000 {
37+
device_type = "memory";
38+
reg = <0x80000000 0x40000000>;
39+
status = "okay";
40+
};
41+
42+
/* RISC-V Platform-level interrupt controller */
43+
plic: interrupt-controller@c000000 {
44+
compatible = "sifive,plic-1.0.0";
45+
#address-cells = <0>;
46+
#interrupt-cells = <2>;
47+
interrupt-controller;
48+
interrupts-extended = <&hlic 11 &hlic 9>;
49+
reg = <0x0c000000 0x4000000>;
50+
riscv,max-priority = <7>;
51+
riscv,ndev = <30>;
52+
status = "okay";
53+
};
54+
55+
/* USB UART */
56+
uart0: serial@10000000 {
57+
clock-frequency = <50000000>;
58+
clocks = <&clk_bus>;
59+
compatible = "ns16550";
60+
current-speed = <115200>;
61+
device_type = "serial";
62+
reg = <0x10000000 0x10000>;
63+
reg-shift = <0x02>;
64+
parity = "none";
65+
stop-bits = "1";
66+
data-bits = <8>;
67+
interrupt-parent = <&plic>;
68+
interrupts = <1 0x04>;
69+
status = "disabled";
70+
};
71+
72+
/* SPI controller, connected to SD card */
73+
spi0: axi_quad_spi@20000000 {
74+
#address-cells = <1>;
75+
#size-cells = <0>;
76+
compatible = "xlnx,xps-spi-2.00.a";
77+
reg = <0x20000000 0x10000>;
78+
xlnx,num-ss-bits = <0x01>;
79+
xlnx,num-transfer-bits = <0x8>;
80+
interrupts=<2 0x2>;
81+
interrupt-parent=<&plic>;
82+
clocks=<&clk_bus>;
83+
status = "disabled";
84+
};
85+
86+
/*
87+
* Core-local interrupt controller according to RISC-V spec
88+
*/
89+
clint: clint@2000000 {
90+
compatible = "sifive,clint0";
91+
reg = <0x2000000 0x40000>;
92+
interrupts-extended = <&hlic 3 &hlic 7>;
93+
status = "disabled";
94+
};
95+
96+
/*
97+
* Xilinx AXI DMA.
98+
* Part of the Xilinx AXI Ethernet Subsystem.
99+
* Only on CISPA board.
100+
*/
101+
dma0: dma@41e00000 {
102+
#dma-cells = <0x01>;
103+
clock-frequency = <DT_FREQ_M(50)>;
104+
clock-names = "s_axi_lite_aclk";
105+
clocks = <&clk_bus>;
106+
compatible = "xlnx,eth-dma";
107+
reg = <0x41e00000 0x10000>;
108+
xlnx,addrwidth = <0x40>;
109+
xlnx,include-dre;
110+
xlnx,num-queues = <0x1>;
111+
interrupt-parent = <&plic>;
112+
// TX - RX
113+
// active-high level-triggered
114+
interrupts = <8 4>, <9 4>;
115+
// TX and RX
116+
dma-channels = <2>;
117+
status = "disabled";
118+
};
119+
120+
/*
121+
* LowRISC ethernet subsystem.
122+
* Only on OpenHW Group board.
123+
*/
124+
eth: lowrisc-eth@30000000 {
125+
compatible = "lowrisc-eth";
126+
device_type = "network";
127+
interrupt-parent = <&plic>;
128+
interrupts = <3 0>;
129+
reg = <0x0 0x30000000 0x0 0x8000>;
130+
status = "disabled";
131+
};
132+
133+
/* Xilinx GPIO, connected to LEDs */
134+
xlnx_gpio: gpio@40000000 {
135+
#gpio-cells = <2>;
136+
compatible = "xlnx,xps-gpio-1.00.a";
137+
gpio-controller ;
138+
reg = <0x0 0x40000000 0x0 0x10000 >;
139+
xlnx,all-inputs = <0x0>;
140+
xlnx,all-inputs-2 = <0x0>;
141+
xlnx,dout-default = <0x0>;
142+
xlnx,dout-default-2 = <0x0>;
143+
xlnx,gpio-width = <0x8>;
144+
xlnx,gpio2-width = <0x8>;
145+
xlnx,is-dual = <0x1>;
146+
xlnx,tri-default = <0xffffffff>;
147+
xlnx,tri-default-2 = <0xffffffff>;
148+
status = "disabled";
149+
};
150+
};
151+
};

soc/openhwgroup/cva6/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_subdirectory(${SOC_SERIES})
5+
6+
zephyr_library_sources_ifdef(CONFIG_SOC_FAMILY_CVA6_PROVIDE_NONSTANDARD_CACHE_OPTIONS soc_cache_management.c)
7+
8+
set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/riscv/common/linker.ld CACHE INTERNAL "")

soc/openhwgroup/cva6/Kconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_FAMILY_OPENHWGROUP_CVA6
5+
6+
config SOC_FAMILY_CVA6_PROVIDE_NONSTANDARD_CACHE_OPTIONS
7+
bool "Include non-standard cache management operations (currently global cache disable)"
8+
9+
rsource "*/Kconfig"
10+
11+
endif # SOC_FAMILY_OPENHWGROUP_CVA6
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright (c) 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_FAMILY_OPENHWGROUP_CVA6
5+
6+
config SYS_CLOCK_HW_CYCLES_PER_SEC
7+
int
8+
default $(dt_node_int_prop_int,/cpus/cpu@0,timebase-frequency)
9+
10+
config RISCV_SOC_INTERRUPT_INIT
11+
default y
12+
13+
# highest implemented first-level interrupt is machine external, 11
14+
config 2ND_LVL_ISR_TBL_OFFSET
15+
default 12
16+
17+
config 2ND_LVL_INTR_00_OFFSET
18+
default 11
19+
20+
# 12 first level, 30 second level
21+
config MAX_IRQ_PER_AGGREGATOR
22+
default 42
23+
24+
# one 2nd level aggregator (PLIC) with 30 interrupts
25+
# offset of 12
26+
config NUM_IRQS
27+
default 42
28+
29+
config MULTI_LEVEL_INTERRUPTS
30+
default y
31+
32+
config 2ND_LEVEL_INTERRUPTS
33+
default y
34+
35+
# 1 PLIC
36+
config NUM_2ND_LEVEL_AGGREGATORS
37+
default 1
38+
39+
config PLIC
40+
default y
41+
42+
config 3RD_LEVEL_INTERRUPTS
43+
default n
44+
45+
endif # SOC_FAMILY_OPENHWGROUP_CVA6

soc/openhwgroup/cva6/Kconfig.soc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
#SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_FAMILY_OPENHWGROUP_CVA6
5+
bool
6+
help
7+
CVA6 RISC-V CPUs, commonly used as soft cores on FPGAs.
8+
There is a 64-bit version with imafdc extensions and sv39 MMU and
9+
several 32-bit configurations, optionally with up to imafdc and sv32 MMU.
10+
11+
config SOC_FAMILY
12+
default "openhwgroup_cva6" if SOC_FAMILY_OPENHWGROUP_CVA6
13+
14+
rsource "*/Kconfig.soc"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_sources()
5+
6+
zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_OPENHWGROUP_CVA6 ".")

soc/openhwgroup/cva6/cv32a6/Kconfig

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
# RISCV32 OpenHW Group cva6 configuration options
4+
5+
config SOC_CV32A6
6+
select RISCV
7+
select RISCV_PRIVILEGED
8+
select ATOMIC_OPERATIONS_BUILTIN
9+
select RISCV_HAS_PLIC
10+
select USE_SWITCH_SUPPORTED
11+
select USE_SWITCH
12+
select CPU_HAS_FPU
13+
select CPU_HAS_FPU_DOUBLE_PRECISION
14+
select SCHED_IPI_SUPPORTED
15+
select RISCV_ISA_RV32I
16+
select RISCV_ISA_EXT_M
17+
select RISCV_ISA_EXT_A
18+
select RISCV_ISA_EXT_ZICSR
19+
select RISCV_ISA_EXT_ZIFENCEI
20+
select CPU_HAS_DCACHE
21+
select CPU_HAS_ICACHE
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_CV32A6
5+
bool
6+
select SOC_FAMILY_OPENHWGROUP_CVA6
7+
help
8+
CVA6 32-bit RISC-V CPUs, commonly used as soft cores on FPGAs.
9+
This configuration works with the upstream project (https://github.com/openhwgroup/cva6).
10+
11+
config SOC_CV32A6
12+
bool
13+
select SOC_SERIES_CV32A6
14+
help
15+
Minimal CVA6 core in 32-bit configuration: ima extensions, no MMU or PMP,
16+
SoC with CLINT, PLIC, UART, SPI, and Ethernet (Xilinx or lowRISC).
17+
18+
config SOC_SERIES
19+
default "cv32a6" if SOC_SERIES_CV32A6
20+
21+
config SOC
22+
default "cv32a6" if SOC_CV32A6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2024 CISPA Helmholtz Center for Information Security gGmbH
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_sources()
5+
6+
zephyr_include_directories_ifdef(CONFIG_SOC_FAMILY_OPENHWGROUP_CVA6 ".")

0 commit comments

Comments
 (0)