CV-Bowen opened a new pull request, #22074:
URL: https://github.com/apache/nuttx/pull/22074
## Summary
Updates to the sim rptun resource table (`arch/sim/src/sim/sim_rptun.c`):
- `add a virtio serial device to the resource table`: a fourth vdev,
VIRTIO_ID_CONSOLE with two vrings, so virtio-serial on the master and
vhost-serial on the slave have a device to bind. vhost-serial forwards
it to the slave's `/dev/ttyVH0`. The vdev is appended last; the
offsets of the existing vdevs do not move.
- `take the rpmsg CPU names from the configuration`: the rpmsg vdev used
the literals "server" and "proxy". Use `CONFIG_RPMSG_LOCAL_CPUNAME`
for the host and the name passed to `sim_rptun_init()` for the remote.
- `name the carveouts after the vdev they back`: `vdev<N>buffer`, the
form the other in-tree rptun tables already use. No functional change.
## Impact
- The sim resource table has one more vdev and a larger shared memory
region (one more `SIM_RPTUN_SHMEM_SIZE` carveout). The vdev is only
claimed when `DRIVERS_VIRTIO_SERIAL` is enabled on the master and
`DRIVERS_VHOST_SERIAL` on the slave; neither is enabled by the in-tree
configs, so they behave as before.
- With the default configs the CPU names are unchanged (`server` /
`proxy`).
- No API or Kconfig change.
## Testing
Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
Every commit builds sim:rpserver, sim:rpproxy, sim:rpserver_uart and
sim:rpproxy_uart with no warnings.
**Serial vdev (sim:rpserver + sim:rpproxy).** On top of the configs:
server `CONFIG_DRIVERS_VIRTIO_SERIAL=y`; proxy
`CONFIG_DRIVERS_VHOST_SERIAL=y CONFIG_PIPES=y`, and a test-only patch
(not in this PR) that creates a FIFO at `/dev/ttyVH0` on the proxy
before `sim_rptun_init()`:
```c
nx_mkfifo("/dev/ttyVH0", 0666, 1024);
```
vhost-serial reads back what it writes into the FIFO, so the server's
`/dev/ttyV0` loops. On the server: `cat /dev/ttyV0 &`,
`echo P112SERIAL > /dev/ttyV0`.
| | master | this PR |
|---|---|---|
| `/dev/ttyV0` on the server (3 runs) | absent: `nsh: cat: open failed: 2` |
present |
| `P112SERIAL` read back by `cat` (3 runs) | no | yes |
<details><summary>this PR</summary>
```
server> cat /dev/ttyV0 &
sh [11:100]
server> echo P112SERIAL > /dev/ttyV0
server> P112SERIAL
```
</details>
<details><summary>master</summary>
```
server> cat /dev/ttyV0 &
nsh: cat: open failed: 2
server> echo P112SERIAL > /dev/ttyV0
nsh: echo: open failed: 2
```
</details>
**CPU names.** With the default configs `rpmsg dump all` shows the same
names as before:
```
[server] Dump rpmsg info between cpu (master: yes)server <==> proxy:
[proxy] Dump rpmsg info between cpu (master: no)proxy <==> server:
```
Not tested: sim instances with names other than server/proxy, and a
real serial device behind `/dev/ttyVH0`.
No regression in rpmsg: sim:rpserver/rpproxy and
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping,
rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC
disabled, which current master needs for nxinit to start nsh there; unrelated
to this change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]