Skip to content

Commit ccd59a4

Browse files
michalsimeknashif
authored andcommitted
meta-zephyr-sdk: xilinx_qemu: Enable CPU timers and emaclite for MB-V
Model available in Xilinx v2025.1 version is missing CPU timers which can be used by Zephyr that's why wire them. And also enable EMACLITE network IP to have model for it available. Signed-off-by: Michal Simek <michal.simek@amd.com>
1 parent 116f43d commit ccd59a4

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
From 42593cded8643f4bd365a51c7d83fec601e49167 Mon Sep 17 00:00:00 2001
2+
Message-ID: <42593cded8643f4bd365a51c7d83fec601e49167.1747662482.git.michal.simek@amd.com>
3+
From: Michal Simek <michal.simek@amd.com>
4+
Date: Fri, 25 Apr 2025 09:24:48 +0200
5+
Subject: [PATCH] riscvXX-softmmu: Enable emaclite driver for MB-V
6+
7+
Emaclite can be also wired with MB-V that's why enable it by default.
8+
9+
Signed-off-by: Michal Simek <michal.simek@amd.com>
10+
Signed-off-by: Francisco Iglesias <francisco.iglesias@amd.com>
11+
---
12+
configs/devices/riscv32-softmmu/default.mak | 1 +
13+
configs/devices/riscv64-softmmu/default.mak | 1 +
14+
2 files changed, 2 insertions(+)
15+
16+
diff --git a/configs/devices/riscv32-softmmu/default.mak b/configs/devices/riscv32-softmmu/default.mak
17+
index c6c3dcd4431a..7845858ae87c 100644
18+
--- a/configs/devices/riscv32-softmmu/default.mak
19+
+++ b/configs/devices/riscv32-softmmu/default.mak
20+
@@ -33,6 +33,7 @@ CONFIG_XILINX_IOMODULE_PIT=y
21+
CONFIG_XILINX_IOMODULE_GPI=y
22+
CONFIG_XILINX_IOMODULE_GPO=y
23+
CONFIG_XILINX_IOMODULE_INTC=y
24+
+CONFIG_XILINX_ETHLITE=y
25+
26+
CONFIG_XLNX_ZYNQMP=y
27+
CONFIG_XLNX_VERSAL=y
28+
diff --git a/configs/devices/riscv64-softmmu/default.mak b/configs/devices/riscv64-softmmu/default.mak
29+
index 4886ca35dcb7..4f5528eeda9a 100644
30+
--- a/configs/devices/riscv64-softmmu/default.mak
31+
+++ b/configs/devices/riscv64-softmmu/default.mak
32+
@@ -20,6 +20,7 @@ CONFIG_XILINX=y
33+
CONFIG_SSI=y
34+
CONFIG_I2C=y
35+
CONFIG_XILINX_AXI=y
36+
+CONFIG_XILINX_ETHLITE=y
37+
CONFIG_XILINX_SPI=y
38+
CONFIG_XILINX_SPIPS=y
39+
CONFIG_PTIMER=y
40+
--
41+
2.43.0
42+
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
From 2b117b43bb34d5da17d096504c518ab5eaa362f0 Mon Sep 17 00:00:00 2001
2+
Message-ID: <2b117b43bb34d5da17d096504c518ab5eaa362f0.1747662482.git.michal.simek@amd.com>
3+
From: Michal Simek <michal.simek@amd.com>
4+
Date: Fri, 25 Apr 2025 09:54:45 +0200
5+
Subject: [PATCH] riscv: Wire CPU timers
6+
7+
Our HW is supporting them and FDT model is not wiring them.
8+
9+
Signed-off-by: Michal Simek <michal.simek@amd.com>
10+
---
11+
target/riscv/cpu.c | 25 +++++++++++++------------
12+
1 file changed, 13 insertions(+), 12 deletions(-)
13+
14+
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
15+
index 2685728f8a28..3bd69a961830 100644
16+
--- a/target/riscv/cpu.c
17+
+++ b/target/riscv/cpu.c
18+
@@ -553,6 +553,18 @@ static void rv128_base_cpu_init(Object *obj)
19+
#endif
20+
}
21+
#else
22+
+#ifndef CONFIG_USER_ONLY
23+
+static uint64_t mb_v_rdtime(void *opaque)
24+
+{
25+
+ CPURISCVState *env = &RISCV_CPU(opaque)->env;
26+
+ uint32_t time, timeh;
27+
+
28+
+ csr_ops[CSR_MCYCLE].read(env, CSR_MCYCLE, &time);
29+
+ csr_ops[CSR_MCYCLEH].read(env, CSR_MCYCLEH, &timeh);
30+
+ return (uint64_t) timeh << 32 | time;
31+
+}
32+
+#endif
33+
+
34+
static void rv32_base_cpu_init(Object *obj)
35+
{
36+
CPURISCVState *env = &RISCV_CPU(obj)->env;
37+
@@ -562,6 +574,7 @@ static void rv32_base_cpu_init(Object *obj)
38+
env->priv_ver = PRIV_VERSION_LATEST;
39+
#ifndef CONFIG_USER_ONLY
40+
set_satp_mode_max_supported(RISCV_CPU(obj), VM_1_10_SV32);
41+
+ riscv_cpu_set_rdtime_fn(env, mb_v_rdtime, obj);
42+
#endif
43+
}
44+
45+
@@ -634,18 +647,6 @@ static void rv32_imafcu_nommu_cpu_init(Object *obj)
46+
cpu->cfg.pmp = true;
47+
}
48+
49+
-#ifndef CONFIG_USER_ONLY
50+
-static uint64_t mb_v_rdtime(void *opaque)
51+
-{
52+
- CPURISCVState *env = &RISCV_CPU(opaque)->env;
53+
- uint32_t time, timeh;
54+
-
55+
- csr_ops[CSR_MCYCLE].read(env, CSR_MCYCLE, &time);
56+
- csr_ops[CSR_MCYCLEH].read(env, CSR_MCYCLEH, &timeh);
57+
- return (uint64_t) timeh << 32 | time;
58+
-}
59+
-#endif
60+
-
61+
static void rv32_microblaze_v_cpu_init(Object *obj)
62+
{
63+
#ifndef CONFIG_USER_ONLY
64+
--
65+
2.43.0
66+

meta-zephyr-sdk/recipes-devtools/qemu_xilinx/qemu-xilinx_git.bb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ SRC_URI += "gitsm://github.com/Xilinx/qemu.git;protocol=https;nobranch=1;name=qe
1414
file://0004-configure-Add-pkg-config-handling-for-libgcrypt.patch \
1515
file://0001-Revert-target-arm-Revert-back-to-YIELD-for-WFI.patch \
1616
file://0002-Enable-WFI-CPU-halting-in-icount-mode.patch \
17+
file://0003-riscvXX-softmmu-Enable-emaclite-driver-for-MB-V.patch \
18+
file://0004-riscv-Wire-CPU-timers.patch \
1719
file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \
1820
file://fixedmeson.patch \
1921
file://no-pip.patch \

0 commit comments

Comments
 (0)