CV-Bowen opened a new pull request, #22380:
URL: https://github.com/apache/nuttx/pull/22380

   ## Summary
   
   `rptun: bind a carveout to a virtio device by name`
   
   A carveout was bound to a virtio device by position: the Nth
   `RSC_CARVEOUT` backed the Nth `RSC_VDEV`. One device without a region
   of its own shifts every following index, so a table cannot say "this
   device has none". Bind by name instead:
   
   | carveout name   | used by                                | da set          
| da ANY            |
   
|-----------------|----------------------------------------|-----------------|-------------------|
   | `vdev<N>buffer` | vdev N only                            | mapped at da    
| cut from the pool |
   | `vdevbuffer`    | any vdev without `vdev<N>buffer`       | heap over da    
| -                 |
   
   The pool is built by the master only; both sides read the same table,
   so a slave heap over it would alias the master's allocations. A driver
   side vdev with neither a private carveout nor a pool fails to be
   created.
   
   The vrings used to be carved off the head of the region by a bump
   pointer before the heap was built. They are allocated from the heap
   now; stop() frees them and resets `da` to `FW_RSC_U32_ADDR_ANY`, so a
   restart does not reuse an address of a destroyed heap. A vring placed
   at a fixed `da` in the table is left alone.
   
   The heap name is copied out of the table (mm keeps the pointer and the
   peer can rewrite the table).
   
   ## Impact
   
   - No API, Kconfig or table format change; rptun only.
   - Every in-tree table that has carveouts already names them
     `vdev<N>buffer` with N equal to the vdev index (sim, rptun_ivshmem,
     nrf53, stm32h7, k230, qemu-rv), so by-name binding picks the same
     carveout as before. imx9, mx8mp and am67 have no carveout and only
     run the device side, which does not use one.
   - mpfs (`mpfs_ihc.c`) is the master, drives the rpmsg vdev and has no
     carveout. Before this change it had no memory ops, so rpmsg buffer
     allocation already failed; now creating the vdev fails with -ENOMEM.
     Not run (no hardware).
   - Vrings now cost one heap allocation each. Tables that size the
     carveout as "buffers + 512" (nrf53, stm32h7, k230, qemu-rv) still
     fit on 32-bit by calculation (2 x 232 + 8200 of about 8672 usable
     bytes); not run on hardware.
   - imx93-qsb:rpmsg (arm-gnu-toolchain 13.2.rel1, `make`): ITCM grows by
     544 bytes (127640 -> 128184).
   
   ## 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, qemu-armv8a:rpserver,
   qemu-armv8a:rpproxy and qemu-armv8a:netnsh with 0 warnings.
   
   The existing tables are the targeted test: sim (4 named carveouts) and
   the qemu-armv8a ivshmem table (one `vdev<N>buffer` per vdev) both bind
   by name now.
   
   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 19b2553ff58 apps f0dc662c0
   - qemu-armv8a:rpserver qemu-armv8a:rpproxy 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)
   
   **Pool path.** A test-only change (not in this PR) renames the sim
   rpmsg carveout from `vdev2buffer` to `vdevbuffer`, so the rpmsg vdev
   has no carveout of its own and takes the pool:
   
   ```
   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
   - tested: nuttx 19b2553ff58-dirty apps f0dc662c0
   - 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)
   ```
   (`-dirty` is the test-only table 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]

Reply via email to