CV-Bowen opened a new pull request, #21947:
URL: https://github.com/apache/nuttx/pull/21947
## Summary
The vhost I2C, SPI and RPMB backends are in tree, but no transport
creates their devices, so they cannot be used or tested between two
NuttX instances. Add their entries to the rptun ivshmem resource table:
- `drivers/rptun/rptun_ivshmem`: with `CONFIG_DRIVERS_VHOST_I2C`, a VirtIO
I2C vdev (device role) whose config space names the local bus,
`"/dev/i2c0"`.
- the same for SPI with `CONFIG_DRIVERS_VHOST_SPI`, `"/dev/spi0"`.
- with `CONFIG_DRIVERS_VHOST_RPMB`, a VirtIO RPMB vdev whose eMMC RPMB
partition comes from the new `CONFIG_RPTUN_IVSHMEM_RPMB_PATH`
(default `"/dev/mmcsd0rpmb"`), and a fix for its carveout length after
the 8-byte alignment of its address.
Each vdev has one vring and its own carveout, and is compiled in only
when its backend is enabled, as for the existing vsock and net entries.
## Impact
- Only the ivshmem resource table changes, and only when one of
`DRIVERS_VHOST_I2C`, `DRIVERS_VHOST_SPI`, `DRIVERS_VHOST_RPMB` is set.
No in-tree defconfig sets them, so existing configurations are
unchanged.
- New Kconfig `RPTUN_IVSHMEM_RPMB_PATH` (string, depends on
`DRIVERS_VHOST_RPMB`).
## 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
End to end over the rptun ivshmem transport, with
qemu-armv8a:rpserver running the VirtIO I2C and SPI frontends and
qemu-armv8a:rpproxy running vhost-i2c and vhost-spi. The local buses on
the proxy come from a test-only board patch (not in this PR): a 256-byte
register file at I2C address 0x50 as /dev/i2c0, and the simulated M25P
SPI flash (`drivers/spi/spi_flash.c`) as /dev/spi0.
Overlay on both: `CONFIG_I2C`, `CONFIG_I2C_DRIVER`, `CONFIG_SPI`,
`CONFIG_SPI_EXCHANGE`, `CONFIG_SPI_DRIVER`. rpserver adds
`CONFIG_DRIVERS_VIRTIO_I2C`, `CONFIG_DRIVERS_VIRTIO_SPI`,
`CONFIG_SYSTEM_I2CTOOL`, `CONFIG_SYSTEM_SPITOOL`; rpproxy adds
`CONFIG_DRIVERS_VHOST_I2C`, `CONFIG_DRIVERS_VHOST_SPI`,
`CONFIG_DRIVERS_VHOST_RPMB`, `CONFIG_SPI_FLASH`, `CONFIG_SPI_FLASH_M25P`.
On the server:
| command | master | this PR |
|---|---|---|
| `spi exch -b 0 -x 4 9f000000` (JEDEC ID) | `spitool: -b: argument invalid`
(no SPI vdev) | `FF 20 20 11` |
| SPI write enable, page program, read back | same | written bytes `11 A5 C3
5A` read back |
| `i2c set -b 0 -a 50 -r 10 -s a5`, `-r 11 -s 3c` | `i2ctool: -b: argument
invalid` (no I2C vdev) | `WROTE ... Value: a5` / `3c` |
| `i2c get -b 0 -a 50 -r 10`, `-r 11` | same | `READ ... Value: a5` / `3c` |
<details><summary>this PR</summary>
```
server> spi exch -b 0 -x 4 9f000000
Sending: 9F 00 00 00
Received: FF 20 20 11
server> spi exch -b 0 -x 4 -w 8 9f000000
Sending: 9F 00 00 00
Received: FF 20 20 11
server> spi exch -b 0 -x 1 06
Sending: 06
Received: FF
server> spi exch -b 0 -x 8 0200001011a5c35a
Sending: 02 00 00 10 11 A5 C3 5A
Received: FF FF FF FF FF FF FF FF
server> spi exch -b 0 -x 8 0300001000000000
Sending: 03 00 00 10 00 00 00 00
Received: FF FF FF FF 11 A5 C3 5A
server> i2c set -b 0 -a 50 -r 10 -s a5
WROTE Bus: 0 Addr: 50 Subaddr: 10 Value: a5
server> i2c set -b 0 -a 50 -r 11 -s 3c
WROTE Bus: 0 Addr: 50 Subaddr: 11 Value: 3c
server> i2c get -b 0 -a 50 -r 10
READ Bus: 0 Addr: 50 Subaddr: 10 Value: a5
server> i2c get -b 0 -a 50 -r 11
READ Bus: 0 Addr: 50 Subaddr: 11 Value: 3c
```
</details>
RPMB was built (rpproxy with `CONFIG_DRIVERS_VHOST_RPMB`, the vdev and
`CONFIG_RPTUN_IVSHMEM_RPMB_PATH` present) but not run: vhost-rpmb opens a
real eMMC RPMB partition, and qemu-armv8a has none.
Every commit builds with no warning on qemu-armv8a:rpproxy with and
without the three vhost backends.
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]