Skip to content

Commit eb82d0d

Browse files
GuEe-GUIRbb666
authored andcommitted
[bsp][qemu-virt64-aarch64] update doc for RT-Thread#11232
Link: RT-Thread#11232 Signed-off-by: GuEe-GUI <2991707448@qq.com>
1 parent 8fefb3a commit eb82d0d

3 files changed

Lines changed: 55 additions & 97 deletions

File tree

bsp/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ This document is based on the RT-Thread mainline repository and categorizes the
247247

248248
#### 🟢 QEMU Virt64 AArch64 (RT-Smart) (SMP)
249249

250-
| BSP Name | GPIO | UART | RTC | VirtIO-BLK | VirtIO-NET | VirtIO-Console | VirtIO-GPU | VirtIO-Input |
251-
|----------|------|------|-----|-----------|-----------|---------------|-----------|--------------|
252-
| [qemu-virt64-aarch64](qemu-virt64-aarch64) ||||| - ||||
250+
| BSP Name | GPIO | UART | RTC | WDT | PCI | Storage | Flash | LCD | Input | Camera | Sound | Crypto | RNG | Net | Console | RPMSG |
251+
|----------|------|------|-----|-----|-----|---------|-------|-----|-------|--------|-------|--------|-----|-----|---------|-------|
252+
| [qemu-virt64-aarch64](qemu-virt64-aarch64) ||||| |||||||| ||||
253253

254254
#### 🟡 Phytium (RT-Smart) (SMP)
255255

bsp/qemu-virt64-aarch64/README.md

Lines changed: 26 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ msh />
110110

111111
| Option | Default | Description |
112112
| ------ | ------- | ----------- |
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 |
115115
| `-mem` | `128` | Memory size (MB) |
116116
| `-el` | `1` | Exception level: `1` default; `2` virtualization on; `3` secure on |
117117
| `-bootargs` | see below | Kernel boot arguments |
118118
| `-initrd` || Path to initrd image |
119-
| `-graphic` || Graphics mode (ramfb + VirtIO keyboard/tablet), replaces `-nographic` |
119+
| `-graphic` || Graphics mode (ramfb + `virtio-gpu-device` + VirtIO keyboard/tablet), replaces `-nographic` |
120120
| `-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` |
121121
| `-debug` || Enable GDB debugging (`-S -s`) |
122122
| `-dumpdtb` || Export runtime DTB and convert to DTS |
@@ -133,8 +133,8 @@ msh />
133133
| `-tap` || Use TAP networking (replaces user mode) |
134134
| `-ssh` | `12055` | SSH port forwarding in user mode (`hostfwd=tcp::PORT-:22`) |
135135
| `-9p` || VirtIO 9P shared directory path (enable VirtIO 9P in menuconfig) |
136-
| `-camera` || Enable vfio-user camera (Linux only, with `qemu-device-camera`) |
137-
| `-dtbo` || AMP mode: DTBO overlay file (e.g. `amp.dtsi`); **requires Smart kernel** (see below) |
136+
| `-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) |
138138

139139
Default `-bootargs`:
140140

@@ -156,7 +156,7 @@ QEMU OpenGL display (`-gl`):
156156
./qemu.py -graphic -gl gtk
157157
```
158158

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.
160160
161161
GDB debugging:
162162

