Skip to content

Commit 52128f3

Browse files
committed
boards: qemu: Add support for qemu_max board
What is changed? - Added support for multi-core SMP with QEMU through the `qemu_max_qemu_max_smp` configuration and associated DTS and YAML files. - Updated SoC-specific configurations under `soc/arm/qemu_max`, including Kconfig, SoC-specific settings, and memory regions in `mmu_regions.c`. - Added device tree include file `qemu-virt-max.dtsi` for enhanced compatibility with the qemu_max board. Why do we need this change? - The qemu_max board supports the hardware features of ARMv8.1+, while the existing qemu_cortex_a53 does not. Signed-off-by: Guoqi Xie <[email protected]>
1 parent 759e31d commit 52128f3

21 files changed

+503
-1
lines changed

boards/qemu/max/Kconfig

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2024-2025 HNU-ESNL: Guoqi Xie, Chenglai Xiong, Xingyu Hu and etc.
2+
# Copyright 2024-2025 openEuler SIG-Zephyr
3+
# SPDX-License-Identifier: Apache-2.0

boards/qemu/max/Kconfig.defconfig

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2024-2025 HNU-ESNL: Guoqi Xie, Chenglai Xiong, Xingyu Hu and etc.
2+
# Copyright 2024-2025 openEuler SIG-Zephyr
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
if BOARD_QEMU_MAX
6+
7+
config BUILD_OUTPUT_BIN
8+
default y
9+
10+
config MAX_THREAD_BYTES
11+
default 3
12+
13+
# QEMU PCI requires at least 256M of virtual space
14+
config KERNEL_VM_SIZE
15+
default 0x80000000 if PCIE
16+
17+
# QEMU PCI requires physical addresses with more than 32 bits
18+
choice ARM64_VA_BITS
19+
default ARM64_VA_BITS_40 if PCIE
20+
endchoice
21+
22+
choice ARM64_PA_BITS
23+
default ARM64_PA_BITS_40 if PCIE
24+
endchoice
25+
26+
if QEMU_ICOUNT
27+
28+
config QEMU_ICOUNT_SHIFT
29+
default 4
30+
31+
config QEMU_ICOUNT_SLEEP
32+
default y
33+
34+
endif # QEMU_ICOUNT
35+
36+
endif # BOARD_QEMU_MAX

boards/qemu/max/Kconfig.qemu_max

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright 2024-2025 HNU-ESNL: Guoqi Xie, Chenglai Xiong, Xingyu Hu and etc.
2+
# Copyright 2024-2025 openEuler SIG-Zephyr
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config BOARD_QEMU_MAX
6+
select SOC_QEMU_MAX

boards/qemu/max/board.cmake

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2024-2025 HNU-ESNL: Guoqi Xie, Chenglai Xiong, Xingyu Hu and etc.
2+
# Copyright 2024-2025 openEuler SIG-Zephyr
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
set(SUPPORTED_EMU_PLATFORMS qemu)
6+
set(QEMU_ARCH aarch64)
7+
8+
set(QEMU_CPU_TYPE_${ARCH} max)
9+
10+
if(CONFIG_ARMV8_A_NS)
11+
set(QEMU_MACH virt,gic-version=3)
12+
else()
13+
set(QEMU_MACH virt,secure=on,gic-version=3)
14+
endif()
15+
16+
set(QEMU_FLAGS_${ARCH}
17+
-cpu ${QEMU_CPU_TYPE_${ARCH}}
18+
-nographic
19+
-machine ${QEMU_MACH}
20+
)
21+
22+
board_set_debugger_ifnset(qemu)

boards/qemu/max/board.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
board:
2+
name: qemu_max
3+
full_name: QEMU Emulation for ARM MAX
4+
vendor: arm
5+
socs:
6+
- name: qemu_max
7+
variants:
8+
- name: smp

