You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bsp/qemu-virt64-aarch64/README.md
+26-47Lines changed: 26 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -110,13 +110,13 @@ msh />
110
110
111
111
| Option | Default | Description |
112
112
| ------ | ------- | ----------- |
113
-
|`-gic`|`2`| GIC version (`2`/`3` / `max`); auto-switches to GICv3 when `-smp` > 8 |
114
-
|`-smp`|`RT_CPUS_NR` (4) | Number of CPU cores |
113
+
|`-gic`|`2`| GIC version (`2`or`3`); auto-switches to GICv3 when `-smp` > 8; with `-el 2` and GICv3, internally uses `gic-version=max` (not passable via `-gic max`)|
114
+
|`-smp`|`RT_CPUS_NR` (4) | Number of CPU cores; `-dtbo` adds 1 automatically when `amp_soc` is present|
|`-gl`| — | In graphics mode, attach `virtio-gpu-gl-pci` and enable QEMU display OpenGL (e.g. `-gl gtk`); requires QEMU built with `--enable-opengl` and `--enable-virglrenderer`; must be used with `-graphic`|
121
121
|`-debug`| — | Enable GDB debugging (`-S -s`) |
122
122
|`-dumpdtb`| — | Export runtime DTB and convert to DTS |
@@ -133,8 +133,8 @@ msh />
133
133
|`-tap`| — | Use TAP networking (replaces user mode) |
134
134
|`-ssh`|`12055`| SSH port forwarding in user mode (`hostfwd=tcp::PORT-:22`) |
|`-camera`| — |Host V4L2 device path (e.g. `/dev/video0`); Linux only; read access to the device is required (usually add your user to the `video` group); compiles and runs `qemu-device-camera.c` in the background, then attaches a vfio-user PCI camera (requires **libvfio-user**) |
137
+
|`-dtbo`| — | AMP mode: DTBO overlay file (e.g. `amp.dtsi`); auto-increments `-smp` by 1; **requires Smart kernel** and sufficient `-mem` (see below) |
138
138
139
139
Default `-bootargs`:
140
140
@@ -156,7 +156,7 @@ QEMU OpenGL display (`-gl`):
156
156
./qemu.py -graphic -gl gtk
157
157
```
158
158
159
-
> **Note**: `-gl` enables OpenGL only on the QEMU / host display path (`virtio-gpu-gl-pci` + VirGL). This BSP includes only the VirtIO GPU 2D framebuffer driver by default — **no OpenGL / VirGL user-space or kernel implementation**. `-gl` does not provide OpenGL acceleration inside RT-Thread. For graphics demos, use `-graphic` (`virtio-gpu-device`) with framebuffer / HMI tests.
159
+
> **Note**: `-gl` enables OpenGL only on the QEMU / host display path (`virtio-gpu-gl-pci` + VirGL). This BSP includes only the VirtIO GPU 2D framebuffer driver by default — **no OpenGL / VirGL user-space or kernel implementation**. `-gl` does not provide OpenGL acceleration inside RT-Thread. For graphics demos, use `-graphic` (`virtio-gpu-device`) with the framebuffer stack.
> **Note**: The AMP demo requires the **Smart version** (`RT_USING_SMART`). The standard kernel must run in a region where virtual addresses equal physical addresses. The slave image is loaded by QEMU `loader` to fixed physical addresses specified in `amp.dtsi` (e.g. `kernel-entry = 0x48480000`), which differs from the primary MMU layout; the standard kernel cannot boot correctly in that address space. Enable Smart in menuconfig and rebuild.
197
+
> **Note**: The AMP demo requires the **Smart version** (`RT_USING_SMART`) and **`-mem 258`** (memory layout in `amp.dtsi` needs ~258 MB; the default 128 MB is insufficient). `qemu.py` also increments `-smp` by 1 when `amp_soc`is detected (e.g. `RT_CPUS_NR=4` runs as `-smp 5`). QEMU `loader`pre-loads `amp.dtb` and `rtthread.bin`to fixed physical addresses in `amp.dtsi` (e.g. `kernel-entry = 0x48480000`); the primary core then starts the slave via PSCI. The standard kernel must run in a region where virtual addresses equal physical addresses and cannot be used for the slave address space. Enable Smart in menuconfig and rebuild.
198
198
199
-
Camera demo:
199
+
Camera demo (requires `-graphic` for framebuffer overlay in `camera.c`):
200
200
201
201
```
202
-
./qemu.py -graphic -camera
202
+
./qemu.py -graphic -camera /dev/video0
203
203
```
204
204
205
+
> **Note**: `-camera` requires a host V4L2 device path. On Linux, install [libvfio-user](https://github.com/nutanix/libvfio-user) first (see comments in `qemu-device-camera.c`), and ensure your user can read the device node (e.g. `sudo usermod -aG video $USER` then log in again, or check with `ls -l /dev/video0`). Open will also fail if another program is using the camera. The script compiles `qemu-device-camera.c`, waits for `/tmp/qemu-device-camera.sock`, starts QEMU, and stops the helper process when QEMU exits.
206
+
205
207
### 3.6 Console and Telnet
206
208
207
209
| Port | Device | Description |
@@ -231,7 +233,7 @@ TAP requires bridge setup on Linux; support on Windows / WSL is limited. SSH por
231
233
232
234
## 4. Default QEMU Devices
233
235
234
-
`qemu.py` attaches the following devices by default (matching the default driver configuration):
236
+
`qemu.py` attaches the following devices by default (matching the default driver configuration). UFS is included only when QEMU ≥ 8.2.0; optional devices are listed with their triggering option.
235
237
236
238
| QEMU device | Image file | RT-Thread side |
237
239
| ----------- | ---------- | -------------- |
@@ -242,7 +244,7 @@ TAP requires bridge setup on Linux; support on Windows / WSL is limited. SSH por
> **Note**: Any PCI driver marked `depends on RT_USING_PCI` can be enabled on this BSP via menuconfig. If QEMU does not attach the device by default, add the corresponding `-device` argument in `qemu.py`.
328
307
329
308
### 5.3 BSP-Specific Features (Driver Layer)
330
309
331
310
| Feature | Config | Startup |
332
311
| ------- | ------ | ------- |
333
-
| HMI graphics test |`RT_GRAPHIC_HMI_TEST`|`-graphic` (embedded in `drv_romfb.c`) |
334
-
| Graphics draw test |`RT_GRAPHIC_GRAPHIC_TEST`|`-graphic` (embedded in `drv_romfb.c`) |
335
-
| Camera driver |`RT_SOC_CAMERA`|`-graphic -camera`|
| Camera driver |`RT_SOC_CAMERA`|`-camera <v4l2-path>`; use `-graphic` for `camera.c` preview |
336
314
337
315
### 5.4 Sample Applications (`applications/`)
338
316
@@ -348,9 +326,9 @@ Default application. Prints `hello rt-thread` after boot, then enters msh.
348
326
349
327
**`amp.c` (AMP + RPMSG)**
350
328
351
-
The primary core boots an additional CPU running RT-Thread as slave via the `amp_soc` devicetree node and PSCI. Primary and slave communicate through VirtIO RPMSG and Mailbox. The primary writes VirtIO Block `vdb` resource info into the slave DTB before starting the slave.
329
+
QEMU `loader` pre-loads `amp.dtb` and `rtthread.bin` to addresses in `amp.dtsi`; the primary core then boots the slave CPU via the `amp_soc` devicetree node and PSCI. Primary and slave communicate through VirtIO RPMSG and Mailbox. The primary writes VirtIO Block `vdb` resource info into the slave DTB before starting the slave. `qemu.py` increments `-smp` by 1 for the extra CPU.
352
330
353
-
**Version requirement**: **Smart version** required (`RT_USING_SMART` in menuconfig). The standard kernel must run with virtual addresses equal to physical addresses. The AMP slave is loaded by QEMU into a separate physical memory region (see `amp_memory`, `kernel-entry` in `amp.dtsi`), which violates that constraint — the standard kernel cannot be used for AMP demos.
331
+
**Version requirement**: **Smart version** required (`RT_USING_SMART` in menuconfig), plus **`-mem 258`**. The standard kernel must run with virtual addresses equal to physical addresses. The AMP slave is loaded into a separate physical memory region (see `amp_memory`, `kernel-entry` in `amp.dtsi`), which violates that constraint — the standard kernel cannot be used for AMP demos.
354
332
355
333
Startup:
356
334
@@ -374,10 +352,10 @@ An RPMSG endpoint is created automatically at boot (`rpmsg_char0`, endpoint name
374
352
375
353
Centers and overlays the vfio-user PCI camera feed onto the framebuffer. Default devices `camera0` → `fb0`, runs for about 10 seconds (300 frames).
376
354
377
-
Startup:
355
+
Startup (Linux host with libvfio-user and a V4L2 camera):
378
356
379
357
```
380
-
./qemu.py -graphic -camera
358
+
./qemu.py -graphic -camera /dev/video0
381
359
```
382
360
383
361
msh command:
@@ -414,9 +392,10 @@ Optional VirtIO device arguments (add in `qemu.py` as needed):
414
392
415
393
## 8. Notes After Configuration Changes
416
394
417
-
- After changing CPU count, adjust `qemu.py -smp` or rebuild so `RT_CPUS_NR` matches.
418
-
- GIC auto-switches to v3 when exceeding 8 cores; or specify `-gic 3` manually.
395
+
- After changing CPU count, rebuild so `RT_CPUS_NR` matches (or override with `qemu.py -smp`). In `-dtbo` mode, `qemu.py` adds 1 to the CPU count automatically.
396
+
- GIC auto-switches to v3 when exceeding 8 cores; or specify `-gic 3` manually.`gic-version=max` is set only internally when using `-el 2` with GICv3.
419
397
- 9P directory sharing requires QEMU built with virtfs (`--enable-virtfs`).
420
398
-`-gl` requires QEMU built with OpenGL / VirGL (`--enable-opengl`, `--enable-virglrenderer`); this is independent of RT-Thread OpenGL support — the default software stack is 2D graphics only.
421
-
- AMP (`-dtbo`) requires Smart kernel (`RT_USING_SMART`); the standard kernel requires VA=PA and cannot be used with slave images loaded at fixed physical addresses.
399
+
- AMP (`-dtbo`) requires Smart kernel (`RT_USING_SMART`), `-mem 258`, and auto-increments CPU count; the standard kernel requires VA=PA and cannot be used with slave images loaded at fixed physical addresses.
400
+
-`-camera` requires a host V4L2 device path, Linux, and libvfio-user; your user must have read access to the device (typically via the `video` group); `-graphic` is needed only for the `camera.c` framebuffer preview demo.
422
401
- Override root device or boot parameters via `-bootargs`.
0 commit comments