@@ -194,14 +194,16 @@ AMP heterogeneous multi-core (RPMSG slave, **requires Smart version**):
194194
./qemu.py -dtbo amp.dtsi -mem 258
195195
```
196196

197-
> **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.
198198
199-
Camera demo:
199+
Camera demo (requires `-graphic` for framebuffer overlay in `camera.c`):
200200

201201
```
202-
./qemu.py -graphic -camera
202+
./qemu.py -graphic -camera /dev/video0
203203
```
204204

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+
205207
### 3.6 Console and Telnet
206208

207209
| Port | Device | Description |
@@ -231,7 +233,7 @@ TAP requires bridge setup on Linux; support on Windows / WSL is limited. SSH por
231233

232234
## 4. Default QEMU Devices
233235

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.
235237

236238
| QEMU device | Image file | RT-Thread side |
237239
| ----------- | ---------- | -------------- |
@@ -242,7 +244,7 @@ TAP requires bridge setup on Linux; support on Windows / WSL is limited. SSH por
242244
| `sdhci-pci` + `sd-card` | `emmc.qcow2` | SDHCI eMMC (enable SDIO) |
243245
| `nvme` + `nvme-ns` | `nvme.qcow2` | NVMe |
244246
| `ahci` + `ide-hd` | `ahci.qcow2` | AHCI SATA |
245-
| `ufs` + `ufs-lu` | `ufs.qcow2` | UFS (QEMU ≥ 8.2.0) |
247+
| `ufs` + `ufs-lu` (QEMU ≥ 8.2.0 only) | `ufs.qcow2` | UFS |
246248
| `virtio-net-device` || VirtIO Net (enable network stack) |
247249
| `virtio-rng-device` || VirtIO RNG |
248250
| `virtio-crypto-device` || VirtIO Crypto |
@@ -256,7 +258,7 @@ TAP requires bridge setup on Linux; support on Windows / WSL is limited. SSH por
256258
| `virtio-keyboard-device` / `virtio-tablet-device` || VirtIO Input |
257259
| `virtio-9p-device` (`-9p`) || VirtIO 9P (enable driver) |
258260
| `virtio-sound-pci` (`-sound virtio`) || VirtIO Sound |
259-
| vfio-user camera (`-camera`) | | PCI camera (BSP `drv_camera`) |
261+
| vfio-user camera (`-camera <path>`) | host V4L2 device | PCI camera (BSP `drv_camera`) |
260262

261263
## 5. Driver Support
262264

@@ -268,7 +270,6 @@ TAP requires bridge setup on Linux; support on Windows / WSL is limited. SSH por
268270
| Serial | 8250 PCI | PCI serial, Telnet port 4322 |
269271
| RTC | PL031 | Real-time clock |
270272
| GPIO | PL061 | GPIO controller |
271-
| Clock | ARM Architected Timer | System tick |
272273
| Watchdog | I6300ESB | PCI watchdog |
273274
| Storage | VirtIO Block | Block device, `vda` |
274275
| Storage | VirtIO SCSI | SD / CD-ROM |
@@ -278,31 +279,19 @@ TAP requires bridge setup on Linux; support on Windows / WSL is limited. SSH por
278279
| Storage | MTD NOR CFI | pflash flash |
279280
| Storage | BLK partition | DFS / EFI partition table |
280281
| Graphics | VirtIO GPU | 2D framebuffer (`-graphic`); no OpenGL / VirGL |
281-
| Graphics | Framebuffer | ROMFB 800×600, HMI / graphics tests |
282+
| Graphics | Framebuffer | RAMFB 800×600 (`RT_GRAPHIC_ROMFB_WIDTH` / `HEIGHT`, `drv_romfb.c`) |
282283
| Graphics | LCD | LCD device framework |
283284
| Input | VirtIO Input | Keyboard, mouse, tablet (`-graphic`) |
284-
| Input | Touchscreen | Touchscreen framework |
285-
| Input | Keyboard GPIO | GPIO keyboard |
286-
| Input | Power | Power key |
287285
| Audio | Intel HDA | Default `-sound hda` |
288286
| Audio | VirtIO Sound | `-sound virtio` |
289-
| Crypto | HwCrypto | AES / DES / 3DES / RC4 / RNG |
290287
| Crypto | VirtIO Crypto | VirtIO crypto backend |
291288
| Random | VirtIO RNG | Hardware random number |
292289
| Comm | VirtIO Console | Telnet 4321 |
293-
| Comm | VirtIO RPROC Serial | Remoteproc serial link |
294290
| Comm | RPMSG | VirtIO RPMSG character device |
295291
| Comm | Mailbox PIC | Mailbox interrupt controller |
296292
| Firmware | QEMU FW_CFG | Firmware configuration interface |
297293
| Bus | PCI | ECAM + Generic Host, MSI / MSI-X |
298-
| Bus | VirtIO | MMIO + PCI transport |
299-
| IRQ | GICv2 / GICv3 / ITS | Including GICv2m MSI |
300-
| Devicetree | OFW / FDT | Dynamic devicetree parsing |
301-
| Other | DMA | DMA framework |
302-
| Other | MFD EDU / SYSCON | Multi-function devices |
303-
| Other | Regulator / Reset | Power and reset framework |
304-
| Filesystem | DFS v2 | FatFs, devfs, romfs |
305-
| POSIX | Partial APIs | poll / select / termios / pipe, etc. |
294+
| Other | MFD EDU | Multi-function device |
306295

307296
### 5.2 Not Enabled by Default but Available via menuconfig
308297

@@ -313,26 +302,15 @@ This BSP enables the PCI bus and VirtIO PCI transport; QEMU also attaches the co
313302
| VirtIO Net | `RT_USING_SAL` + `RT_USING_LWIP` + `RT_USING_ETHERNET` | `virtio-net-device` | Network stack not enabled by default |
314303
| VirtIO 9P | `RT_VIRTIO_9P` | `virtio-9p-device` | Use with `-9p` shared directory |
315304
| SDHCI eMMC | `RT_USING_SDIO` + `RT_SDIO_SDHCI_PCI` | `sdhci-pci` | eMMC storage |
316-
| SDIO DW MMC PCI | `RT_USING_SDIO` + `RT_SDIO_DW_MMC_PCI` || DesignWare MMC |
317-
| USB | `RT_USING_USB_HOST` / `RT_USING_USB_DEVICE` | Add USB controller manually | Not a default QEMU device |
318-
| CherryUSB | `RT_USING_CHERRYUSB` | Add USB controller manually ||
319-
| I2C / SPI | `RT_USING_I2C` / `RT_USING_SPI` | Depends on PCI device | Requires matching PCI controller driver |
320-
| CAN | `RT_USING_CAN` | Depends on PCI device ||
321-
| Sensor | `RT_USING_SENSOR` |||
322-
| WiFi | `RT_USING_WIFI` |||
323-
| PM | `RT_USING_PM` |||
324-
| Pinctrl | `RT_USING_PINCTRL` |||
325-
| SCMI firmware | `RT_FIRMWARE_ARM_SCMI` + `RT_VIRTIO_SCMI` |||
326305

327306
> **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`.
328307
329308
### 5.3 BSP-Specific Features (Driver Layer)
330309