boards/qemu/max/doc/index.rst

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
.. zephyr:board:: qemu_max
2+
3+
Overview
4+
********
5+
6+
This board configuration will use QEMU to emulate a generic MAX hardware
7+
platform.
8+
9+
This configuration provides support for an ARM MAX CPU and these
10+
devices:
11+
12+
* GIC-400 interrupt controller
13+
* ARM architected timer
14+
* PL011 UART controller
15+
16+
Hardware
17+
********
18+
Supported Features
19+
==================
20+
21+
The following hardware features are supported:
22+
23+
+--------------+------------+----------------------+
24+
| Interface | Controller | Driver/Component |
25+
+==============+============+======================+
26+
| GIC | on-chip | interrupt controller |
27+
+--------------+------------+----------------------+
28+
| PL011 UART | on-chip | serial port |
29+
+--------------+------------+----------------------+
30+
| ARM TIMER | on-chip | system clock |
31+
+--------------+------------+----------------------+
32+
33+
The kernel currently does not support other hardware features on this platform.
34+
35+
Devices
36+
========
37+
System Clock
38+
------------
39+
40+
This board configuration uses a system clock frequency of 62.5 MHz.
41+
42+
Serial Port
43+
-----------
44+
45+
This board configuration uses a single serial communication channel with the
46+
CPU's UART0.
47+
48+
Known Problems or Limitations
49+
==============================
50+
51+
The following platform features are unsupported:
52+
53+
* Writing to the hardware's flash memory
54+
55+
56+
Programming and Debugging
57+
*************************
58+
59+
Use this configuration to run basic Zephyr applications and kernel tests in the QEMU
60+
emulated environment, for example, with the :zephyr:code-sample:`synchronization` sample:
61+
62+
.. zephyr-app-commands::
63+
:zephyr-app: samples/synchronization
64+
:host-os: unix
65+
:board: qemu_max
66+
:goals: run
67+
68+
This will build an image with the synchronization sample app, boot it using
69+
QEMU, and display the following console output:
70+
71+
.. code-block:: console
72+
73+
***** Booting Zephyr OS build zephyr-v2.0.0-1657-g99d310da48e5 *****
74+
threadA: Hello World from cpu 0 on qemu_max!
75+
threadB: Hello World from cpu 0 on qemu_max!
76+
threadA: Hello World from cpu 0 on qemu_max!
77+
threadB: Hello World from cpu 0 on qemu_max!
78+
threadA: Hello World from cpu 0 on qemu_max!
79+
threadB: Hello World from cpu 0 on qemu_max!
80+
threadA: Hello World from cpu 0 on qemu_max!
81+
threadB: Hello World from cpu 0 on qemu_max!
82+
83+
Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
84+
85+
Debugging
86+
=========
87+
88+
Refer to the detailed overview about :ref:`application_debugging`.
89+
90+
Networking
91+
==========
92+
93+
The board supports the QEMU built-in Ethernet adapter to connect to the host
94+
system. See :ref:`networking_with_eth_qemu` for details.
95+
96+
It is also possible to use SLIP networking over an emulated serial port.
97+
Although this board only supports a single UART, so subsystems like logging
98+
and shell would need to be disabled, therefore this is not directly supported.
99+
100+
References
101+
**********
102+
103+
.. target-notes::
104+
105+
1. (ID050815) ARM® Cortex®-A Series - Programmer’s Guide for ARMv8-A
106+
2. (ID070919) Arm® Architecture Reference Manual - Armv8, for Armv8-A architecture profile
107+
3. (ARM DAI 0527A) Application Note Bare-metal Boot Code for ARMv8-A Processors
108+
4. AArch64 Exception and Interrupt Handling
109+
5. Fundamentals of ARMv8-A

