CV-Bowen opened a new pull request, #21050:
URL: https://github.com/apache/nuttx/pull/21050
## Summary
Fixes in the rpmsg_port SPI master and slave drivers:
- the request GPIO interrupt was attached before `rpspi->spi` and
`rpspi->spictl` were set up, so an early edge from the peer ran the
handler on uninitialized fields. Set up SPI first, and drop the SPI
callback again if GPIO setup fails.
- the CONNECT and SHUTDOWN handlers in
`rpmsg_port_spi_process_packet()` released `rpspi->lock` only in the
expected-state branches; any other state left the lock held with
interrupts disabled. Release it in the remaining branch.
- the reconnect path unregisters the port and moves to UNCONNECTED; a
SHUTDOWN arriving after that unregistered it again. Only unregister on
SHUTDOWN when the port is not already UNCONNECTED.
## Impact
`drivers/rpmsg/rpmsg_port_spi.c` and `rpmsg_port_spi_slave.c` only. 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
Build only: no in-tree configuration runs rpmsg_port_spi on hardware
or QEMU. `qemu-armv7a:rpserver` with `CONFIG_SPI`, `CONFIG_SPI_SLAVE`,
`CONFIG_IOEXPANDER`, `CONFIG_IOEXPANDER_DUMMY`, `CONFIG_RPMSG_PORT_SPI`
and `CONFIG_RPMSG_PORT_SPI_SLAVE` builds both drivers without warnings.
The rpmsg baseline below only shows nothing else regressed.
Baseline (`test.sh`, cases: baseline.yaml):
- 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
- tested: nuttx e84a2df0445 apps 5f1100d02
- qemu-armv8a built with test-only overlay: disabled LIBC_ENVPATH
BINFMT_CHECKEXEC
- sim:rpserver + sim:rpproxy: PASS
- [x] `uname -a` (server)
- [x] `rpmsg dump all` (server)
- [x] `rpmsg ping all 10 1024 3 0` (server)
- [x] `uname -a` (proxy)
- [x] `rpmsg ping all 10 1024 3 0` (proxy)
- [x] `mount -t rpmsgfs -o cpu=server,fs=/proc /sp` (proxy)
- [x] `cat /sp/version` (proxy)
- [x] `rpmsg dump all` (proxy)
- qemu-armv8a:rpserver + qemu-armv8a:rpproxy: PASS
- [x] `uname -a` (server)
- [x] `uname -a` (proxy)
- [x] `rpmsg dump all` (server)
- [x] `rpmsg ping all 10 1024 3 0` (server)
- [x] `rpmsg ping all 10 1024 3 0` (proxy)
- [x] `mount -t rpmsgfs -o cpu=server,fs=/proc /sp` (proxy)
- [x] `cat /sp/version` (proxy)
--
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]