331310
| Feature | Config | Startup |
332311
| ------- | ------ | ------- |
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` |
312+
| RAMFB resolution | `RT_GRAPHIC_ROMFB_WIDTH` / `RT_GRAPHIC_ROMFB_HEIGHT` | `-graphic` (`drv_romfb.c` supplies size to RAMFB) |
313+
| Camera driver | `RT_SOC_CAMERA` | `-camera <v4l2-path>`; use `-graphic` for `camera.c` preview |
336314

337315
### 5.4 Sample Applications (`applications/`)
338316

@@ -348,9 +326,9 @@ Default application. Prints `hello rt-thread` after boot, then enters msh.
348326

349327
**`amp.c` (AMP + RPMSG)**
350328

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.
352330

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.
354332

355333
Startup:
356334

@@ -374,10 +352,10 @@ An RPMSG endpoint is created automatically at boot (`rpmsg_char0`, endpoint name
374352

375353
Centers and overlays the vfio-user PCI camera feed onto the framebuffer. Default devices `camera0``fb0`, runs for about 10 seconds (300 frames).
376354

377-
Startup:
355+
Startup (Linux host with libvfio-user and a V4L2 camera):
378356

379357
```
380-
./qemu.py -graphic -camera
358+
./qemu.py -graphic -camera /dev/video0
381359
```
382360

383361
msh command:
@@ -414,9 +392,10 @@ Optional VirtIO device arguments (add in `qemu.py` as needed):
414392

415393
## 8. Notes After Configuration Changes
416394

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.
419397
- 9P directory sharing requires QEMU built with virtfs (`--enable-virtfs`).
420398
- `-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.
422401
- Override root device or boot parameters via `-bootargs`.

0 commit comments

Comments
 (0)