boards/qemu/max/qemu_max.dts

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2024-2025 HNU-ESNL: Guoqi Xie, Chenglai Xiong, Xingyu Hu and etc.
3+
* Copyright 2024-2025 openEuler SIG-Zephyr
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
/dts-v1/;
9+
#include <arm64/qemu/qemu-virt-max.dtsi>
10+
11+
/ {
12+
model = "QEMU MAX";
13+
compatible = "qemu,arm-max";
14+
15+
psci {
16+
compatible = "arm,psci-0.2";
17+
method = "hvc";
18+
};
19+
20+
chosen {
21+
zephyr,sram = &sram0;
22+
zephyr,console = &uart0;
23+
zephyr,shell-uart = &uart0;
24+
zephyr,flash = &flash0;
25+
};
26+
27+
soc {
28+
sram0: memory@40000000 {
29+
compatible = "mmio-sram";
30+
reg = <0x0 0x40000000 0x0 DT_SIZE_M(128)>;
31+
};
32+
};
33+
34+
};
35+
36+
&uart0 {
37+
status = "okay";
38+
current-speed = <115200>;
39+
};

boards/qemu/max/qemu_max.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
identifier: qemu_max
2+
name: QEMU Emulation for ARM MAX
3+
type: qemu
4+
simulation:
5+
- name: qemu
6+
arch: arm64
7+
toolchain:
8+
- zephyr
9+
- cross-compile
10+
ram: 128
11+
ram: 131072
12+
testing:
13+
default: true
14+
ignore_tags:
15+
- net
16+
- bluetooth
17+
vendor: qemu

boards/qemu/max/qemu_max_defconfig

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CONFIG_ARM_ARCH_TIMER=y
2+
3+
# Cache management
4+
CONFIG_CACHE_MANAGEMENT=y
5+
6+
# Enable UART driver
7+
CONFIG_SERIAL=y
8+
9+
# Enable console
10+
CONFIG_CONSOLE=y
11+
CONFIG_UART_CONSOLE=y
12+
13+
# Enable serial port
14+
CONFIG_UART_INTERRUPT_DRIVEN=y
15+
16+
# Avoid timing skew in tests
17+
CONFIG_QEMU_ICOUNT=y
18+
19+
20+
# MMU Options
21+
CONFIG_MAX_XLAT_TABLES=32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright 2024-2025 HNU-ESNL: Guoqi Xie, Chenglai Xiong, Xingyu Hu and etc.
3+
* Copyright 2024-2025 openEuler SIG-Zephyr
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
#include "qemu_max.dts"
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
identifier: qemu_max/qemu_max/smp
2+
name: QEMU Emulation for MAX SMP (ARM)
3+
type: qemu
4+
simulation:
5+
- name: qemu
6+
arch: arm64
7+
toolchain:
8+
- zephyr
9+
- cross-compile
10+
ram: 128
11+
supported:
12+
- smp
13+
testing:
14+
default: true
15+
ignore_tags:
16+
- net
17+
- bluetooth
18+
vendor: qemu
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
CONFIG_ARM_ARCH_TIMER=y
2+
3+
# Cache management
4+
CONFIG_CACHE_MANAGEMENT=y
5+
6+
# Enable UART driver
7+
CONFIG_SERIAL=y
8+
9+
# Enable console
10+
CONFIG_CONSOLE=y
11+
CONFIG_UART_CONSOLE=y
12+
13+
# Enable serial port
14+
CONFIG_UART_INTERRUPT_DRIVEN=y
15+
16+
# icount does not work well with SMP
17+
CONFIG_QEMU_ICOUNT=n
18+
19+
# We have multiple QEMU-A53 boards, so let us exercise ARMV8_A_NS on this one
20+
# (plus it is needed for SMP)
21+
CONFIG_ARMV8_A_NS=y
22+
23+
# PSCI is supported with NS
24+
CONFIG_PM_CPU_OPS=y
25+
26+
# SMP-related
27+
CONFIG_SMP=y
28+
CONFIG_MP_MAX_NUM_CPUS=2
29+
CONFIG_TIMEOUT_64BIT=y
30+
31+
# MMU Options
32+
CONFIG_MAX_XLAT_TABLES=32

0 commit comments

Comments
 (0)